Committer: azateev
LJSUP-13308 Allow user livejournal to run 'invite' console commandU trunk/cgi-bin/LJ/Console/Command/Invite.pm
Modified: trunk/cgi-bin/LJ/Console/Command/Invite.pm =================================================================== --- trunk/cgi-bin/LJ/Console/Command/Invite.pm 2012-08-15 09:05:04 UTC (rev 12464) +++ trunk/cgi-bin/LJ/Console/Command/Invite.pm 2012-08-15 09:32:15 UTC (rev 12465) @@ -14,7 +14,7 @@ 'username' => "Invited user", ] } -sub usage { 'invite to <community> [ +<permition1> +<permition2> ] <username> <username> <username>' } +sub usage { 'to <community> [ +<permition1> +<permition2> ] <username1>, <username2>, ... <usernameX>' } sub can_execute { return LJ::get_remote() ? 1 : 0; @@ -23,6 +23,8 @@ sub execute { my ($self, $cmd, @args) = @_; + my $remote = LJ::get_remote(); + ## 1. Parse and normalize command arguments ## - community_name ## - list of permitions (rights) @@ -38,7 +40,8 @@ ## 1.1. Community my $community_name = $cmd; return $self->error("This command is not allowed for '$community_name'") - unless $community_name eq 'ohnotheydidnt'; + unless $community_name eq 'ohnotheydidnt' || + $remote->user eq 'livejournal'; ## 1.2. Permitions my @rights = (); @@ -76,7 +79,6 @@ ## end of argument parsing ## Stage 2. - my $remote = LJ::get_remote(); ## 2.1 Verify community my $community = LJ::load_user($community_name);