Search in sources :

Example 26 with OrgUnit

use of org.apache.directory.fortress.core.model.OrgUnit in project directory-fortress-core by apache.

the class DelegatedMgrImplTest method deleteOrgUnit.

/**
 * @param msg
 * @param org
 */
private void deleteOrgUnit(String msg, String[] org) {
    LogUtil.logIt(msg);
    try {
        DelAdminMgr dAdminMgr = getManagedDelegatedMgr();
        OrgUnit ou = OrgUnitTestData.getOrgUnit(org);
        dAdminMgr.delete(ou);
        LOG.debug("deleteOrgUnit ou [" + ou.getName() + "] successful");
    } catch (SecurityException ex) {
        LOG.error("deleteOrgUnit caught SecurityException=" + ex.getMessage(), ex);
        fail(ex.getMessage());
    }
}
Also used : OrgUnit(org.apache.directory.fortress.core.model.OrgUnit) DelAdminMgr(org.apache.directory.fortress.core.DelAdminMgr) SecurityException(org.apache.directory.fortress.core.SecurityException)

Example 27 with OrgUnit

use of org.apache.directory.fortress.core.model.OrgUnit in project directory-fortress-core by apache.

the class DelegatedMgrImplTest method deleteOrgUnits.

/**
 * @param msg
 * @param oArray
 */
