/** * Returns all groups of organizational units for which the current user * has the {@link CmsRole#ACCOUNT_MANAGER} role.<p> * * @param cms the current cms context * @param ouFqn the fully qualified name of the organizational unit * @param includeSubOus if sub organizational units should be included in the search * * @return a list of {@link org.opencms.file.CmsGroup} objects * * @throws CmsException if something goes wrong */ public List getManageableGroups(CmsObject cms, String ouFqn, boolean includeSubOus) throws CmsException { List groups = new ArrayList(); Iterator it = getOrgUnitsForRole(cms, CmsRole.ACCOUNT_MANAGER.forOrgUnit(ouFqn), includeSubOus).iterator(); while (it.hasNext()) { CmsOrganizationalUnit orgUnit = (CmsOrganizationalUnit)it.next(); groups.addAll(OpenCms.getOrgUnitManager().getGroups(cms, orgUnit.getName(), false)); } return groups; }
/** * Returns a list of those organizational units whose members can be managed by the current user.<p> * * @param cms the current CMS context * @param ouFqn the fully qualified name of the organizational unit * @param includeSubOus if sub organizational units should be included in the search * @param includeWebusers if webuser organizational units should be included in the search * * @return a list of organizational units * * @throws CmsException if something goes wrong */ public List<CmsOrganizationalUnit> getManageableOrgUnits( CmsObject cms, String ouFqn, boolean includeSubOus, boolean includeWebusers) throws CmsException { List<CmsOrganizationalUnit> result = Lists.newArrayList(); List<CmsOrganizationalUnit> ous = getOrgUnitsForRole( cms, CmsRole.ACCOUNT_MANAGER.forOrgUnit(ouFqn), includeSubOus); for (CmsOrganizationalUnit ou : ous) { if (includeWebusers || !ou.hasFlagWebuser()) { result.add(ou); } } return result; }
/** * Returns all groups of organizational units for which the current user * has the {@link CmsRole#ACCOUNT_MANAGER} role.<p> * * @param cms the current cms context * @param ouFqn the fully qualified name of the organizational unit * @param includeSubOus if sub organizational units should be included in the search * * @return a list of {@link org.opencms.file.CmsGroup} objects * * @throws CmsException if something goes wrong */ public List<CmsGroup> getManageableGroups(CmsObject cms, String ouFqn, boolean includeSubOus) throws CmsException { List<CmsGroup> groups = new ArrayList<CmsGroup>(); Iterator<CmsOrganizationalUnit> it = getOrgUnitsForRole( cms, CmsRole.ACCOUNT_MANAGER.forOrgUnit(ouFqn), includeSubOus).iterator(); while (it.hasNext()) { CmsOrganizationalUnit orgUnit = it.next(); groups.addAll(OpenCms.getOrgUnitManager().getGroups(cms, orgUnit.getName(), false)); } return groups; }
/** * Returns the organizational units to display.<p> * * @return the organizational units * * @throws CmsException if something goes wrong */ protected List<CmsOrganizationalUnit> getOrgUnits() throws CmsException { if (m_ous == null) { m_ous = OpenCms.getRoleManager().getOrgUnitsForRole(getCms(), CmsRole.ACCOUNT_MANAGER.forOrgUnit(""), true); } return m_ous; }
/** * Returns all users of organizational units for which the current user has * the {@link CmsRole#ACCOUNT_MANAGER} role.<p> * * @param cms the current cms context * @param ouFqn the fully qualified name of the organizational unit * @param includeSubOus if sub organizational units should be included in the search * @param includeWebusers if webuser organizational units should be included in the search * * @return a list of {@link org.opencms.file.CmsUser} objects * * @throws CmsException if something goes wrong */ public List getManageableUsers(CmsObject cms, String ouFqn, boolean includeSubOus, boolean includeWebusers) throws CmsException { List users = new ArrayList(); Iterator it = getOrgUnitsForRole(cms, CmsRole.ACCOUNT_MANAGER.forOrgUnit(ouFqn), includeSubOus).iterator(); while (it.hasNext()) { CmsOrganizationalUnit orgUnit = (CmsOrganizationalUnit)it.next(); if (!includeWebusers && orgUnit.hasFlagWebuser()) { // webuser are never manageable continue; } users.addAll(OpenCms.getOrgUnitManager().getUsers(cms, orgUnit.getName(), false)); } return users; }
try { if (m_role != null) { ret.addAll(OpenCms.getRoleManager().getOrgUnitsForRole(cms, m_role.forOrgUnit(""), true)); } else { ret.addAll(OpenCms.getOrgUnitManager().getOrganizationalUnits(cms, "", true));
/** * Returns the list of organizational units for selection.<p> * * @return a list of organizational units * * @throws CmsException if something goes wrong */ protected List<CmsOrganizationalUnit> getOrgUnits() throws CmsException { List<CmsOrganizationalUnit> ret = new ArrayList<CmsOrganizationalUnit>(); CmsRole role = null; if (getParamRole() != null) { role = CmsRole.valueOfGroupName(getParamRole()); } String ou = getParamOufqn(); if (ou == null) { ou = ""; } if (role != null) { ret.addAll(OpenCms.getRoleManager().getOrgUnitsForRole(getCms(), role.forOrgUnit(ou), true)); } else { ret.addAll(OpenCms.getOrgUnitManager().getOrganizationalUnits(getCms(), ou, true)); } return ret; }
/** * Returns the list of organizational units for selection.<p> * * @return a list of organizational units * * @throws CmsException if something goes wrong */ protected List getOrgUnits() throws CmsException { List ret = new ArrayList(); CmsRole role = null; if (getParamRole() != null) { role = CmsRole.valueOfGroupName(getParamRole()); } String ou = getParamOufqn(); if (ou == null) { ou = ""; } if (role != null) { ret.addAll(OpenCms.getRoleManager().getOrgUnitsForRole(getCms(), role.forOrgUnit(ou), true)); } else { ret.addAll(OpenCms.getOrgUnitManager().getOrganizationalUnits(getCms(), ou, true)); } return ret; }
/** * Returns the description of the parent ou.<p> * * @return the description of the parent ou */ public String getAssignedOu() { try { CmsOrganizationalUnit ou; if (!isNewProject()) { ou = OpenCms.getOrgUnitManager().readOrganizationalUnit(getCms(), m_project.getOuFqn()); } else { ou = OpenCms.getRoleManager().getOrgUnitsForRole(getCms(), CmsRole.PROJECT_MANAGER, true).get(0); } return ou.getDisplayName(getLocale()); } catch (CmsException e) { return null; } }
CmsOrganizationalUnit ou = OpenCms.getRoleManager().getOrgUnitsForRole( A_CmsUI.getCmsObject(), CmsRole.PROJECT_MANAGER,
List<CmsOrganizationalUnit> orgUnits = OpenCms.getRoleManager().getOrgUnitsForRole( cms, CmsRole.ACCOUNT_MANAGER.forOrgUnit(""),
int ous = 1; try { ous = OpenCms.getRoleManager().getOrgUnitsForRole(getCms(), CmsRole.PROJECT_MANAGER, true).size(); } catch (CmsException e) {