We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 511566a1 authored by Evan Prodromou's avatar Evan Prodromou

userrole.php will take a profile id for remote profiles

parent c09487f2
......@@ -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";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment