/** * @see org.opencms.widgets.A_CmsWidget#getConfiguration() */ @Override public String getConfiguration() { StringBuffer result = new StringBuffer(8); // append flags to configuration if (m_role != null) { if (result.length() > 0) { result.append("|"); } result.append(CONFIGURATION_ROLE); result.append("="); result.append(m_role.getGroupName()); } return result.toString(); }
/** * @see org.opencms.widgets.A_CmsWidget#getConfiguration() */ @Override public String getConfiguration() { StringBuffer result = new StringBuffer(8); // append flags to configuration if (m_role != null) { if (result.length() > 0) { result.append("|"); } result.append(CONFIGURATION_ROLE); result.append("="); result.append(m_role.getGroupName()); } return result.toString(); }
/** * @see java.lang.Object#toString() */ @Override public String toString() { StringBuffer result = new StringBuffer(); result.append("["); result.append(this.getClass().getName()); result.append(", role: "); result.append(getRoleName()); result.append(", org unit: "); result.append(getOuFqn()); result.append(", group: "); result.append(getGroupName()); result.append("]"); return result.toString(); }
/** * @see java.lang.Object#toString() */ @Override public String toString() { StringBuffer result = new StringBuffer(); result.append("["); result.append(this.getClass().getName()); result.append(", role: "); result.append(getRoleName()); result.append(", org unit: "); result.append(getOuFqn()); result.append(", group: "); result.append(getGroupName()); result.append("]"); return result.toString(); }
/** * Removes a user from a role, in the given organizational unit.<p> * * @param cms the opencms context * @param role the role to remove the user from * @param username the name of the user that is to be removed from the group * * @throws CmsException if operation was not successful */ public void removeUserFromRole(CmsObject cms, CmsRole role, String username) throws CmsException { m_securityManager.removeUserFromGroup(cms.getRequestContext(), username, role.getGroupName(), true); }
/** * Removes a user from a role, in the given organizational unit.<p> * * @param cms the opencms context * @param role the role to remove the user from * @param username the name of the user that is to be removed from the group * * @throws CmsException if operation was not successful */ public void removeUserFromRole(CmsObject cms, CmsRole role, String username) throws CmsException { m_securityManager.removeUserFromGroup(cms.getRequestContext(), username, role.getGroupName(), true); }
/** * Adds a user to the given role.<p> * * @param cms the opencms context * @param role the role * @param username the name of the user that is to be added to the role * * @throws CmsException if something goes wrong */ public void addUserToRole(CmsObject cms, CmsRole role, String username) throws CmsException { m_securityManager.addUserToGroup(cms.getRequestContext(), username, role.getGroupName(), true); }
/** * Adds a user to the given role.<p> * * @param cms the opencms context * @param role the role * @param username the name of the user that is to be added to the role * * @throws CmsException if something goes wrong */ public void addUserToRole(CmsObject cms, CmsRole role, String username) throws CmsException { m_securityManager.addUserToGroup(cms.getRequestContext(), username, role.getGroupName(), true); }
/** * Returns a set of all roles group names.<p> * * @return a set of all roles group names */ private Set getAllGroupNames() { Set distinctGroups = new HashSet(); // add role group name distinctGroups.add(getGroupName()); if (getParentRole() != null) { // add parent roles group names distinctGroups.addAll(getParentRole().getAllGroupNames()); } return distinctGroups; }
/** * Returns the role for the given group name.<p> * * @param groupName a group name to check for role representation * * @return the role for the given group name */ public static CmsRole valueOfGroupName(String groupName) { String groupOu = CmsOrganizationalUnit.getParentFqn(groupName); Iterator<CmsRole> it = SYSTEM_ROLES.iterator(); while (it.hasNext()) { CmsRole role = it.next(); // direct check if (groupName.equals(role.getGroupName())) { return role.forOrgUnit(groupOu); } if (!role.isOrganizationalUnitIndependent()) { // the role group name does not start with "/", but the given group fqn does if (groupName.endsWith(CmsOrganizationalUnit.SEPARATOR + role.getGroupName())) { return role.forOrgUnit(groupOu); } } } return null; }
/** * Returns the role for the given group name.<p> * * @param groupName a group name to check for role representation * * @return the role for the given group name */ public static CmsRole valueOfGroupName(String groupName) { String groupOu = CmsOrganizationalUnit.getParentFqn(groupName); Iterator it = SYSTEM_ROLES.iterator(); while (it.hasNext()) { CmsRole role = (CmsRole)it.next(); // direct check if (groupName.equals(role.getGroupName())) { return role.forOrgUnit(groupOu); } if (!role.isOrganizationalUnitIndependent()) { // the role group name does not start with "/", but the given group fqn does if (groupName.endsWith(CmsOrganizationalUnit.SEPARATOR + role.getGroupName())) { return role.forOrgUnit(groupOu); } } } return null; }
/** * Enumeration class for the mode parameter in the * {@link CmsDriverManager#readChangedResourcesInsideProject(CmsDbContext, CmsUUID, CmsReadChangedProjectResourceMode)} * method.<p> */ private static class CmsReadChangedProjectResourceMode { /** * Default constructor.<p> */ protected CmsReadChangedProjectResourceMode() { // noop } }
/** * Returns all direct users of a given role, in the given organizational unit.<p> * * Users that are "indirectly" in the role are not returned in the result.<p> * * @param cms the opencms context * @param role the role to get all users for * @param includeOtherOuUsers include users of other organizational units * @param directUsersOnly if set only the direct assigned users will be returned, * if not also indirect users, ie. members of child groups * * @return all <code>{@link org.opencms.file.CmsUser}</code> objects in the group * * @throws CmsException if operation was not successful */ public List getUsersOfRole(CmsObject cms, CmsRole role, boolean includeOtherOuUsers, boolean directUsersOnly) throws CmsException { return m_securityManager.getUsersOfGroup( cms.getRequestContext(), role.getGroupName(), includeOtherOuUsers, directUsersOnly, true); }
/** * Returns all direct users of a given role, in the given organizational unit.<p> * * Users that are "indirectly" in the role are not returned in the result.<p> * * @param cms the opencms context * @param role the role to get all users for * @param includeOtherOuUsers include users of other organizational units * @param directUsersOnly if set only the direct assigned users will be returned, * if not also indirect users, ie. members of child groups * * @return all <code>{@link org.opencms.file.CmsUser}</code> objects in the group * * @throws CmsException if operation was not successful */ public List<CmsUser> getUsersOfRole( CmsObject cms, CmsRole role, boolean includeOtherOuUsers, boolean directUsersOnly) throws CmsException { return m_securityManager.getUsersOfGroup( cms.getRequestContext(), role.getGroupName(), includeOtherOuUsers, directUsersOnly, true); }
while (itRoles.hasNext()) { CmsRole role = (CmsRole)itRoles.next(); key.append(role.getGroupName()).append("_");
/** * @see org.opencms.workplace.tools.I_CmsHtmlIconButton#getIconPath() */ @Override public String getIconPath() { try { CmsUser user = getCms().readUser((String)getItem().get(LIST_COLUMN_LOGIN)); if (user.getOuFqn().equals(((A_CmsRoleUsersList)getWp()).getParamOufqn())) { List<CmsRole> userRoles = OpenCms.getRoleManager().getRolesOfUser( ((A_CmsRoleUsersList)getWp()).getCms(), user.getName(), ((A_CmsRoleUsersList)getWp()).getParamOufqn(), false, true, true); Iterator<CmsRole> itUserRoles = userRoles.iterator(); while (itUserRoles.hasNext()) { CmsRole role = itUserRoles.next(); if (role.getGroupName().equals(((A_CmsRoleUsersList)getWp()).getParamRole())) { return A_CmsUsersList.PATH_BUTTONS + "user.png"; } } return A_CmsUsersList.PATH_BUTTONS + "user_indirect.png"; } else { return A_CmsUsersList.PATH_BUTTONS + "user_other_ou.png"; } } catch (CmsException e) { return A_CmsUsersList.PATH_BUTTONS + "user.png"; } }
/** * @see org.opencms.workplace.CmsWidgetDialog#validateParamaters() */ @Override protected void validateParamaters() throws Exception { // test the needed parameters OpenCms.getRoleManager().checkRole(getCms(), CmsRole.ACCOUNT_MANAGER.forOrgUnit(getParamOufqn())); CmsRole.valueOf(getCms().readGroup(getParamRole())).getGroupName(); } }
/** * Enumeration class for the mode parameter in the * {@link CmsDriverManager#readChangedResourcesInsideProject(CmsDbContext, CmsUUID, CmsReadChangedProjectResourceMode)} * method.<p> */ private static class CmsReadChangedProjectResourceMode { /** * Default constructor.<p> */ protected CmsReadChangedProjectResourceMode() { // noop } }
/** * Gets the groups which constitute a given role.<p> * * @param context the request context * @param role the role * @param directUsersOnly if true, only direct users of the role group will be returned * * @return the role's groups * * @throws CmsException if something goes wrong */ public Set<CmsGroup> getRoleGroups(CmsRequestContext context, CmsRole role, boolean directUsersOnly) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { return m_driverManager.getRoleGroups(dbc, role.getGroupName(), directUsersOnly); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_GET_ROLE_GROUPS_1, role.toString()), e); return null; // will never be executed } finally { dbc.clear(); } }
while (itUserRoles.hasNext()) { CmsRole role = itUserRoles.next(); if (role.getGroupName().equals(((A_CmsRoleUsersList)getWp()).getParamRole())) { return Messages.get().container(Messages.GUI_USERS_LIST_INROLE_NAME_0);