mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-06-14 06:15 pm

[dw-free] Staff users should be able to bypass protected username restrictions

[commit: http://hg.dwscoalition.org/dw-free/rev/2f9819acdf88]

http://bugs.dwscoalition.org/show_bug.cgi?id=893

Allow people with siteadmin:usernames to override the check for a valid
username.

Patch by [staff profile] denise.

Files modified:
  • cgi-bin/LJ/User.pm
--------------------------------------------------------------------------------
diff -r f87be08847c5 -r 2f9819acdf88 cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm	Sun Jun 14 18:12:35 2009 +0000
+++ b/cgi-bin/LJ/User.pm	Sun Jun 14 18:15:55 2009 +0000
@@ -341,6 +341,11 @@ sub is_protected_username {
 sub is_protected_username {
     my ( $class, $username ) = @_;
 
+    # site admins (people with siteadmin:usernames) can override this check and
+    # create any account they want
+    my $remote = LJ::get_remote();
+    return 0 if $remote && $remote->has_priv( siteadmin => 'usernames' );
+
     my @res = grep { $_ } split( /\r?\n/, LJ::load_include( 'reserved-usernames' ) );
     foreach my $re ( @res ) {
         return 1 if $username =~ /$re/;
--------------------------------------------------------------------------------