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

[livejournal] r20466: LJSUP-10255: Community directory: Report...

Committer: gprochaev
LJSUP-10255: Community directory: Reports

U   trunk/cgi-bin/LJ/User.pm
Modified: trunk/cgi-bin/LJ/User.pm
===================================================================
--- trunk/cgi-bin/LJ/User.pm	2011-11-01 11:57:19 UTC (rev 20465)
+++ trunk/cgi-bin/LJ/User.pm	2011-11-01 12:30:56 UTC (rev 20466)
@@ -7093,6 +7093,34 @@
 #
 #
 # <LJFUNC>
+# name: LJ::users_by_priv
+# class:
+# des: Return users with a certain privilege.
+# args: priv, arg?
+# des-args: user privilege to searching. arg can be "*" for all args.
+# return: Userids or empty list.
+# TODO Add store to MemCache
+sub users_by_priv {
+    my ($priv, $arg) = @_;
+    
+    my $dbr = LJ::get_db_reader();
+    return unless $dbr;
+
+    return unless $priv;
+    $arg ||= '*';
+    my $users = $dbr->selectcol_arrayref ("SELECT userid FROM priv_list pl, priv_map pm
+                                           WHERE pl.prlid = pm.prlid 
+                                                AND privcode = ?
+                                                AND arg = ?
+                                        ", undef, $priv, $arg);
+
+    return unless ref $users eq 'ARRAY';
+    return $users;
+}
+
+#
+#
+# <LJFUNC>
 # name: LJ::remote_has_priv
 # class:
 # des: Check to see if the given remote user has a certain privilege.

Tags: gprochaev, 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