wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[livejournal] r18141: LJSUP-7821. Need admin console command f...

Committer: gprochaev
LJSUP-7821. Need admin console command for obtaining owner information

A   trunk/cgi-bin/LJ/Console/Command/GetOwner.pm
Added: trunk/cgi-bin/LJ/Console/Command/GetOwner.pm
===================================================================
--- trunk/cgi-bin/LJ/Console/Command/GetOwner.pm	                        (rev 0)
+++ trunk/cgi-bin/LJ/Console/Command/GetOwner.pm	2011-01-31 05:15:38 UTC (rev 18141)
@@ -0,0 +1,35 @@
+package LJ::Console::Command::GetOwner;
+
+use strict;
+use base qw(LJ::Console::Command);
+use Carp qw(croak);
+
+sub cmd { "get_owner" }
+
+sub desc { "Given a community username, return a supermaintainer. Given a user account, lists all communities that the user maintains as supermaintainer." }
+
+sub args_desc { [
+                 'user' => "The username of the account you want to look up.",
+                 ] }
+
+sub usage { '<user>' }
+
+sub can_execute {
+    my $remote = LJ::get_remote();
+    return LJ::check_priv($remote, "siteadmin", "elections");
+}
+
+sub execute {
+    my ($self, $user, @args) = @_;
+
+    return $self->error("This command takes exactly one argument. Consult the reference.")
+        unless $user && scalar(@args) == 0;
+
+    my $relation = LJ::Console::Command::GetRelation->new( command => 'get_owner', args => [ $user, 'S' ] );
+    $relation->execute($relation->args);
+    $self->add_responses($relation->responses);
+
+    return 1;
+}
+
+1;

Tags: livejournal, pm, wisest-owl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments