| 693 | | # TODO |
| 694 | | # my $self = shift; |
| 695 | | # |
| 696 | | # local $SuperUser = $opt{SuperUser} || ''; |
| 697 | | # |
| 698 | | # my $app = $App; |
| 699 | | # my $author; |
| 700 | | # if ((ref $app) && ($app->{author})) { |
| 701 | | # require MT::Author; |
| 702 | | # $self->progress($self->translate_escape("Setting your permissions to administrator.")); |
| 703 | | # $author = MT::Author->load($app->{author}->id); |
| 704 | | # } elsif ($SuperUser) { |
| 705 | | # require MT::Author; |
| 706 | | # $self->progress($self->translate_escape("Setting your permissions to administrator.")); |
| 707 | | # $author = MT::Author->load($SuperUser); |
| 708 | | # } |
| 709 | | # |
| 710 | | # if ($author) { |
| 711 | | # $author->is_superuser(1); |
| 712 | | # $author->save or return $self->error($self->translate_escape("Error saving record: [_1].", $author->errstr)); |
| 713 | | # } |
| 714 | | # |
| | 693 | my $self = shift; |
| | 694 | |
| | 695 | my $SuperUser = $self->superuser(); |
| | 696 | my $app = $self->app(); |
| | 697 | my $author; |
| | 698 | if ( ( ref $app ) && ( $app->{author} ) ) { |
| | 699 | require MT::Author; |
| | 700 | $self->progress( |
| | 701 | $self->translate_escape( |
| | 702 | "Setting your permissions to administrator.") |
| | 703 | ); |
| | 704 | $author = MT::Author->load( $app->{author}->id ); |
| | 705 | } |
| | 706 | elsif ($SuperUser) { |
| | 707 | require MT::Author; |
| | 708 | $self->progress( |
| | 709 | $self->translate_escape( |
| | 710 | "Setting your permissions to administrator.") |
| | 711 | ); |
| | 712 | $author = MT::Author->load($SuperUser); |
| | 713 | } |
| | 714 | |
| | 715 | if ($author) { |
| | 716 | $author->is_superuser(1); |
| | 717 | $author->save |
| | 718 | or return $self->error( |
| | 719 | $self->translate_escape( |
| | 720 | "Error saving record: [_1].", |
| | 721 | $author->errstr |
| | 722 | ) |
| | 723 | ); |
| | 724 | } |
| | 725 | |