NAME

BuildForge::Services::DBO::AccessGroup


SYNOPSIS

        use BuildForge::Services;
        $conn = new BuildForge::Services::Connection($hostname);
        $token = $conn->authUser($user, $pass);
        
        # Getting existing access groups
        $allGroups = BuildForge::Services::DBO::AccessGroup->findAll($conn);
        $defaultGroups = BuildForge::Services::DBO::AccessGroup->findDefault($conn);
        $group1 = BuildForge::Services::DBO::AccessGroup->findById($conn, 6);
        $group2 = BuildForge::Services::DBO::AccessGroup->findByName($conn, 'MyAccessGroup');
        # Getter / setter functions
        $id = $group1->getLevel();
        $name = $group1->getName();
        $controlid = $group1->getControlLevel();
        $isdefault = $group1->getDefault();
        $ldapdn = $group1->getLdapDN();
        
        $group1->setName('New Group Name');
        $group1->setDefault(1);
        $group1->setLdapDN('*');
        $group1->setControlLevel(6);
        $group1->update();
        
        # Access group creation, updating, deletion
        $newgroup = new BuildForge::Services::DBO::AccessGroup($conn);
        $newgroup->setName('New Group');
        $newgroup->setControlLevel(4);
        $newgroup->create();
        $newgroup->setName('New Name For Existing Group');
        $newgroup->update();
        $newgroup->delete();
        BuildForge::Services::DBO::AccessGroup->deleteById($conn, $group2->getLevel());
        
        # Changing group permissions
        $permissionlist = BuildForge::Services::DBO::AccessGroup->getPermissionList();
        
        $groupPermissions = $group1->getGroupPermissions();
        $doesGroupHavePermission = $group1->checkPermission('permissionKey');
        $group1->grantPermission('AddProject');
        $group1->revokePermission('AddProject');
        
        # Group members
        $user = BuildForge::Services::DBO::User->findByLogin($conn, 'login');
        $group1->addMemberUser($user->getUserId());
        $members = $group1->getMemberUsers();
        $group1->deleteMemberUser($user->getUserId());
        
        # Child groups
        $group2 = BuildForge::Services::DBO::AccessGroup->findByName($conn, 'MyAccessGroup');
        $group1->addInheritedGroup($group2->getLevel());
        $childgroups = $group1->getInheritedGroups();
        $group1->deleteInheritedGroup($group2->getLevel());
        
        $conn->logout;
        $conn->close;


DESCRIPTION

AccessGroup is used to create and modify BuildForge access groups for use in email notification, permission control, and object access rights.


METHODS

new BuildForge::Services::DBO::AccessGroup(connection, {AccessParamsHashRef})

Creates an AccessGroup instance.

connection

A connected BuildForge::Services::Connection object.

AccessParamsHashRef

An optional reference to a hash containing any or all of the following fields.

name

The name of the access group

def

Set this 1 to make this a default access group that a new user automatically joins, 0 to make it non-default.

ldapDN

An LDAP filter for identifying which distinguished names are granted this access group by default.

controlLevel

The level (access group id) of the access group that ``controls'' this access group. In order to change this group's properties, such as its name or ldapDN settings, the user must be a member of the control group. The default groups use the Security group (level 5) for this purpose.

BuildForge::Services::DBO::AccessGroup->findAll(connection)

Returns a reference to an array of BuildForge::Services::DBO::AccessGroup objects, one for each entry in the database that the current user has access to.

connection

A connected BuildForge::Services::Connection object.

BuildForge::Services::DBO::AccessGroup->findDefault(connection)

Returns a reference to an array of access group IDs (from $accessGroup->getLevel()) for all default access groups. A default access group is one that a newly created user automatically belongs to.

connection

A connected BuildForge::Services::Connection object.

BuildForge::Services::DBO::AccessGroup->findById(connection, id)

Returns the BuildForge::Services::DBO::AccessGroup object that corresponds to the given ID, or undef if no such AccessGroup exists.

connection

A connected BuildForge::Services::Connection object.

id

The ID of the desired AccessGroup (as gotten from getLevel).

BuildForge::Services::DBO::AccessGroup->findByName(connection, name)

Returns the BuildForge::Services::DBO::AccessGroup object that corresponds to the given name, or undef if no such AccessGroup exists.

connection

A connected BuildForge::Services::Connection object.

id

The name of the desired AccessGroup (as gotten from getName).

$accessGroup->create()

Creates an entry for the access group in the database.

$accessGroup->update()

Updates the access group in the database to correspond to the current state of the accessGroup object.

$accessGroup->delete()

Deletes the access group from the database.

BuildForge::Services::DBO::AccessGroup->deleteById(connection, accessGroupId)

