findAll(connection)
findDefault(connection)
create()
update()
delete()
getPermissionList()
getGroupPermissions()
checkPermission(permissionKey)
grantPermission(permissionKey)
revokePermission(permissionKey)
getMemberUsers()
addMemberUser(userId)
deleteMemberUser(userId)
getParentGroups()
getChildGroups()
addParentGroup(accessGroupId)
addChildGroup(accessGroupId)
deleteParentGroup(accessGroupId)
deleteChildGroup(accessGroupId)
getLevel()
getName()
getControlLevel()
getDefault()
getLdapDN()
setName(name)
setControlLevel(accessGroupId)
setDefault(isDefault)
setLdapDN(ldapDN)
BuildForge::Services::DBO::AccessGroup
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;
AccessGroup is used to create and modify BuildForge access groups for use in email notification, permission control, and object access rights.
Creates an AccessGroup instance.
A connected BuildForge::Services::Connection object.
An optional reference to a hash containing any or all of the following fields.
The name of the access group
Set this 1 to make this a default access group that a new user automatically joins, 0 to make it non-default.
An LDAP filter for identifying which distinguished names are granted this access group by default.
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.
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.
A connected BuildForge::Services::Connection object.
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.
A connected BuildForge::Services::Connection object.
Returns the BuildForge::Services::DBO::AccessGroup object that corresponds to the given ID, or undef if no such AccessGroup exists.
A connected BuildForge::Services::Connection object.
The ID of the desired AccessGroup (as gotten from getLevel).
Returns the BuildForge::Services::DBO::AccessGroup object that corresponds to the given name, or undef if no such AccessGroup exists.
A connected BuildForge::Services::Connection object.
The name of the desired AccessGroup (as gotten from getName).
create()
Creates an entry for the access group in the database.
update()
Updates the access group in the database to correspond to the current state of the accessGroup object.
delete()
Deletes the access group from the database.
Deletes the access group with the given ID from the database.
A connected BuildForge::Services::Connection object.
The ID of the access group to be deleted (as gotten from AccessGroup::getLevel()).
getPermissionList()
Returns a reference to an array of all permission keys.
getGroupPermissions()
Returns a reference to an array of the keys to all the permissions that the group has.
checkPermission(permissionKey)
Returns 1 if the group has the specified permission and 0 if it doesn't.
The key for the permission (from BuildForge::Services::DBO::AccessGroup->getPermissionList()).
grantPermission(permissionKey)
Grants the requested permission to the access group.
The key for the given permission (from BuildForge::Services::DBO::AccessGroup->getPermissionList()).
revokePermission(permissionKey)
Removes the requested permission from the access group.
The key for the given permission (from BuildForge::Services::DBO::AccessGroup->getPermissionList()).
getMemberUsers()
Returns a reference to an array of the BuildForge::Services::DBO::User objects that correspond to the members of the access group.
addMemberUser(userId)
Adds the user corresponding to the user ID to the access group.
The user ID of the desired user (from BuildForge::Services::DBO::User->getUserId()).
deleteMemberUser(userId)
Removes the user corresponding to the user ID from the access group.
The user ID of the desired user (from BuildForge::Services::DBO::User->getUserId()).
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.).
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.).
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).
The access group ID of the access group to be made a parent (from AccessGroup->getLevel()).
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.
The access group ID of the access group to be made a child (from AccessGroup->getLevel()).
deleteParentGroup(accessGroupId)
Stops the access group corresponding to the given ID from being a parent of the current access group.
The access group ID of the access group to be removed from being a parent (from AccessGroup->getLevel()).
deleteChildGroup(accessGroupId)
Stops the access group corresponding to the given ID from being a child of the current access group.
The access group ID of the access group to be removed from being a child (from AccessGroup->getLevel()).
getLevel()
Returns the ID of the access group.
getName()
Returns the name of the access group.
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.
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.
getLdapDN()
Returns the LDAP filter for identifying which distinguished names are granted this access group by default.
setName(name)
Sets the name of the access group. $accessGroup->update()
must be run before changes are
replicated in the database.
The new name for the group.
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.
The ID of the controlling group (as gotten from AccessGroup->getLevel()).
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.
If this evaluates to true, becomes a default group. If false, not a default group.
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.
The new LDAP distinguished name filter.
Copyright (c)2006-2007 International Business Machines, Inc. All rights reserved.