/** * Calculates the permissions of the given user and his groups from the access control list.<p> * The permissions are returned as permission string in the format {{+|-}{r|w|v|c|i}}*. * * @param user the user * @param groups the groups of this user * @param roles the roles of this user * * @return a string that displays the permissions */ public String getPermissionString(CmsUser user, List groups, List roles) { return getPermissions(user, groups, roles).getPermissionString(); }
/** * Calculates the permissions of the given user and his groups from the access control list.<p> * The permissions are returned as permission string in the format {{+|-}{r|w|v|c|i}}*. * * @param user the user * @param groups the groups of this user * @param roles the roles of this user * * @return a string that displays the permissions */ public String getPermissionString(CmsUser user, List<CmsGroup> groups, List<CmsRole> roles) { return getPermissions(user, groups, roles).getPermissionString(); }
/** * Displays the access control list of a given resource.<p> * * @param resourceName the name of the resource * * @throws Exception if something goes wrong * * @see CmsObject#getAccessControlList(String) */ public void getAcl(String resourceName) throws Exception { CmsAccessControlList acList = m_cms.getAccessControlList(resourceName); Iterator principals = acList.getPrincipals().iterator(); while (principals.hasNext()) { I_CmsPrincipal p = m_cms.lookupPrincipal((CmsUUID)principals.next()); System.out.println(p.getName() + ": " + acList.getPermissions(p.getId()).getPermissionString()); } }
/** * Displays the access control list of a given resource.<p> * * @param resourceName the name of the resource * * @throws Exception if something goes wrong * * @see CmsObject#getAccessControlList(String) */ public void getAcl(String resourceName) throws Exception { CmsAccessControlList acList = m_cms.getAccessControlList(resourceName); Iterator<CmsUUID> principals = acList.getPrincipals().iterator(); while (principals.hasNext()) { I_CmsPrincipal p = m_cms.lookupPrincipal(principals.next()); m_shell.getOut().println(p.getName() + ": " + acList.getPermissions(p.getId()).getPermissionString()); } }
/** * Returns the set of permissions of the current user for a given resource.<p> * * @param dbc the current database context * @param resource the resource * @param user the user * * @return bit set with allowed permissions * * @throws CmsException if something goes wrong */ public CmsPermissionSetCustom getPermissions(CmsDbContext dbc, CmsResource resource, CmsUser user) throws CmsException { CmsAccessControlList acList = getAccessControlList(dbc, resource, false); return acList.getPermissions(user, getGroupsOfUser(dbc, user.getName(), false), getRolesForUser(dbc, user)); }
CmsUUID principalId = (CmsUUID)i.next(); if (!principalId.equals(CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_ID)) { CmsPermissionSet permissions = acList.getPermissions(principalId);
/** * Returns the set of permissions of the current user for a given resource.<p> * * @param dbc the current database context * @param resource the resource * @param user the user * * @return bit set with allowed permissions * * @throws CmsException if something goes wrong */ public CmsPermissionSetCustom getPermissions(CmsDbContext dbc, CmsResource resource, CmsUser user) throws CmsException { CmsAccessControlList acList = getAccessControlList(dbc, resource, false); return acList.getPermissions(user, getGroupsOfUser(dbc, user.getName(), false), getRolesForUser(dbc, user)); }
CmsUUID principalId = i.next(); if (!principalId.equals(CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_ID)) { CmsPermissionSet permissions = acList.getPermissions(principalId);
CmsUUID principalId = i.next(); if (!principalId.equals(CmsAccessControlEntry.PRINCIPAL_OVERWRITE_ALL_ID)) { CmsPermissionSet permissions = acList.getPermissions(principalId);
if (acl.getPermissions(user.getId()) != null) { while (itGroups.hasNext()) { CmsGroup group = itGroups.next(); if (acl.getPermissions(group.getId()) != null) { while (itRoles.hasNext()) { CmsRole role = itRoles.next(); if (acl.getPermissions(role.getId()) != null) { permissions = acl.getPermissions(user, groups, roles);
if (acl.getPermissions(user.getId()) != null) { while (itGroups.hasNext()) { CmsGroup group = (CmsGroup)itGroups.next(); if (acl.getPermissions(group.getId()) != null) { while (itRoles.hasNext()) { CmsRole role = (CmsRole)itRoles.next(); if (acl.getPermissions(role.getId()) != null) { permissions = acl.getPermissions(user, groups, roles);