]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
change uses of User_role to Profile_role
authorEvan Prodromou <evan@status.net>
Mon, 16 Nov 2009 15:06:52 +0000 (16:06 +0100)
committerEvan Prodromou <evan@status.net>
Mon, 16 Nov 2009 15:06:52 +0000 (16:06 +0100)
classes/Profile.php
classes/User.php

index 2668efcc70cd4bd3f524eeb7048f018815c0a37d..5b4394d3b725a522f86019803d8634161d9af02b 100644 (file)
@@ -590,18 +590,18 @@ class Profile extends Memcached_DataObject
 
     function hasRole($name)
     {
-        $role = User_role::pkeyGet(array('user_id' => $this->id,
-                                         'role' => $name));
+        $role = Profile_role::pkeyGet(array('profile_id' => $this->id,
+                                            'role' => $name));
         return (!empty($role));
     }
 
     function grantRole($name)
     {
-        $role = new User_role();
+        $role = new Profile_role();
 
-        $role->user_id = $this->id;
-        $role->role    = $name;
-        $role->created = common_sql_now();
+        $role->profile_id = $this->id;
+        $role->role       = $name;
+        $role->created    = common_sql_now();
 
         $result = $role->insert();
 
@@ -615,8 +615,8 @@ class Profile extends Memcached_DataObject
 
     function revokeRole($name)
     {
-        $role = User_role::pkeyGet(array('user_id' => $this->id,
-                                         'role' => $name));
+        $role = Profile_role::pkeyGet(array('profile_id' => $this->id,
+                                            'role' => $name));
 
         if (empty($role)) {
             throw new Exception('Cannot revoke role "'.$name.'" for user #'.$this->id.'; does not exist.');
@@ -634,31 +634,31 @@ class Profile extends Memcached_DataObject
 
     function isSandboxed()
     {
-        return $this->hasRole(User_role::SANDBOXED);
+        return $this->hasRole(Profile_role::SANDBOXED);
     }
 
     function isSilenced()
     {
-        return $this->hasRole(User_role::SILENCED);
+        return $this->hasRole(Profile_role::SILENCED);
     }
 
     function sandbox()
     {
-        $this->grantRole(User_role::SANDBOXED);
+        $this->grantRole(Profile_role::SANDBOXED);
     }
 
     function unsandbox()
     {
-        $this->revokeRole(User_role::SANDBOXED);
+        $this->revokeRole(Profile_role::SANDBOXED);
     }
 
     function silence()
     {
-        $this->grantRole(User_role::SILENCED);
+        $this->grantRole(Profile_role::SILENCED);
     }
 
     function unsilence()
     {
-        $this->revokeRole(User_role::SILENCED);
+        $this->revokeRole(Profile_role::SILENCED);
     }
 }
index 1dca59f2376ab35549894038e3b794b7e95175ff..82d3bd59ae2913fe1edd91475567f6822c4b2849 100644 (file)
@@ -679,10 +679,10 @@ class User extends Memcached_DataObject
             case Right::SANDBOXUSER:
             case Right::SILENCEUSER:
             case Right::DELETEUSER:
-                $result = $this->hasRole(User_role::MODERATOR);
+                $result = $this->hasRole(Profile_role::MODERATOR);
                 break;
             case Right::CONFIGURESITE:
-                $result = $this->hasRole(User_role::ADMINISTRATOR);
+                $result = $this->hasRole(Profile_role::ADMINISTRATOR);
                 break;
             default:
                 $result = false;