Search in sources :

Example 21 with AdminPermissionOperation

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

the class ReviewMgrImpl method findRoleConstraints.

/**
 * {@inheritDoc}
 */
@Override
@AdminPermissionOperation
public List<RoleConstraint> findRoleConstraints(User user, Permission permission, RoleConstraint.RCType rcType) throws SecurityException {
    String methodName = "findRoleConstraints";
    assertContext(CLS_NM, methodName, user, GlobalErrIds.USER_NULL);
    assertContext(CLS_NM, methodName, permission, GlobalErrIds.PERM_NULL);
    checkAccess(CLS_NM, methodName);
    // find roles this permission is authorized for
    Permission pe = permP.read(permission);
    Set<String> authorizedRoles = authorizeRoles(pe.getRoles());
    // find role constraints for the user and the permission's pa set
    return userP.findRoleConstraints(authorizedRoles, user, rcType, pe.getPaSets());
}
Also used : Permission(org.apache.directory.fortress.core.model.Permission) AdminPermissionOperation(org.apache.directory.fortress.annotation.AdminPermissionOperation)

Example 22 with AdminPermissionOperation

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

the class ReviewMgrImpl method permissionUsers.

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

Example 23 with AdminPermissionOperation

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

the class ReviewMgrImpl method ssdRoleSetCardinality.

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

Example 24 with AdminPermissionOperation

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

the class ReviewMgrImpl method assignedRoles.

/**
 * {@inheritDoc}
 */
@Override
@AdminPermissionOperation
public List<UserRole> assignedRoles(User user) throws SecurityException {
    String methodName = "assignedRoles";
    assertContext(CLS_NM, methodName, user, GlobalErrIds.USER_NULL);
    checkAccess(CLS_NM, methodName);
    User ue = userP.read(user, true);
    return ue.getRoles();
}
Also used : User(org.apache.directory.fortress.core.model.User) AdminPermissionOperation(org.apache.directory.fortress.annotation.AdminPermissionOperation)

Example 25 with AdminPermissionOperation

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

the class ReviewMgrImpl method findRoles.

/**
 * {@inheritDoc}
 */
@Override
@AdminPermissionOperation
public List<String> findRoles(String searchVal, int limit) throws SecurityException {
    String methodName = "findRoles";
    VUtil.assertNotNull(searchVal, GlobalErrIds.ROLE_NM_NULL, CLS_NM + "." + methodName);
    checkAccess(CLS_NM, methodName);
    Role role = new Role(searchVal);
    role.setContextId(this.contextId);
    return roleP.search(role, limit);
}
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)

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