Search in sources :

Example 26 with AdminRole

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

the class DelegatedReviewMgrConsole method findRoles.

void findRoles() {
    ReaderUtil.clearScreen();
    try {
        System.out.println("Enter value to search AdminRoles with:");
        String val = ReaderUtil.readLn();
        List<AdminRole> list = rm.findRoles(val);
        if (list != null && list.size() > 0) {
            for (int i = 0; i < list.size(); i++) {
                AdminRole re = list.get(i);
                System.out.println("ADMIN ROLE OBJECT [" + i + "]:");
                System.out.println("    name      [" + re.getName() + "]");
                System.out.println("    internalId  [" + re.getId() + "]");
                System.out.println("    description [" + re.getDescription() + "]");
                System.out.println("    osU [" + re.getOsUSet() + "]");
                System.out.println("    osP [" + re.getOsPSet() + "]");
                ReviewMgrConsole.printTemporal(re, "ADMINROLE");
            }
        } else {
            System.out.println("name [" + val + "] was not found");
        }
        System.out.println("ENTER to continue");
    } catch (SecurityException e) {
        LOG.error("findRoles caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
    }
    ReaderUtil.readChar();
}
Also used : AdminRole(org.apache.directory.fortress.core.model.AdminRole) UserAdminRole(org.apache.directory.fortress.core.model.UserAdminRole)

Example 27 with AdminRole

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

the class PropertyMgrImplTest method testCrudProperties.

public void testCrudProperties() {
    Role role = RoleTestData.getRole(RoleTestData.ROLES_TR1[0]);
    AdminRole adminRole = AdminRoleTestData.getRole(AdminRoleTestData.AROLES_TR1[0]);
    PermObj permObj = PermTestData.getObj(PermTestData.OBJS_TOB1[0]);
    Permission permOp = PermTestData.getOp(permObj.getObjName(), PermTestData.OPS_TOP1[0]);
    Group group = GroupTestData.TEST_GROUP1;
    addProperties("ADD-PROP-RLE", role, PROPS);
    addProperties("ADD-PROP-ADMRLE", adminRole, PROPS);
    addProperties("ADD-PROP-POBJ", permObj, PROPS);
    addProperties("ADD-PROP-POP", permOp, PROPS);
    addProperties("ADD-PROP-GRP", group, PROPS);
    updateProperties("UPD-PROP-RLE", role, PROPS_UPDATED[0]);
    updateProperties("UPD-PROP-ADMRLE", adminRole, PROPS_UPDATED[0]);
    updateProperties("UPD-PROP-POBJ", permObj, PROPS_UPDATED[0]);
    updateProperties("UPD-PROP-POP", permOp, PROPS_UPDATED[0]);
    updateProperties("UPD-PROP-POP", group, PROPS_UPDATED[0]);
    deleteProperties("DEL-PROP-RLE", role, PROPS_UPDATED[0]);
    deleteProperties("DEL-PROP-ADMRLE", adminRole, PROPS_UPDATED[0]);
    deleteProperties("DEL-PROP-POBJ", permObj, PROPS_UPDATED[0]);
    deleteProperties("DEL-PROP-POP", permOp, PROPS_UPDATED[0]);
    deleteProperties("DEL-PROP-POP", group, PROPS_UPDATED[0]);
}
Also used : AdminRole(org.apache.directory.fortress.core.model.AdminRole) Role(org.apache.directory.fortress.core.model.Role) Group(org.apache.directory.fortress.core.model.Group) PermObj(org.apache.directory.fortress.core.model.PermObj) Permission(org.apache.directory.fortress.core.model.Permission) AdminRole(org.apache.directory.fortress.core.model.AdminRole)

Example 28 with AdminRole

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

the class AdminRoleTestData method getRoleConstraint.

private static Constraint getRoleConstraint(String[] rle) {
    AdminRole role = new AdminRole();
    role.setBeginDate(RoleTestData.getBeginDate(rle));
    role.setEndDate(RoleTestData.getEndDate(rle));
    role.setBeginLockDate(RoleTestData.getBeginLockDate(rle));
    role.setEndLockDate(RoleTestData.getEndLockDate(rle));
    role.setBeginTime(RoleTestData.getBeginTime(rle));
    role.setEndTime(RoleTestData.getEndTime(rle));
    role.setDayMask(RoleTestData.getDayMask(rle));
    role.setTimeout(RoleTestData.getTimeOut(rle));
    return role;
}
Also used : AdminRole(org.apache.directory.fortress.core.model.AdminRole)

Example 29 with AdminRole

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

the class DelegatedMgrImplTest method updateAdminRoles.

/**
 * @param msg
 * @param rArray
 */
public static void updateAdminRoles(String msg, String[][] rArray, boolean isAdmin) {
    LogUtil.logIt(msg);
    try {
        DelAdminMgr dAdminMgr;
        if (isAdmin) {
            dAdminMgr = getManagedDelegatedMgr();
        } else {
            dAdminMgr = DelAdminMgrFactory.createInstance(TestUtils.getContext());
        }
        for (String[] rle : rArray) {
            AdminRole role = AdminRoleTestData.getRole(rle);
            AdminRole entity = dAdminMgr.updateRole(role);
            LOG.debug("updateAdminRoles role [" + entity.getName() + "] successful");
        }
    } catch (SecurityException ex) {
        LOG.error("updateAdminRoles caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
        fail(ex.getMessage());
    }
}
Also used : DelAdminMgr(org.apache.directory.fortress.core.DelAdminMgr) SecurityException(org.apache.directory.fortress.core.SecurityException) AdminRole(org.apache.directory.fortress.core.model.AdminRole) UserAdminRole(org.apache.directory.fortress.core.model.UserAdminRole)

Example 30 with AdminRole

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

the class DelegatedMgrImplTest method deleteAdminRoles.

/**
 * @param rArray
 */
private void deleteAdminRoles(String msg, String[][] rArray, boolean isAdmin) {
    LogUtil.logIt(msg);
    try {
        DelAdminMgr dAdminMgr;
        if (isAdmin) {
            dAdminMgr = getManagedDelegatedMgr();
        } else {
            dAdminMgr = DelAdminMgrFactory.createInstance(TestUtils.getContext());
        }
        for (String[] rle : rArray) {
            AdminRole role = new AdminRole();
            role.setName(RoleTestData.getName(rle));
            dAdminMgr.deleteRole(role);
            LOG.debug("deleteAdminRoles role [" + role.getName() + "] successful");
        }
    } catch (SecurityException ex) {
        LOG.error("deleteAdminRoles caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
        fail(ex.getMessage());
    }
}
Also used : DelAdminMgr(org.apache.directory.fortress.core.DelAdminMgr) SecurityException(org.apache.directory.fortress.core.SecurityException) AdminRole(org.apache.directory.fortress.core.model.AdminRole) UserAdminRole(org.apache.directory.fortress.core.model.UserAdminRole)

Aggregations

AdminRole (org.apache.directory.fortress.core.model.AdminRole)46 UserAdminRole (org.apache.directory.fortress.core.model.UserAdminRole)37 SecurityException (org.apache.directory.fortress.core.SecurityException)18 DelAdminMgr (org.apache.directory.fortress.core.DelAdminMgr)10 AdminPermissionOperation (org.apache.directory.fortress.annotation.AdminPermissionOperation)8 DelReviewMgr (org.apache.directory.fortress.core.DelReviewMgr)5 Role (org.apache.directory.fortress.core.model.Role)5 FortRequest (org.apache.directory.fortress.core.model.FortRequest)4 FortResponse (org.apache.directory.fortress.core.model.FortResponse)4 Relationship (org.apache.directory.fortress.core.model.Relationship)4 FinderException (org.apache.directory.fortress.core.FinderException)3 User (org.apache.directory.fortress.core.model.User)3 LdapException (org.apache.directory.api.ldap.model.exception.LdapException)2 OrgUnit (org.apache.directory.fortress.core.model.OrgUnit)2 PermObj (org.apache.directory.fortress.core.model.PermObj)2 Permission (org.apache.directory.fortress.core.model.Permission)2 UserRole (org.apache.directory.fortress.core.model.UserRole)2 LdapConnection (org.apache.directory.ldap.client.api.LdapConnection)2 ArrayList (java.util.ArrayList)1 CursorException (org.apache.directory.api.ldap.model.cursor.CursorException)1