managegroups.py is a script for remotely managing VCL user groups. It uses VCL's XML RPC API to provide an easy command line driven way of doing group management.
NOTE: This script requires python 3.x.
managegroups.py is not included in any official releases. You can download it from our subversion repository.
Running managegroups.py with no arguments provides help on how to use it. It is used by specifying one of the following commands along with parameters specific to each command.
These are the possible values of the return status:
The output of managegroups.py will always start with one of:
The script needs to know what userid/password to use and what URL to access. These can either be defined as variables within the script (look at the very top of the file) or specified as parameters on the command line, before specifying which of managegroups's commands to use.
...
Anchor | ||||
---|---|---|---|---|
|
Use this command to create a new user group.
...
on success, returns:
SUCCESS: User group sucessfully created
Anchor | ||||
---|---|---|---|---|
|
Use this command to get existing information about a user group's attributes (it does not include the current membership of the group).
parameters:
...
on success, returns:
SUCCESS: Attributes retreived
followed by:
owner: <user group owner>
managingGroup: <name of managing user group>
initialMaxTime: <max allowed initial reservation time>
totalMaxTime: <total allowed reservation time>
maxExtendTime: <make time allowed per extension>
Anchor | ||||
---|---|---|---|---|
|
Use this command to delete an existing user group.
parameters:
...
on success, returns:
SUCCESS: User group sucessfully deleted
Anchor | ||||
---|---|---|---|---|
|
Use this command to modify attributes of an existing user group (it is not used for editing the membership of the group). You can specify any combination of the parameters labeled as optional.
parameters:
...
on success, returns:
SUCCESS: User group sucessfully updated
Anchor | ||||
---|---|---|---|---|
|
Use this command to get the current members of a group. Note that it is possible for a group to have no members.
parameters:
...
on success, returns:
SUCCESS: Membership retrieved
followed by one user per line in username@affiliation form
Anchor | ||||
---|---|---|---|---|
|
Use this command to add users to an existing user group. Note: The users will either need to already exist in VCL or be part of an affiliation that is backed by LDAP so that the users can be verified.
parameters:
...
on success, returns:
SUCCESS: Users sucessfully added to group
Anchor | ||||
---|---|---|---|---|
|
Use this command to remove users from an existing user group.
parameters:
...
on success, returns:
SUCCESS: Users sucessfully removed from group
Anchor | ||||
---|---|---|---|---|
|
Use this command to empty the membership of an existing user group.
parameters:
...
on success, returns:
SUCCESS: Users sucessfully removed from group
The last example includes the authentication information on the command line. For the other examples, the authentication would have been specified inline in the script. Authentication information was only included in one example to make the others more readable.
Create a new user group with name FallUsers, affiliation Local, admin as the owner, and adminUsers@Local as the managing group:
Code Block |
---|
managegroups.py -u admin@Local -p passwordhere -r 'https://your.vcl.site/index.php?mode=xmlrpccall' addUserGroup -n FallUsers -a Local -o admin@Local -m adminUsers@Local -i 240 -t 360 -x 30 |
Change the name of an existing user group named FallUsers, affiliation Local to be SpringUsers:
Code Block |
---|
managegroups.py -u admin@Local -p passwordhere -r 'https://your.vcl.site/index.php?mode=xmlrpccall' editUserGroup -n FallUsers -a Local -N SpringUsers |
Add two users specified on the command line to a group:
Code Block |
---|
managegroups.py -u admin@Local -p passwordhere -r 'https://your.vcl.site/index.php?mode=xmlrpccall' addUsersToGroup -n FallUsers -a Local -l student1<at:var at:name="Local,student2" />Local |
Add all users in a specified file to a group:
Code Block |
---|
managegroups.py -u admin@Local -p passwordhere -r 'https://your.vcl.site/index.php?mode=xmlrpccall' addUsersToGroup -n FallUsers -a Local -f newusers.txt |
The file would contain something like the following:
Code Block |
---|
userid1@Local
userid2@Local
userid3@Local
|
Remove all members of a group:
Code Block |
---|
managegroups.py -u admin@Local -p passwordhere -r 'https://your.vcl.site/index.php?mode=xmlrpccall' emptyGroupMembership -n CS101 -a Local |
Delete a user group:
Code Block |
---|
managegroups.py -u admin@Local -p passwordhere -r 'https://your.vcl.site/index.php?mode=xmlrpccall' deleteUserGroup -n CS101 -a Local
|