VCS::CMSynergy::Users - Perl interface to Synergy user administration
use VCS::CMSynergy::Users; $hash_ref = $ccm->users; $ccm->users(\%user_roles); $ccm->add_user($user, @roles); $ccm->delete_user($user); @roles = $ccm->get_roles($user); $ccm->add_roles($user, @roles); $ccm->delete_roles($user, @roles);
NOTE: This interface is subject to change.
use VCS::CMSynergy; use VCS::CMSynergy::Users; my $ccm = VCS::CMSynergy->new(database => "/ccmdb/test/tut62/db"); $ccm->add_user('jluser', qw(developer build_mgr));
$hash_ref = $ccm->users; $ccm->users($hash_ref);
The first form gets the table of users and their roles as a hash ref. The keys are the user names and the values are array refs containing the user's roles, e.g.
$hash_ref = { 'jluser' => [ qw(developer) ], 'psizzle' => [ qw(developer build_mgr) ], ... };
You need not be in the ccm_admin role to use this form (because it is not implemented via ccm users).
The second form replaces the existing table of users and their roles with the contents of $hashref. Duplicate roles will be removed from $hashref's values before writing back the table. You must be in the ccm_admin role to use this form.
$hashref
All operations try to preserve the order of roles (add_roles appends the roles that are actually new for the user). This mostly matters for the role listed first for a user, as Synergy uses this as default role for the user's session when the user calls ccm start without the -r option.
Newer version of Synergy treat user names case insensitively. Hence the value returned by "users" is actually a Tie::CPHash, a case insensitive, but case preserving hash table.
Tie::CPHash
Note that the roundtrip
$ccm->users($ccm->users);
always results in a functionally equivalent users table. The order of user lines may have changed, though.
Note: For typical Synergy administrator usage it is usually more convenient to use one of the methods below.
$ccm->add_user($user, @roles);
Adds the user with the given roles. If the user already exists her roles will be reset to the ones given.
$ccm->delete_user($user);
Deletes the user. It is no error if the user doesn't exist.
$ccm->add_roles($user, @roles);
Grants the given roles to the user. It is no error if the user already has some of the given roles.
$ccm->delete_roles($user, @roles);
Revokes the given roles from the user. It is no error if the user doesn't have any of the given rules.
If there are no roles left, also deletes the user.
@roles = $ccm->get_roles($user);
Returns the roles for the user. Returns an empty list if the user doesn't exist.
VCS::CMSynergy VCS::CMSynergy::Object, VCS::CMSynergy::Client,
Roderich Schupp, argumentum GmbH <schupp@argumentum.de>
To install VCS::CMSynergy, copy and paste the appropriate command in to your terminal.
cpanm
cpanm VCS::CMSynergy
CPAN shell
perl -MCPAN -e shell install VCS::CMSynergy
For more information on module installation, please visit the detailed CPAN module installation guide.