Search in sources :

Example 21 with PermObj

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

the class Options method getPermObj.

/**
 */
public PermObj getPermObj() {
    PermObj permObj = new PermObj();
    permObj.setObjName(getName());
    permObj.setDescription(getDescription());
    permObj.setOu(getOu());
    permObj.setType(getType());
    updateProperties(permObj);
    return permObj;
}
Also used : PermObj(org.apache.directory.fortress.core.model.PermObj)

Example 22 with PermObj

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

the class AdminMgrImplTest method delPermObjs.

/**
 * @param objArray
 */
public static void delPermObjs(String msg, String[][] objArray, boolean isAdmin) {
    LogUtil.logIt(msg);
    PermObj pObj = new PermObj();
    try {
        AdminMgr adminMgr;
        if (isAdmin) {
            adminMgr = getManagedAdminMgr();
        } else {
            adminMgr = AdminMgrFactory.createInstance(TestUtils.getContext());
        }
        for (String[] obj : objArray) {
            pObj = PermTestData.getObj(obj);
            adminMgr.deletePermObj(pObj);
            LOG.debug("delPermObjs objName [" + pObj.getObjName() + "] successful");
        }
    } catch (SecurityException ex) {
        LOG.error("delPermObjs objName [" + pObj.getObjName() + "] caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
        fail(ex.getMessage());
    }
}
Also used : PermObj(org.apache.directory.fortress.core.model.PermObj) SecurityException(org.apache.directory.fortress.core.SecurityException) AdminMgr(org.apache.directory.fortress.core.AdminMgr)

Example 23 with PermObj

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

the class FortressAntLoadTest method readPermissionObjs.

private static void readPermissionObjs(String msg, List<PermObj> permObjs) {
    LogUtil.logIt(msg);
    try {
        ReviewMgr reviewMgr = ReviewMgrImplTest.getManagedReviewMgr();
        for (PermObj permObj : permObjs) {
            PermObj entity = reviewMgr.readPermObj(permObj);
            assertNotNull(entity);
            assertTrue("Failed objName value compare", entity.getObjName().equals(permObj.getObjName()));
        }
    } catch (SecurityException ex) {
        LOG.error("readPermissionOps caught SecurityException rc=" + ex.getErrorId() + ", " + "msg=" + ex.getMessage() + ex);
        fail(ex.getMessage());
    }
}
Also used : PermObj(org.apache.directory.fortress.core.model.PermObj) ReviewMgr(org.apache.directory.fortress.core.ReviewMgr) SecurityException(org.apache.directory.fortress.core.SecurityException)

Example 24 with PermObj

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

the class ReviewMgrImplTest method searchPermissionObjs.

/**
 * @param msg
 * @param srchValue
 * @param pArray
 */
public static void searchPermissionObjs(String msg, String srchValue, String[][] pArray) {
    LogUtil.logIt(msg);
    try {
        ReviewMgr reviewMgr = getManagedReviewMgr();
        List<PermObj> objs = reviewMgr.findPermObjs(new PermObj(srchValue));
        assertNotNull(objs);
        assertTrue(CLS_NM + "searchPermissionObjs srchValue [" + srchValue + "] list size check", pArray.length == objs.size());
        for (String[] obj : pArray) {
            int indx = objs.indexOf(new PermObj(PermTestData.getName(obj)));
            if (indx != -1) {
                PermObj entity = objs.get(indx);
                assertNotNull(entity);
                PermTestData.assertEquals(entity, obj);
                LOG.debug("searchPermissionObjs [" + entity.getObjName() + "] successful");
            } else {
                msg = "searchPermissionObjs srchValue [" + srchValue + "] failed list search";
                LogUtil.logIt(msg);
                fail(msg);
            }
        }
    } catch (SecurityException ex) {
        LOG.error("searchPermissionObjs srchValue [" + srchValue + "] caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
        fail(ex.getMessage());
    }
}
Also used : PermObj(org.apache.directory.fortress.core.model.PermObj) ReviewMgr(org.apache.directory.fortress.core.ReviewMgr) SecurityException(org.apache.directory.fortress.core.SecurityException) RoleConstraint(org.apache.directory.fortress.core.model.RoleConstraint)

Example 25 with PermObj

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

the class PermTestData method getObj.

/**
 * @param obj
 * @return
 */
public static PermObj getObj(String[] obj) {
    PermObj pObj = new PermObj();
    pObj.setObjName(getName(obj));
    pObj.setDescription(getDescription(obj));
    pObj.setType(getType(obj));
    pObj.setOu(getOu(obj));
    pObj.setAdmin(isAdmin(obj));
    return pObj;
}
Also used : PermObj(org.apache.directory.fortress.core.model.PermObj)

Aggregations

PermObj (org.apache.directory.fortress.core.model.PermObj)33 SecurityException (org.apache.directory.fortress.core.SecurityException)22 AdminMgr (org.apache.directory.fortress.core.AdminMgr)7 FortRequest (org.apache.directory.fortress.core.model.FortRequest)7 FortResponse (org.apache.directory.fortress.core.model.FortResponse)7 Permission (org.apache.directory.fortress.core.model.Permission)6 Role (org.apache.directory.fortress.core.model.Role)6 ReviewMgr (org.apache.directory.fortress.core.ReviewMgr)5 AdminRole (org.apache.directory.fortress.core.model.AdminRole)5 UserAdminRole (org.apache.directory.fortress.core.model.UserAdminRole)5 User (org.apache.directory.fortress.core.model.User)4 ArrayList (java.util.ArrayList)3 LdapException (org.apache.directory.api.ldap.model.exception.LdapException)3 FinderException (org.apache.directory.fortress.core.FinderException)3 Relationship (org.apache.directory.fortress.core.model.Relationship)3 UserRole (org.apache.directory.fortress.core.model.UserRole)3 LdapConnection (org.apache.directory.ldap.client.api.LdapConnection)3 CursorException (org.apache.directory.api.ldap.model.cursor.CursorException)2 SearchCursor (org.apache.directory.api.ldap.model.cursor.SearchCursor)2 Constraint (org.apache.directory.fortress.core.model.Constraint)2