/** * Returns the localized name of the role object.<p> * * @return the localized name of the role object */ public String getName() { return m_role.getName(getCms().getRequestContext().getLocale()); }
/** * Returns a localized role description.<p> * * @param locale the locale * * @return the localized role description */ public String getDescription(Locale locale) { if (m_systemRole) { // localize role names for system roles return Messages.get().getBundle(locale).key("GUI_ROLE_DESCRIPTION_" + m_roleName + "_0"); } else { return getName(locale); } }
/** * Returns a localized role description.<p> * * @param locale the locale * * @return the localized role description */ public String getDescription(Locale locale) { if (m_systemRole) { // localize role names for system roles return Messages.get().getBundle(locale).key("GUI_ROLE_DESCRIPTION_" + m_roleName + "_0"); } else { return getName(locale); } }
/** * Returns a role violation exception configured with a localized, role specific message * for this role.<p> * * @param requestContext the current users OpenCms request context * * @return a role violation exception configured with a localized, role specific message * for this role */ public CmsRoleViolationException createRoleViolationException(CmsRequestContext requestContext) { return new CmsRoleViolationException(Messages.get().container( Messages.ERR_USER_NOT_IN_ROLE_2, requestContext.currentUser().getName(), getName(requestContext.getLocale()))); }
continue; retVal.add(new CmsSelectWidgetOption(role.getGroupName(), false, role.getName(getLocale())));
/** * Returns a role violation exception configured with a localized, role specific message * for this role.<p> * * @param requestContext the current users OpenCms request context * * @return a role violation exception configured with a localized, role specific message * for this role */ public CmsRoleViolationException createRoleViolationException(CmsRequestContext requestContext) { return new CmsRoleViolationException( Messages.get().container( Messages.ERR_USER_NOT_IN_ROLE_2, requestContext.getCurrentUser().getName(), getName(requestContext.getLocale()))); }
/** * Returns a role violation exception configured with a localized, role specific message * for this role.<p> * * @param requestContext the current users OpenCms request context * @param orgUnitFqn the organizational unit used for the role check, it may be <code>null</code> * * @return a role violation exception configured with a localized, role specific message * for this role */ public CmsRoleViolationException createRoleViolationExceptionForOrgUnit( CmsRequestContext requestContext, String orgUnitFqn) { return new CmsRoleViolationException( Messages.get().container( Messages.ERR_USER_NOT_IN_ROLE_FOR_ORGUNIT_3, requestContext.getCurrentUser().getName(), getName(requestContext.getLocale()), orgUnitFqn)); }
/** * Returns the display name of this role including the organizational unit.<p> * * @param cms the cms context * @param locale the locale * * @return the display name of this role including the organizational unit * * @throws CmsException if the organizational unit could not be read */ public String getDisplayName(CmsObject cms, Locale locale) throws CmsException { return Messages.get().getBundle(locale).key( Messages.GUI_PRINCIPAL_DISPLAY_NAME_2, getName(locale), OpenCms.getOrgUnitManager().readOrganizationalUnit(cms, getOuFqn()).getDisplayName(locale)); }
/** * Returns a role violation exception configured with a localized, role specific message * for this role.<p> * * @param requestContext the current users OpenCms request context * @param orgUnitFqn the organizational unit used for the role check, it may be <code>null</code> * * @return a role violation exception configured with a localized, role specific message * for this role */ public CmsRoleViolationException createRoleViolationExceptionForOrgUnit( CmsRequestContext requestContext, String orgUnitFqn) { return new CmsRoleViolationException(Messages.get().container( Messages.ERR_USER_NOT_IN_ROLE_FOR_ORGUNIT_3, requestContext.currentUser().getName(), getName(requestContext.getLocale()), orgUnitFqn)); }
/** * Returns a String inculding all parent roles of the role object.<p> * * @return a String inculding all parent roles of the role object */ public String getDependency() { String dependency = ""; CmsRole role = m_role; while (role.getParentRole() != null) { dependency = dependency + role.getParentRole().getName(getCms().getRequestContext().getLocale()); role = role.getParentRole(); if (role.getParentRole() != null) { dependency = dependency + ", "; } } return dependency; }
while (it.hasNext()) { role = (CmsRole)it.next(); if (role.getName(getLocale()).equalsIgnoreCase(name)) { name = role.getRoleName(); break;
/** * Returns the display name of this role including the organizational unit.<p> * * @param cms the cms context * @param locale the locale * * @return the display name of this role including the organizational unit * * @throws CmsException if the organizational unit could not be read */ public String getDisplayName(CmsObject cms, Locale locale) throws CmsException { return Messages.get().getBundle(locale).key( Messages.GUI_PRINCIPAL_DISPLAY_NAME_2, getName(locale), OpenCms.getOrgUnitManager().readOrganizationalUnit(cms, getOuFqn()).getDisplayName(locale)); }
while (it.hasNext()) { role = it.next(); if (role.getName(getLocale()).equalsIgnoreCase(principalName)) { principalName = role.getRoleName(); break;
/** * Returns all the organizational units for which the current user has the given role.<p> * * @param requestContext the current request context * @param role the role to check * @param includeSubOus if sub organizational units should be included in the search * * @return a list of {@link org.opencms.security.CmsOrganizationalUnit} objects * * @throws CmsException if something goes wrong */ public List getOrgUnitsForRole(CmsRequestContext requestContext, CmsRole role, boolean includeSubOus) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(requestContext); List result = null; try { result = m_driverManager.getOrgUnitsForRole(dbc, role, includeSubOus); } catch (Exception e) { dbc.report(null, Messages.get().container( Messages.ERR_GET_ORGUNITS_ROLE_1, role.getName(requestContext.getLocale())), e); } finally { dbc.clear(); } return result; }
/** * Returns a role violation exception configured with a localized, role specific message * for this role.<p> * * @param requestContext the current users OpenCms request context * @param resource the resource used for the role check, it may be <code>null</code> * * @return a role violation exception configured with a localized, role specific message * for this role */ public CmsRoleViolationException createRoleViolationExceptionForResource( CmsRequestContext requestContext, CmsResource resource) { return new CmsRoleViolationException(Messages.get().container( Messages.ERR_USER_NOT_IN_ROLE_FOR_RESOURCE_3, requestContext.currentUser().getName(), getName(requestContext.getLocale()), requestContext.removeSiteRoot(resource.getRootPath()))); }
/** * Returns a role violation exception configured with a localized, role specific message * for this role.<p> * * @param requestContext the current users OpenCms request context * @param resource the resource used for the role check, it may be <code>null</code> * * @return a role violation exception configured with a localized, role specific message * for this role */ public CmsRoleViolationException createRoleViolationExceptionForResource( CmsRequestContext requestContext, CmsResource resource) { return new CmsRoleViolationException( Messages.get().container( Messages.ERR_USER_NOT_IN_ROLE_FOR_RESOURCE_3, requestContext.getCurrentUser().getName(), getName(requestContext.getLocale()), requestContext.removeSiteRoot(resource.getRootPath()))); }
/** * Returns all the organizational units for which the current user has the given role.<p> * * @param requestContext the current request context * @param role the role to check * @param includeSubOus if sub organizational units should be included in the search * * @return a list of {@link org.opencms.security.CmsOrganizationalUnit} objects * * @throws CmsException if something goes wrong */ public List<CmsOrganizationalUnit> getOrgUnitsForRole( CmsRequestContext requestContext, CmsRole role, boolean includeSubOus) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(requestContext); List<CmsOrganizationalUnit> result = null; try { result = m_driverManager.getOrgUnitsForRole(dbc, role, includeSubOus); } catch (Exception e) { dbc.report( null, Messages.get().container(Messages.ERR_GET_ORGUNITS_ROLE_1, role.getName(requestContext.getLocale())), e); } finally { dbc.clear(); } return result; }
return CmsRole.valueOf(m_wp.getCms().readGroup(id)).getName( m_wp.getCms().getRequestContext().getLocale());
return CmsRole.valueOf(m_wp.getCms().readGroup(id)).getName( m_wp.getCms().getRequestContext().getLocale());