|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
---|---|
AccessControlAttributeBasedSecurity | The AccessControlAttributeBasedSecurityInterface defines a method
to get called by the AccessControlAttributeBasedSecurity pattern. |
ContentItem | The AccessControlAttributeBasedSecurityCallbackInterface
provides methods to retrieve detailed information about the current
ContentItem. |
This package and its sub packages define the portal access control (PAC) API.
The PAC API offers functionality to retrieve and modify access control related information of any resources (e.g. portlets, pages) that are managed by portal access control. In particular, the following data objects and relationships can be created, retrieved, modified and deleted:
AccessControlHome
AccessControlEnvironment
provides some general
information about the Access Control configuration, for example the
available role types.AccessControlGlobalRuntimeModel
provides read access
to the current access control permissions on any resource that is
registered at Portal Access Control.AccessControlRuntimeModel
provides read access to the
current access control permissions on one specific resource.ManagedProtectedResource
provides read access to the access
control configuration of any resource that is registered at PAC.ManagedProtectedResourceController
provides write access to
the access control configuration of any resource that is registered at
PAC.RoleData
provides read access to the role data of a
single resource, such as role assignments.RoleData
provides write access to the role data of a
single resource, such as role assignments.ManagedProtectedResource
represents the hierarchical tree
model of protected resources per Database Domain.Identifiable resource = ... ; // some resource, for example a portlet Context ctx = new InitialContext(); AccessControlHome home = (AccessControlHome) ctx.lookup(AccessControlHome.JNDI_NAME); ManagedProtectedResource pacResource = home.getManagedProtectedResource(resource); RoleData resourceRoleData = home.getRoleData(resource); Principal owner = pacResource.getOwner(); Seteditors = resourceRoleData.getMappedPrincipals(RoleType.EDITOR);
Identifiable resource = ... ; // some resource, for example a portlet Principal bob = ... ; // some principal, for example Bob Context ctx = new InitialContext(); AccessControlHome home = (AccessControlHome) ctx.lookup(AccessControlHome.JNDI_NAME); RoleData resourceRoleData = home.getRoleData(resource); Setassignments = resourceRoleData.getRoleAssignments(bob); for (RoleAssignment assignment: assignments) { // p is either bob or any group that bob belongs to Principal p = assignment.getPrincipal; Role role = assignment.getRole(); // resourceID is either the ID of the above resource or of any parent ObjectID resourceID = role.getResourceID(); // the role type of the mapping RoleType roleType = role.getRoleType(); }
Identifiable resource = ... ; // some resource, for example a portlet Principal bob = ... ; // some principal, for example Bob Context ctx = new InitialContext(); AccessControlHome home = (AccessControlHome) ctx.lookup(AccessControlHome.JNDI_NAME); AccessControlRuntimeModel runtimeModel = home.getAccessControlRuntimeModel(resource); boolean isAllowed = runtimeModel.isAllowed(bob, RoleType.USER); // the following is equivalent AccessControlEnvironment environment = home.getAccessControlEnvironment(); Permission permission = environment.getPermission(resource, RoleType.USER); AccessControlGlobalRuntimeModel gobalModel = home.getAccessControlGlobalRuntimeModel(); globalModel.hasPermission(bob, permission);
Identifiable resource = ... ; // some resource, for example a portlet Principal bob = ... ; // some principal, for example Bob Context ctx = new InitialContext(); AccessControlHome home = (AccessControlHome) ctx.lookup(AccessControlHome.JNDI_NAME); ManagedProtectedResource resourceController = home.getManagedProtectedResourceController(resource); CollectionroleBlocks = Collection.singleton(RoleType.EDITOR); // the EDITOR inheritance role block is added to the existing role blocks resourceController.addInheritanceBlockedRoleTypes(roleBlocks); // the EDITOR inheritance role block is set (so it becomes the only inheritance block) resourceController.setInheritanceBlockedRoleTypes(roleBlocks); // the EDITOR inheritance role block is removed resourceController.removeInheritanceBlockedRoleTypes(roleBlocks);
Identifiable resource = ... ; // some resource, for example a portlet Principal bob = ... ; // some principal, for example Bob Context ctx = new InitialContext(); AccessControlHome home = (AccessControlHome) ctx.lookup(AccessControlHome.JNDI_NAME); RoleDataController roleController = home.getRoleDataController(resource); Collectionprincipals = Collection.singleton(bob); // bob is assigned the EDITOR role roleController.addPrincipalsToRole(RoleType.EDITOR, principals); // bob is unassigned from the MANAGER role roleController.removePrincipalsFromRole(RoleType.MANAGER, principals);
|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |