From 321ac38884125f1af9e8f07323f096505d0b2644 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sat, 7 Nov 2009 22:35:35 -0500 Subject: script for granting/revoking user roles --- scripts/userrole.php | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 scripts/userrole.php diff --git a/scripts/userrole.php b/scripts/userrole.php new file mode 100644 index 000000000..7b6a9b3fd --- /dev/null +++ b/scripts/userrole.php @@ -0,0 +1,85 @@ +#!/usr/bin/env php +. + */ + +define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); + +$shortoptions = 'i:n:r:d'; +$longoptions = array('id=', 'nickname=', 'role=', 'delete'); + +$helptext = <<nickname' ($user->id)..."; + try { + $user->revokeRole($role); + print "OK\n"; + } catch (Exception $e) { + print "FAIL\n"; + print $e->getMessage(); + print "\n"; + } +} else { + print "Granting role '$role' to user '$user->nickname' ($user->id)..."; + try { + $user->grantRole($role); + print "OK\n"; + } catch (Exception $e) { + print "FAIL\n"; + print $e->getMessage(); + print "\n"; + } +} -- cgit v1.2.3-54-g00ecf