Deletes the access group with the given ID from the database.

connection

A connected BuildForge::Services::Connection object.

accessGroupId

The ID of the access group to be deleted (as gotten from AccessGroup::getLevel()).

BuildForge::Services::DBO::AccessGroup->getPermissionList()

Returns a reference to an array of all permission keys.

$accessgroup->getGroupPermissions()

Returns a reference to an array of the keys to all the permissions that the group has.

$accessgroup->checkPermission(permissionKey)

Returns 1 if the group has the specified permission and 0 if it doesn't.

permissionKey

The key for the permission (from BuildForge::Services::DBO::AccessGroup->getPermissionList()).

$accessGroup->grantPermission(permissionKey)

Grants the requested permission to the access group.

permissionKey

The key for the given permission (from BuildForge::Services::DBO::AccessGroup->getPermissionList()).

$accessGroup->revokePermission(permissionKey)

Removes the requested permission from the access group.

permissionKey

The key for the given permission (from BuildForge::Services::DBO::AccessGroup->getPermissionList()).

$accessGroup->getMemberUsers()

Returns a reference to an array of the BuildForge::Services::DBO::User objects that correspond to the members of the access group.

$accessGroup->addMemberUser(userId)

Adds the user corresponding to the user ID to the access group.

userId

The user ID of the desired user (from BuildForge::Services::DBO::User->getUserId()).

$accessGroup->deleteMemberUser(userId)

Removes the user corresponding to the user ID from the access group.

userId

The user ID of the desired user (from BuildForge::Services::DBO::User->getUserId()).

$accessGroup->getParentGroups()

Returns a reference to an array of the BuildForge::Services::DBO::AccessGroup objects that correspond to the parents of the access group. A child access group shares all of the parent access group's permissions (and all of its parents, etc.).

$accessGroup->getChildGroups()

Returns a reference to an array of the BuildForge::Services::DBO::AccessGroup objects that correspond to the children of the access group. A child access group shares all of the parent access group's permissions (and all of its parents, etc.).

$accessGroup->addParentGroup(accessGroupId)

Makes the access group corresponding to the given ID into a parent of the current access group. This group will have all the permissions of the parent group(s).

accessGroupId

The access group ID of the access group to be made a parent (from AccessGroup->getLevel()).

$accessGroup->addChildGroup(accessGroupId)

Makes the access group corresponding to the given ID into a child of the current access group. The child group will gain all this access group's permissions.

accessGroupId

The access group ID of the access group to be made a child (from AccessGroup->getLevel()).

$accessGroup->deleteParentGroup(accessGroupId)

Stops the access group corresponding to the given ID from being a parent of the current access group.

accessGroupId

The access group ID of the access group to be removed from being a parent (from AccessGroup->getLevel()).

$accessGroup->deleteChildGroup(accessGroupId)

Stops the access group corresponding to the given ID from being a child of the current access group.

accessGroupId

The access group ID of the access group to be removed from being a child (from AccessGroup->getLevel()).

$accessGroup->getLevel()

Returns the ID of the access group.

$accessGroup->getName()

Returns the name of the access group.

$accessGroup->getControlLevel()

Returns the ID of the access group that controls the given one. In order to change this group's properties, such as its name or ldapDN settings, the user must be a member of the control group. The default groups use the Security group (level 5) for this purpose.

$accessGroup->getDefault()

Returns 1 if the access group is a default access group (that is, if new users belong to the access group automatically), and 0 otherwise.

$accessGroup->getLdapDN()

Returns the LDAP filter for identifying which distinguished names are granted this access group by default.

$accessGroup->setName(name)

Sets the name of the access group. $accessGroup->update() must be run before changes are replicated in the database.

name

The new name for the group.

$accessGroup->setControlLevel(accessGroupId)

Sets the controlling access group. In order to change this group's properties, such as its name or ldapDN settings, the user must be a member of the control group. The default groups use the Security group (level 5) for this purpose. $accessGroup->update() must be run before changes are replicated in the database.

accessGroupId

The ID of the controlling group (as gotten from AccessGroup->getLevel()).

$accessGroup->setDefault(isDefault)

Sets whether or not this group is a default group. If it is a default group, new users get added to the group automatically when the users are created. $accessGroup->update() must be run before changes are replicated in the database.

isDefault

If this evaluates to true, becomes a default group. If false, not a default group.

$accessGroup->setLdapDN(ldapDN)

Sets the LDAP filter for identifying which distinguished names are granted this access group by default. $accessGroup->update() must be run before changes are replicated in the database.

ldapDN

The new LDAP distinguished name filter.


COPYRIGHT

Copyright (c)2006-2007 International Business Machines, Inc. All rights reserved.