private void deleteOrgUnits(String msg, String[][] oArray) {
    LogUtil.logIt(msg);
    try {
        DelAdminMgr dAdminMgr = getManagedDelegatedMgr();
        for (String[] ole : oArray) {
            OrgUnit ou = OrgUnitTestData.getOrgUnit(ole);
            dAdminMgr.delete(ou);
            LOG.debug("deleteOrgUnits ou [" + ou.getName() + "] successful");
        }
    } catch (SecurityException ex) {
        LOG.error("deleteOrgUnits caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
        fail(ex.getMessage());
    }
}
Also used : OrgUnit(org.apache.directory.fortress.core.model.OrgUnit) DelAdminMgr(org.apache.directory.fortress.core.DelAdminMgr) SecurityException(org.apache.directory.fortress.core.SecurityException)

Example 28 with OrgUnit

use of org.apache.directory.fortress.core.model.OrgUnit in project directory-fortress-core by apache.

the class DelegatedMgrImplTest method addOrgUnits.

/**
 * @param msg
 * @param oArray
 */
public static void addOrgUnits(String msg, String[][] oArray) {
    LogUtil.logIt(msg);
    try {
        DelAdminMgr dAdminMgr = getManagedDelegatedMgr();
        for (String[] ole : oArray) {
            OrgUnit ou = OrgUnitTestData.getOrgUnit(ole);
            OrgUnit entity = dAdminMgr.add(ou);
            LOG.debug("addOrgUnits ou [" + entity.getName() + "] successful");
        }
    } catch (SecurityException ex) {
        LOG.error("addOrgUnits caught SecurityException=" + ex.getMessage(), ex);
        fail(ex.getMessage());
    }
}
Also used : OrgUnit(org.apache.directory.fortress.core.model.OrgUnit) DelAdminMgr(org.apache.directory.fortress.core.DelAdminMgr) SecurityException(org.apache.directory.fortress.core.SecurityException)

Example 29 with OrgUnit

use of org.apache.directory.fortress.core.model.OrgUnit in project directory-fortress-core by apache.

the class DelegatedMgrImplTest method delOrgUnitAscendant.

/**
 * @param msg
 * @param oArray
 */
private void delOrgUnitAscendant(String msg, String[][] oArray, OrgUnit.Type type) {
    LogUtil.logIt(msg);
    try {
        DelAdminMgr dAdminMgr = getManagedDelegatedMgr();
        for (String[] ole : oArray) {
            OrgUnit orgUnit = OrgUnitTestData.getOrgUnit(ole);
            Set<String> ascs = new HashSet<String>();
            OrgUnitTestData.getRelationship(ascs, ole);
            for (String asc : ascs) {
                dAdminMgr.deleteInheritance(new OrgUnit(asc, type), orgUnit);
                LOG.debug("delOrgUnitAscendant desc orgUnit [" + orgUnit.getName() + "] asc orgUnit [" + asc + "] successful");
            }
            Set<String> inheritances = OrgUnitTestData.getInheritances(ole);
            if (inheritances != null) {
                for (String asc : inheritances) {
                    dAdminMgr.deleteInheritance(new OrgUnit(asc, type), orgUnit);
                    LOG.debug("delOrgUnitAscendant desc orgUnit [" + orgUnit.getName() + "] asc orgUnit [" + asc + "] successful");
                }
            }
            dAdminMgr.delete(orgUnit);
            LOG.debug("delOrgUnitAscendant remove desc orgUnit [" + orgUnit.getName() + "] successful");
        }
        // cleanup the top ascendant from orgUnit data set.
        DelReviewMgr dReviewMgr = getManagedDelegatedReviewMgr();
        String orgUnitSrchVal = OrgUnitTestData.getName(oArray[0]);
        // stip off prefix and search:
        orgUnitSrchVal = orgUnitSrchVal.substring(0, 3);
        List<OrgUnit> cleanup = dReviewMgr.search(type, orgUnitSrchVal);
        for (OrgUnit oe : cleanup) {
            dAdminMgr.delete(oe);
            LOG.debug("delOrgUnitAscendant cleanup orgUnit [" + oe.getName() + "] successful");
        }
    } catch (SecurityException ex) {
        LOG.error("delOrgUnitAscendant caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
        fail(ex.getMessage());
    }
}
Also used : OrgUnit(org.apache.directory.fortress.core.model.OrgUnit) DelAdminMgr(org.apache.directory.fortress.core.DelAdminMgr) SecurityException(org.apache.directory.fortress.core.SecurityException) DelReviewMgr(org.apache.directory.fortress.core.DelReviewMgr) HashSet(java.util.HashSet)

Example 30 with OrgUnit

use of org.apache.directory.fortress.core.model.OrgUnit in project directory-fortress-core by apache.

the class DelegatedMgrImplTest method addInheritedOrgUnits.

/**
 * @param msg
 * @param oArray
 */
public static void addInheritedOrgUnits(String msg, String[][] oArray) {
    LogUtil.logIt(msg);
    try {
        DelAdminMgr dAdminMgr = getManagedDelegatedMgr();
        for (String[] ole : oArray) {
            OrgUnit child = OrgUnitTestData.getOrgUnit(ole);
            Set<String> parents = new HashSet<String>();
            OrgUnitTestData.getRelationship(parents, ole);
            for (String pOrg : parents) {
                OrgUnit parent = new OrgUnit(pOrg);
                parent.setType(child.getType());
                dAdminMgr.addInheritance(parent, child);
                LOG.debug("addInheritedOrgUnits child org [" + child.getName() + "] parent org [" + pOrg + "] successful");
            }
        }
    } catch (SecurityException ex) {
        LOG.error("addInheritedOrgUnits caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
        fail(ex.getMessage());
    }
}
Also used : OrgUnit(org.apache.directory.fortress.core.model.OrgUnit) DelAdminMgr(org.apache.directory.fortress.core.DelAdminMgr) SecurityException(org.apache.directory.fortress.core.SecurityException) HashSet(java.util.HashSet)

Aggregations

OrgUnit (org.apache.directory.fortress.core.model.OrgUnit)60 SecurityException (org.apache.directory.fortress.core.SecurityException)36 DelAdminMgr (org.apache.directory.fortress.core.DelAdminMgr)26 DelReviewMgr (org.apache.directory.fortress.core.DelReviewMgr)7 Relationship (org.apache.directory.fortress.core.model.Relationship)6 FinderException (org.apache.directory.fortress.core.FinderException)5 FortRequest (org.apache.directory.fortress.core.model.FortRequest)5 FortResponse (org.apache.directory.fortress.core.model.FortResponse)5 HashSet (java.util.HashSet)4 AdminPermissionOperation (org.apache.directory.fortress.annotation.AdminPermissionOperation)4 ArrayList (java.util.ArrayList)3 UserAdminRole (org.apache.directory.fortress.core.model.UserAdminRole)3 UserRole (org.apache.directory.fortress.core.model.UserRole)3 TreeSet (java.util.TreeSet)2 LdapException (org.apache.directory.api.ldap.model.exception.LdapException)2 ValidationException (org.apache.directory.fortress.core.ValidationException)2 AdminRole (org.apache.directory.fortress.core.model.AdminRole)2 Graphable (org.apache.directory.fortress.core.model.Graphable)2 Hier (org.apache.directory.fortress.core.model.Hier)2 ObjectFactory (org.apache.directory.fortress.core.model.ObjectFactory)2