Search in sources :

Example 61 with Role

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

the class Options method getRole.

/**
 */
public Role getRole() {
    Role role = new Role();
    role.setDescription(getDescription());
    updateTemporal(role);
    return role;
}
Also used : AdminRole(org.apache.directory.fortress.core.model.AdminRole) Role(org.apache.directory.fortress.core.model.Role)

Example 62 with Role

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

the class AdminMgrImplTest method deleteInheritedRoles.

/**
 * @param rArray
 */
public static void deleteInheritedRoles(String msg, String[][] rArray) {
    LogUtil.logIt(msg);
    try {
        AdminMgr adminMgr = getManagedAdminMgr();
        for (String[] rle : rArray) {
            Role role = RoleTestData.getRole(rle);
            Set<String> parents = RoleTestData.getRelationships(rle);
            if (parents != null) {
                for (String pRole : parents) {
                    adminMgr.deleteInheritance(new Role(pRole), role);
                    LOG.debug("deleteInheritedRoles child role [" + role.getName() + "] parent role [" + pRole + "] successful");
                }
            }
        }
    } catch (SecurityException ex) {
        LOG.error("deleteInheritedRoles caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
        fail(ex.getMessage());
    }
}
Also used : Role(org.apache.directory.fortress.core.model.Role) UserRole(org.apache.directory.fortress.core.model.UserRole) SecurityException(org.apache.directory.fortress.core.SecurityException) AdminMgr(org.apache.directory.fortress.core.AdminMgr)

Example 63 with Role

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

the class AdminMgrImplTest method assignUsersH.

/**
 * @param msg
 * @param uArray
 * @param rArray
 * @param setTemporal
 */
public static void assignUsersH(String msg, String[][] uArray, String[][] rArray, boolean setTemporal) {
    LogUtil.logIt(msg);
    try {
        AdminMgr adminMgr = getManagedAdminMgr();
        int i = 0;
        for (String[] usr : uArray) {
            Role role = RoleTestData.getRole(rArray[i]);
            UserRole uRole = new UserRole();
            uRole.setUserId(UserTestData.getUserId(usr));
            ConstraintUtil.copy(role, uRole);
            adminMgr.assignUser(uRole);
            i++;
        }
    } catch (SecurityException ex) {
        LOG.error("assignUsersH user caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
        fail(ex.getMessage());
    }
}
Also used : Role(org.apache.directory.fortress.core.model.Role) UserRole(org.apache.directory.fortress.core.model.UserRole) UserRole(org.apache.directory.fortress.core.model.UserRole) SecurityException(org.apache.directory.fortress.core.SecurityException) RoleConstraint(org.apache.directory.fortress.core.model.RoleConstraint) AdminMgr(org.apache.directory.fortress.core.AdminMgr)

Example 64 with Role

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

the class AdminMgrImplTest method addSsdRoleMember.

/**
 * @param sArray
 */
public static void addSsdRoleMember(String msg, String[][] sArray, String[][] rArray) {
    LogUtil.logIt(msg);
    try {
        AdminMgr adminMgr = getManagedAdminMgr();
        ReviewMgr reviewMgr = ReviewMgrImplTest.getManagedReviewMgr();
        for (String[] ssdle : sArray) {
            SDSet ssd = RoleTestData.getSDSet(ssdle);
            SDSet entity = adminMgr.createSsdSet(ssd);
            LOG.debug("addSsdRoleMember SSD [" + entity.getName() + "] successful");
            for (String[] rle : rArray) {
                Role role = RoleTestData.getRole(rle);
                adminMgr.addSsdRoleMember(ssd, role);
                List<SDSet> ssdSets = reviewMgr.ssdRoleSets(role);
                assertNotNull(ssdSets);
                assertTrue(CLS_NM + "addSsdRoleMember list size check", ssdSets.size() == 1);
                SDSet ssd2 = ssdSets.get(0);
                assertTrue(CLS_NM + "addSsdRoleMember SSD name check", ssd.getName().equals(ssd2.getName()));
                assertTrue(CLS_NM + "addSsdRoleMember SSD role check", ssd2.getMembers().contains(role.getName()));
            }
        }
    } catch (SecurityException ex) {
        LOG.error("addSsdRoleMember caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
        fail(ex.getMessage());
    }
}
Also used : SDSet(org.apache.directory.fortress.core.model.SDSet) Role(org.apache.directory.fortress.core.model.Role) UserRole(org.apache.directory.fortress.core.model.UserRole) ReviewMgr(org.apache.directory.fortress.core.ReviewMgr) SecurityException(org.apache.directory.fortress.core.SecurityException) AdminMgr(org.apache.directory.fortress.core.AdminMgr)

Example 65 with Role

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

the class AdminMgrImplTest method deleteRoles.

/**
 * @param rArray
 */
public static void deleteRoles(String msg, String[][] rArray) {
    LogUtil.logIt(msg);
    try {
        AdminMgr adminMgr = getManagedAdminMgr();
        for (String[] rle : rArray) {
            Role role = new Role();
            role.setName(RoleTestData.getName(rle));
            adminMgr.deleteRole(role);
            LOG.debug("deleteRoles role [" + role.getName() + "] successful");
        }
    } catch (SecurityException ex) {
        LOG.error("deleteRoles caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
        fail(ex.getMessage());
    }
}
Also used : Role(org.apache.directory.fortress.core.model.Role) UserRole(org.apache.directory.fortress.core.model.UserRole) SecurityException(org.apache.directory.fortress.core.SecurityException) AdminMgr(org.apache.directory.fortress.core.AdminMgr)

Aggregations

Role (org.apache.directory.fortress.core.model.Role)117 UserRole (org.apache.directory.fortress.core.model.UserRole)83 SecurityException (org.apache.directory.fortress.core.SecurityException)66 AdminMgr (org.apache.directory.fortress.core.AdminMgr)40 ReviewMgr (org.apache.directory.fortress.core.ReviewMgr)30 User (org.apache.directory.fortress.core.model.User)30 AdminRole (org.apache.directory.fortress.core.model.AdminRole)25 Permission (org.apache.directory.fortress.core.model.Permission)24 RoleConstraint (org.apache.directory.fortress.core.model.RoleConstraint)17 AdminPermissionOperation (org.apache.directory.fortress.annotation.AdminPermissionOperation)15 UserAdminRole (org.apache.directory.fortress.core.model.UserAdminRole)15 Relationship (org.apache.directory.fortress.core.model.Relationship)7 SDSet (org.apache.directory.fortress.core.model.SDSet)7 FinderException (org.apache.directory.fortress.core.FinderException)6 PermObj (org.apache.directory.fortress.core.model.PermObj)6 ArrayList (java.util.ArrayList)5 Group (org.apache.directory.fortress.core.model.Group)5 Constraint (org.apache.directory.fortress.core.model.Constraint)4 FortRequest (org.apache.directory.fortress.core.model.FortRequest)4 FortResponse (org.apache.directory.fortress.core.model.FortResponse)4