/** * Returns the String representation of this permission set object.<p> * * @see java.lang.Object#toString() */ @Override public String toString() { return "[PermissionSet:] " + getPermissionString(); } }
/** * Returns the String representation of this permission set object.<p> * * @see java.lang.Object#toString() */ @Override public String toString() { return "[PermissionSet:] " + getPermissionString(); } }
/** * Returns the permissions string for the given resource.<p> * * @return the permissions string for the given resource */ public String getPermissionString() { return getPermissionSet().getPermissionString(); }
/** * Returns the permissions string for the given resource.<p> * * @return the permissions string for the given resource */ public String getPermissionString() { return getPermissionSet().getPermissionString(); }
/** * @see org.opencms.db.I_CmsCacheKey#getCacheKeyForUserPermissions(java.lang.String, org.opencms.db.CmsDbContext, org.opencms.file.CmsResource, org.opencms.security.CmsPermissionSet) */ public String getCacheKeyForUserPermissions( String prefix, CmsDbContext context, CmsResource resource, CmsPermissionSet requiredPermissions) { if (!context.getProjectId().isNullUUID()) { return ""; } StringBuffer cacheBuffer = new StringBuffer(64); cacheBuffer.append(prefix); cacheBuffer.append('_'); cacheBuffer.append(context.currentUser().getName()); cacheBuffer.append(context.currentProject().isOnlineProject() ? "_0_" : "_1_"); cacheBuffer.append(requiredPermissions.getPermissionString()); cacheBuffer.append('_'); cacheBuffer.append(resource.getStructureId().toString()); return cacheBuffer.toString(); } }
/** * @see org.opencms.db.I_CmsCacheKey#getCacheKeyForUserPermissions(java.lang.String, org.opencms.db.CmsDbContext, org.opencms.file.CmsResource, org.opencms.security.CmsPermissionSet) */ public String getCacheKeyForUserPermissions( String prefix, CmsDbContext context, CmsResource resource, CmsPermissionSet requiredPermissions) { if (!context.getProjectId().isNullUUID()) { return ""; } StringBuffer cacheBuffer = new StringBuffer(64); cacheBuffer.append(prefix); cacheBuffer.append('_'); cacheBuffer.append(context.currentUser().getName()); cacheBuffer.append(context.currentProject().isOnlineProject() ? "_0_" : "_1_"); cacheBuffer.append(requiredPermissions.getPermissionString()); cacheBuffer.append('_'); cacheBuffer.append(resource.getStructureId().toString()); return cacheBuffer.toString(); } }
/** * Lists the access control entries of a given resource.<p> * * @param resourceName the name of the resource * @throws Exception if something goes wrong */ public void lsacc(String resourceName) throws Exception { List acList = m_cms.getAccessControlEntries(resourceName); for (int i = 0; i < acList.size(); i++) { CmsAccessControlEntry ace = (CmsAccessControlEntry)acList.get(i); I_CmsPrincipal acePrincipal = m_cms.lookupPrincipal(ace.getPrincipal()); String pName = (acePrincipal != null) ? acePrincipal.getName() : ace.getPrincipal().toString(); System.out.println(pName + ": " + ace.getPermissions().getPermissionString() + " " + ace); } }
/** * Lists the access control entries of a given resource.<p> * * @param resourceName the name of the resource * @throws Exception if something goes wrong */ public void lsacc(String resourceName) throws Exception { List<CmsAccessControlEntry> acList = m_cms.getAccessControlEntries(resourceName); for (int i = 0; i < acList.size(); i++) { CmsAccessControlEntry ace = acList.get(i); I_CmsPrincipal acePrincipal = m_cms.lookupPrincipal(ace.getPrincipal()); String pName = (acePrincipal != null) ? acePrincipal.getName() : ace.getPrincipal().toString(); m_shell.getOut().println(pName + ": " + ace.getPermissions().getPermissionString() + " " + ace); } }
/** * Lists the access control entries belonging to the given principal.<p> * * @param resourceName the name of the resource * @param principalName the name of the principal * @throws Exception if something goes wrong */ public void lsacc(String resourceName, String principalName) throws Exception { I_CmsPrincipal principal = m_cms.lookupPrincipal(principalName); List acList = m_cms.getAccessControlEntries(resourceName); for (int i = 0; i < acList.size(); i++) { CmsAccessControlEntry ace = (CmsAccessControlEntry)acList.get(i); I_CmsPrincipal acePrincipal = m_cms.lookupPrincipal(ace.getPrincipal()); if (principal.equals(acePrincipal)) { String pName = (acePrincipal != null) ? acePrincipal.getName() : ace.getPrincipal().toString(); System.out.println(pName + ": " + ace.getPermissions().getPermissionString() + " " + ace); } } }
/** * Checks if the permissions of the current user on the resource to use in the dialog are sufficient.<p> * * Automatically generates a CmsMessageContainer object with an error message and stores it in the users session.<p> * * @param required the required permissions for the dialog * @param neededForFolder if true, the permissions are required for the parent folder of the resource (e.g. for editors) * * @return true if the permissions are sufficient, otherwise false */ protected boolean checkResourcePermissions(CmsPermissionSet required, boolean neededForFolder) { return checkResourcePermissions(required, neededForFolder, Messages.get().container( Messages.GUI_ERR_RESOURCE_PERMISSIONS_2, getParamResource(), required.getPermissionString())); }
/** * Checks if the permissions of the current user on the resource to use in the dialog are sufficient.<p> * * Automatically generates a CmsMessageContainer object with an error message and stores it in the users session.<p> * * @param required the required permissions for the dialog * @param neededForFolder if true, the permissions are required for the parent folder of the resource (e.g. for editors) * * @return true if the permissions are sufficient, otherwise false */ protected boolean checkResourcePermissions(CmsPermissionSet required, boolean neededForFolder) { return checkResourcePermissions( required, neededForFolder, Messages.get().container( Messages.GUI_ERR_RESOURCE_PERMISSIONS_2, getParamResource(), required.getPermissionString())); }
/** * Lists the access control entries belonging to the given principal.<p> * * @param resourceName the name of the resource * @param principalName the name of the principal * @throws Exception if something goes wrong */ public void lsacc(String resourceName, String principalName) throws Exception { I_CmsPrincipal principal = m_cms.lookupPrincipal(principalName); List<CmsAccessControlEntry> acList = m_cms.getAccessControlEntries(resourceName); for (int i = 0; i < acList.size(); i++) { CmsAccessControlEntry ace = acList.get(i); I_CmsPrincipal acePrincipal = m_cms.lookupPrincipal(ace.getPrincipal()); if (principal.equals(acePrincipal)) { String pName = (acePrincipal != null) ? acePrincipal.getName() : ace.getPrincipal().toString(); m_shell.getOut().println(pName + ": " + ace.getPermissions().getPermissionString() + " " + ace); } } }
if (ace.getPrincipal().equals(group.getId())) { if (CmsStringUtil.isNotEmptyOrWhitespaceOnly( ace.getPermissions().getPermissionString())) { html.append(" (" + ace.getPermissions().getPermissionString() + ")");
/** * Creates a string representation of an access control entry.<p> * * @param ace the access control entry * * @return the string representation of the access control entry */ private String getAceString(CmsAccessControlEntry ace) { String result = ace.getPermissions().getPermissionString() + (ace.isResponsible() ? ace.getResponsibleString() : "") + ace.getInheritingString(); if ((ace.getFlags() & CmsAccessControlEntry.ACCESS_FLAGS_OVERWRITE) != 0) { result = result + " (" + Messages.get().getBundle(OpenCms.getWorkplaceManager().getWorkplaceLocale(m_cms)).key( Messages.GUI_PERMISSION_COLUMN_OVERWRITE_0) + ")"; } return result; }
if (ace.getPrincipal().equals(user.getId())) { if (CmsStringUtil.isNotEmptyOrWhitespaceOnly( ace.getPermissions().getPermissionString())) { item.set( LIST_COLUMN_PERMISSIONS, user.getName() + ": " + ace.getPermissions().getPermissionString()); if (ace.getPrincipal().equals(user.getId())) { if (CmsStringUtil.isNotEmptyOrWhitespaceOnly( ace.getPermissions().getPermissionString())) { String data = user.getName() + ": " + ace.getPermissions().getPermissionString(); if (oldData != null) { data = oldData + ", " + data;
if (ace.getPrincipal().equals(group.getId())) { if (CmsStringUtil.isNotEmptyOrWhitespaceOnly( ace.getPermissions().getPermissionString())) { item.set( LIST_COLUMN_PERMISSIONS, group.getName() + ": " + ace.getPermissions().getPermissionString()); if (ace.getPrincipal().equals(group.getId())) { if (CmsStringUtil.isNotEmptyOrWhitespaceOnly( ace.getPermissions().getPermissionString())) { String data = group.getName() + ": " + ace.getPermissions().getPermissionString(); if (oldData != null) { data = oldData + ", " + data;
Messages.ERR_PERM_DENIED_2, context.getSitePath(resource), requiredPermissions.getPermissionString()));
Messages.ERR_PERM_DENIED_2, context.getSitePath(resource), requiredPermissions.getPermissionString()));
dbc.getRequestContext().removeSiteRoot(resource.getRootPath()), dbc.currentUser().getName(), requiredPermissions.getPermissionString(), permissions.getPermissionString()}));
dbc.getRequestContext().removeSiteRoot(resource.getRootPath()), dbc.currentUser().getName(), requiredPermissions.getPermissionString(), permissions.getPermissionString()}));