diff options
author | Brion Vibber <brion@pobox.com> | 2010-10-28 16:27:53 -0700 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-10-28 16:27:53 -0700 |
commit | e7c7fd39fc948f1169512916077185dd29973b60 (patch) | |
tree | 6fe8c025a308d423c87444a5daa5da1d02d62182 /scripts/userrole.php | |
parent | b483a0549f115b2d5f2cfb3d447e6cc5c4f469f3 (diff) | |
parent | b26eccf33cf69c04a96d5d6d3eddc0ef68ffd4b1 (diff) |
Merge branch '1.0.x' into schema-x
Conflicts:
plugins/CacheLog/locale/nb/LC_MESSAGES/CacheLog.po
Diffstat (limited to 'scripts/userrole.php')
-rw-r--r-- | scripts/userrole.php | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/scripts/userrole.php b/scripts/userrole.php index 7b6a9b3fd..a2cc7def8 100644 --- a/scripts/userrole.php +++ b/scripts/userrole.php @@ -38,8 +38,8 @@ require_once INSTALLDIR.'/scripts/commandline.inc'; if (have_option('i', 'id')) { $id = get_option_value('i', 'id'); - $user = User::staticGet('id', $id); - if (empty($user)) { + $profile = Profile::staticGet('id', $id); + if (empty($profile)) { print "Can't find user with ID $id\n"; exit(1); } @@ -50,6 +50,11 @@ if (have_option('i', 'id')) { print "Can't find user with nickname '$nickname'\n"; exit(1); } + $profile = $user->getProfile(); + if (empty($profile)) { + print "User with ID $id has no profile\n"; + exit(1); + } } else { print "You must provide either an ID or a nickname.\n"; exit(1); @@ -63,9 +68,9 @@ if (empty($role)) { } if (have_option('d', 'delete')) { - print "Revoking role '$role' from user '$user->nickname' ($user->id)..."; + print "Revoking role '$role' from user '$profile->nickname' ($profile->id)..."; try { - $user->revokeRole($role); + $profile->revokeRole($role); print "OK\n"; } catch (Exception $e) { print "FAIL\n"; @@ -73,9 +78,9 @@ if (have_option('d', 'delete')) { print "\n"; } } else { - print "Granting role '$role' to user '$user->nickname' ($user->id)..."; + print "Granting role '$role' to user '$profile->nickname' ($profile->id)..."; try { - $user->grantRole($role); + $profile->grantRole($role); print "OK\n"; } catch (Exception $e) { print "FAIL\n"; |