Search in sources :

Example 16 with AdminPermissionOperation

use of org.apache.directory.fortress.annotation.AdminPermissionOperation 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 17 with AdminPermissionOperation

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

the class PwPolicyMgrImpl method deletePasswordPolicy.

/**
 * {@inheritDoc}
 */
@Override
@AdminPermissionOperation
public void deletePasswordPolicy(String userId) throws SecurityException {
    String methodName = "deletePasswordPolicy";
    VUtil.assertNotNullOrEmpty(userId, GlobalErrIds.USER_NULL, CLS_NM + "." + methodName);
    User user = new User(userId);
    user.setAdminSession(adminSess);
    setEntitySession(CLS_NM, methodName, user);
    userP.deletePwPolicy(user);
}
Also used : User(org.apache.directory.fortress.core.model.User) AdminPermissionOperation(org.apache.directory.fortress.annotation.AdminPermissionOperation)

Example 18 with AdminPermissionOperation

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

the class ReviewMgrImpl method assignedUsers.

/**
 * {@inheritDoc}
 */
@Override
@AdminPermissionOperation
public List<String> assignedUsers(Role role, int limit) throws SecurityException {
    String methodName = "assignedUsers";
    assertContext(CLS_NM, methodName, role, GlobalErrIds.ROLE_NULL);
    checkAccess(CLS_NM, methodName);
    List<String> users = null;
    // If role occupant is set on role, get it from the role object itself:
    if (Config.getInstance().isRoleOccupant()) {
        Role entity = roleP.read(role);
        // this one retrieves from the role itself.
        users = entity.getOccupants();
        if (users != null && users.size() > limit) {
            users = users.subList(0, limit);
        }
    } else // otherwise, search across the people tree for all users assigned to this role:
    {
        users = userP.getAssignedUserIds(role);
    }
    // return empty list to caller:
    if (users == null) {
        users = new ArrayList<>();
    }
    return users;
}
Also used : Role(org.apache.directory.fortress.core.model.Role) UserRole(org.apache.directory.fortress.core.model.UserRole) AdminPermissionOperation(org.apache.directory.fortress.annotation.AdminPermissionOperation)

Example 19 with AdminPermissionOperation

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

the class ReviewMgrImpl method dsdRoleSetCardinality.

/**
 * {@inheritDoc}
 */
@Override
@AdminPermissionOperation
public int dsdRoleSetCardinality(SDSet dsd) throws SecurityException {
    String methodName = "dsdRoleSetCardinality";
    assertContext(CLS_NM, methodName, dsd, GlobalErrIds.DSD_NULL);
    checkAccess(CLS_NM, methodName);
    SDSet se = ssdP.read(dsd);
    return se.getCardinality();
}
Also used : SDSet(org.apache.directory.fortress.core.model.SDSet) AdminPermissionOperation(org.apache.directory.fortress.annotation.AdminPermissionOperation)

Example 20 with AdminPermissionOperation

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

the class ReviewMgrImpl method permissionRoles.

/**
 * {@inheritDoc}
 */
@Override
@AdminPermissionOperation
public List<String> permissionRoles(Permission perm) throws SecurityException {
    String methodName = "permissionRoles";
    assertContext(CLS_NM, methodName, perm, GlobalErrIds.PERM_OBJECT_NULL);
    checkAccess(CLS_NM, methodName);
    Permission pe = permP.read(perm);
    List<String> retVals;
    if (pe != null && CollectionUtils.isNotEmpty(pe.getRoles())) {
        retVals = new ArrayList<>(pe.getRoles());
    } else {
        retVals = new ArrayList<>();
    }
    return retVals;
}
Also used : Permission(org.apache.directory.fortress.core.model.Permission) AdminPermissionOperation(org.apache.directory.fortress.annotation.AdminPermissionOperation)

Aggregations

AdminPermissionOperation (org.apache.directory.fortress.annotation.AdminPermissionOperation)54 AdminRole (org.apache.directory.fortress.core.model.AdminRole)18 User (org.apache.directory.fortress.core.model.User)18 UserRole (org.apache.directory.fortress.core.model.UserRole)16 Relationship (org.apache.directory.fortress.core.model.Relationship)15 Role (org.apache.directory.fortress.core.model.Role)15 SDSet (org.apache.directory.fortress.core.model.SDSet)8 UserAdminRole (org.apache.directory.fortress.core.model.UserAdminRole)8 Permission (org.apache.directory.fortress.core.model.Permission)5 OrgUnit (org.apache.directory.fortress.core.model.OrgUnit)4 ReviewMgr (org.apache.directory.fortress.core.ReviewMgr)3 SecurityException (org.apache.directory.fortress.core.SecurityException)3 PwPolicy (org.apache.directory.fortress.core.model.PwPolicy)2 RoleConstraint (org.apache.directory.fortress.core.model.RoleConstraint)2 Method (java.lang.reflect.Method)1 ArrayList (java.util.ArrayList)1 AdminMgr (org.apache.directory.fortress.core.AdminMgr)1 DelAdminMgr (org.apache.directory.fortress.core.DelAdminMgr)1 FinderException (org.apache.directory.fortress.core.FinderException)1 Group (org.apache.directory.fortress.core.model.Group)1