The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

VCS::CMSynergy::Users - Perl interface to CM Synergy user administration

SYNOPSIS

  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);

DESCRIPTION

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));

METHODS

users
  $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 can use this form with any role (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. You must have the ccm_admin role to use this form. For typical CM Synergy administrator usage it is usually more convenient to use one of the methods below.

add_user
  $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.

delete_user
  $ccm->delete_user($user);

Deletes the user. No error is signalled if the user doesn't exist.

add_roles
  $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 rules.

delete_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.

get_roles
  @roles = $ccm->get_roles($user);

Returns the roles for the user. Returns an empty list if the user doesn't exist.