Search in sources :

Example 1 with ReviewMgr

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

the class AuditMgrImpl method searchAdminMods.

/**
 * {@inheritDoc}
 */
@Override
@AdminPermissionOperation
public List<Mod> searchAdminMods(UserAudit uAudit) throws SecurityException {
    String methodName = "searchAdminMods";
    assertContext(CLS_NM, methodName, uAudit, GlobalErrIds.AUDT_INPUT_NULL);
    checkAccess(CLS_NM, methodName);
    if (StringUtils.isNotEmpty(uAudit.getUserId())) {
        ReviewMgr rMgr = ReviewMgrFactory.createInstance(this.contextId);
        User user = rMgr.readUser(new User(uAudit.getUserId()));
        uAudit.setInternalUserId(user.getInternalId());
    }
    return auditP.searchAdminMods(uAudit);
}
Also used : User(org.apache.directory.fortress.core.model.User) ReviewMgr(org.apache.directory.fortress.core.ReviewMgr) AdminPermissionOperation(org.apache.directory.fortress.annotation.AdminPermissionOperation)

Example 2 with ReviewMgr

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

the class GroupMgrImpl method loadUserDn.

private void loadUserDn(User inUser) throws SecurityException {
    ReviewMgr reviewMgr = ReviewMgrFactory.createInstance(this.contextId);
    User outUser = reviewMgr.readUser(inUser);
    inUser.setDn(outUser.getDn());
}
Also used : User(org.apache.directory.fortress.core.model.User) ReviewMgr(org.apache.directory.fortress.core.ReviewMgr)

Example 3 with ReviewMgr

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

the class GroupMgrImpl method assign.

/**
 * {@inheritDoc}
 */
@Override
@AdminPermissionOperation
public Group assign(Group group, String member) throws SecurityException {
    String methodName = "assign";
    assertContext(CLS_NM, methodName, group, GlobalErrIds.GROUP_NULL);
    checkAccess(CLS_NM, methodName);
    ReviewMgr reviewMgr = ReviewMgrFactory.createInstance(this.contextId);
    String dn;
    if (group.getType() == Group.Type.ROLE) {
        Role inRole = new Role(member);
        inRole.setContextId(group.getContextId());
        Role role = reviewMgr.readRole(inRole);
        dn = role.getDn();
        // Validate SSD constraints
        SDUtil.getInstance().validateSSD(group, role);
    } else {
        User inUser = new User(member);
        inUser.setContextId(group.getContextId());
        User user = reviewMgr.readUser(inUser);
        dn = user.getDn();
    }
    return groupP.assign(group, dn);
}
Also used : Role(org.apache.directory.fortress.core.model.Role) UserRole(org.apache.directory.fortress.core.model.UserRole) User(org.apache.directory.fortress.core.model.User) ReviewMgr(org.apache.directory.fortress.core.ReviewMgr) AdminPermissionOperation(org.apache.directory.fortress.annotation.AdminPermissionOperation)

Example 4 with ReviewMgr

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

the class GroupMgrImpl method deassign.

/**
 * {@inheritDoc}
 */
@Override
@AdminPermissionOperation
public Group deassign(Group group, String member) throws SecurityException {
    String methodName = "deassign";
    assertContext(CLS_NM, methodName, group, GlobalErrIds.GROUP_NULL);
    checkAccess(CLS_NM, methodName);
    ReviewMgr reviewMgr = ReviewMgrFactory.createInstance(this.contextId);
    String dn;
    if (group.getType() == Group.Type.ROLE) {
        Role role = reviewMgr.readRole(new Role(member));
        dn = role.getDn();
    } else {
        User user = reviewMgr.readUser(new User(member));
        dn = user.getDn();
    }
    return groupP.deassign(group, dn);
}
Also used : Role(org.apache.directory.fortress.core.model.Role) UserRole(org.apache.directory.fortress.core.model.UserRole) User(org.apache.directory.fortress.core.model.User) ReviewMgr(org.apache.directory.fortress.core.ReviewMgr) AdminPermissionOperation(org.apache.directory.fortress.annotation.AdminPermissionOperation)

Example 5 with ReviewMgr

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

the class GroupMgrImpl method loadRoleDns.

private void loadRoleDns(Group group) throws SecurityException {
    if (CollectionUtils.isNotEmpty(group.getMembers())) {
        ReviewMgr reviewMgr = ReviewMgrFactory.createInstance(this.contextId);
        List<String> roleDns = new ArrayList<String>();
        for (String member : group.getMembers()) {
            Role role = reviewMgr.readRole(new Role(member));
            roleDns.add(role.getDn());
        }
        group.setMembers(roleDns);
    }
}
Also used : Role(org.apache.directory.fortress.core.model.Role) UserRole(org.apache.directory.fortress.core.model.UserRole) ReviewMgr(org.apache.directory.fortress.core.ReviewMgr) ArrayList(java.util.ArrayList)

Aggregations

ReviewMgr (org.apache.directory.fortress.core.ReviewMgr)75 SecurityException (org.apache.directory.fortress.core.SecurityException)65 UserRole (org.apache.directory.fortress.core.model.UserRole)32 User (org.apache.directory.fortress.core.model.User)31 Role (org.apache.directory.fortress.core.model.Role)30 AdminMgr (org.apache.directory.fortress.core.AdminMgr)27 RoleConstraint (org.apache.directory.fortress.core.model.RoleConstraint)22 Permission (org.apache.directory.fortress.core.model.Permission)16 SDSet (org.apache.directory.fortress.core.model.SDSet)8 PermObj (org.apache.directory.fortress.core.model.PermObj)5 ArrayList (java.util.ArrayList)3 AdminPermissionOperation (org.apache.directory.fortress.annotation.AdminPermissionOperation)3 PermAnt (org.apache.directory.fortress.core.ant.PermAnt)2 CSVWriter (au.com.bytecode.opencsv.CSVWriter)1 FileWriter (java.io.FileWriter)1 IOException (java.io.IOException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 Map (java.util.Map)1 AccessMgr (org.apache.directory.fortress.core.AccessMgr)1