Search in sources :

Example 21 with AdminRole

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

the class DelegatedMgrImplTest method searchAdminRoles.

/**
 * @param msg
 * @param srchValue
 * @param rArray
 */
public static void searchAdminRoles(String msg, String srchValue, String[][] rArray) {
    LogUtil.logIt(msg);
    try {
        DelReviewMgr dReviewMgr = getManagedDelegatedReviewMgr();
        List<AdminRole> roles = dReviewMgr.findRoles(srchValue);
        assertNotNull(roles);
        assertTrue(CLS_NM + "searchAdminRoles list size check", rArray.length == roles.size());
        for (String[] rle : rArray) {
            int indx = roles.indexOf(AdminRoleTestData.getRole(rle));
            if (indx != -1) {
                AdminRole entity = roles.get(indx);
                assertNotNull(entity);
                AdminRoleTestData.assertEquals(entity, rle);
                LOG.debug("searchAdminRoles [" + entity.getName() + "] successful");
            } else {
                msg = "searchAdminRoles srchValue [" + srchValue + "] failed list search";
                LogUtil.logIt(msg);
                fail(msg);
            }
        }
    } catch (SecurityException ex) {
        LOG.error("searchAdminRoles srchValue [" + srchValue + "] caught SecurityException rc=" + ex.getErrorId() + ", msg=" + ex.getMessage(), ex);
        fail(ex.getMessage());
    }
}
Also used : SecurityException(org.apache.directory.fortress.core.SecurityException) AdminRole(org.apache.directory.fortress.core.model.AdminRole) UserAdminRole(org.apache.directory.fortress.core.model.UserAdminRole) DelReviewMgr(org.apache.directory.fortress.core.DelReviewMgr)

Example 22 with AdminRole

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

the class DelegatedAdminMgrConsole method addRoleAscendant.

/**
 */
void addRoleAscendant() {
    try {
        AdminRole cre = new AdminRole();
        AdminRole pre = new AdminRole();
        ReaderUtil.clearScreen();
        System.out.println("Enter child adminRole name:");
        cre.setName(ReaderUtil.readLn());
        System.out.println("Enter parent adminRole name to add to repo:");
        pre.setName(ReaderUtil.readLn());
        System.out.println("Enter parent adminRole description:");
        pre.setDescription(ReaderUtil.readLn());
        dAmgr.addAscendant(cre, pre);
        System.out.println("child adminRole [" + cre.getName() + "]");
        System.out.println("parent adminRole [" + pre.getName() + "]");
        System.out.println("parent adminRole and inheritance relationship has been added");
        System.out.println("ENTER to continue");
    } catch (SecurityException e) {
        LOG.error("addRoleAscendant 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 23 with AdminRole

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

the class DelegatedAdminMgrConsole method addRoleInheritance.

/**
 */
void addRoleInheritance() {
    try {
        AdminRole cre = new AdminRole();
        AdminRole pre = new AdminRole();
        ReaderUtil.clearScreen();
        System.out.println("Enter child adminRole name:");
        cre.setName(ReaderUtil.readLn());
        System.out.println("Enter parent adminRole name:");
        pre.setName(ReaderUtil.readLn());
        dAmgr.addInheritance(pre, cre);
        System.out.println("child adminRole [" + cre.getName() + "]");
        System.out.println("parent adminRole [" + pre.getName() + "]");
        System.out.println("inheritance relationship has been added");
        System.out.println("ENTER to continue");
    } catch (SecurityException e) {
        LOG.error("addRoleInheritance 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 24 with AdminRole

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

the class DelegatedAdminMgrConsole method addRoleDescendant.

/**
 */
void addRoleDescendant() {
    try {
        AdminRole cre = new AdminRole();
        AdminRole pre = new AdminRole();
        ReaderUtil.clearScreen();
        System.out.println("Enter child adminRole name to add to repo:");
        cre.setName(ReaderUtil.readLn());
        System.out.println("Enter child adminRole description:");
        cre.setDescription(ReaderUtil.readLn());
        System.out.println("Enter parent adminRole name:");
        pre.setName(ReaderUtil.readLn());
        dAmgr.addDescendant(pre, cre);
        System.out.println("child adminRole [" + cre.getName() + "]");
        System.out.println("parent adminRole [" + pre.getName() + "]");
        System.out.println("child adminRole and inheritance relationship has been added");
        System.out.println("ENTER to continue");
    } catch (SecurityException e) {
        LOG.error("addRoleDescendant 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 25 with AdminRole

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

the class DelegatedReviewMgrConsole method assignedUsers.

/**
 */
void assignedUsers() {
    try {
        System.out.println("Enter admin role name:");
        String name = ReaderUtil.readLn();
        List<User> list = rm.assignedUsers(new AdminRole(name));
        int i = 0;
        for (User ue : list) {
            System.out.println("USER[" + ++i + "]");
            System.out.println("    userId      [" + ue.getUserId() + "]");
            System.out.println("    internalId  [" + ue.getInternalId() + "]");
            System.out.println("    description [" + ue.getDescription() + "]");
            System.out.println("    common name [" + ue.getCn() + "]");
            System.out.println("    surname     [" + ue.getSn() + "]");
            System.out.println("    orgUnitId   [" + ue.getOu() + "]");
            ReviewMgrConsole.printTemporal(ue, "USER");
            System.out.println();
        }
        System.out.println("ENTER to continue");
    } catch (SecurityException e) {
        LOG.error("assignedUsers caught SecurityException rc=" + e.getErrorId() + ", msg=" + e.getMessage(), e);
    }
    ReaderUtil.readChar();
}
Also used : User(org.apache.directory.fortress.core.model.User) 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