Search in sources :

Example 6 with SDSet

use of org.apache.directory.fortress.core.model.SDSet 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 7 with SDSet

use of org.apache.directory.fortress.core.model.SDSet 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 8 with SDSet

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

the class ReviewMgrImpl method dsdRoleSetRoles.

/**
 * {@inheritDoc}
 */
@Override
@AdminPermissionOperation
public Set<String> dsdRoleSetRoles(SDSet dsd) throws SecurityException {
    String methodName = "dsdRoleSetRoles";
    assertContext(CLS_NM, methodName, dsd, GlobalErrIds.DSD_NULL);
    checkAccess(CLS_NM, methodName);
    dsd.setType(SDSet.SDType.DYNAMIC);
    SDSet se = ssdP.read(dsd);
    return se.getMembers();
}
Also used : SDSet(org.apache.directory.fortress.core.model.SDSet) AdminPermissionOperation(org.apache.directory.fortress.annotation.AdminPermissionOperation)

Example 9 with SDSet

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

the class AdminMgrRestImpl method deleteDsdRoleMember.

/**
 * {@inheritDoc}
 */
@Override
public SDSet deleteDsdRoleMember(SDSet dsdSet, Role role) throws SecurityException {
    VUtil.assertNotNull(dsdSet, GlobalErrIds.SSD_NULL, CLS_NM + ".deleteDsdRoleMember");
    VUtil.assertNotNull(role, GlobalErrIds.ROLE_NULL, CLS_NM + ".deleteSsdRoleMember");
    SDSet retSet;
    FortRequest request = RestUtils.getRequest(this.contextId);
    request.setEntity(dsdSet);
    request.setValue(role.getName());
    if (this.adminSess != null) {
        request.setSession(adminSess);
    }
    String szRequest = RestUtils.marshal(request);
    String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.DSD_DEL_MEMBER);
    FortResponse response = RestUtils.unmarshall(szResponse);
    if (response.getErrorCode() == 0) {
        retSet = (SDSet) response.getEntity();
    } else {
        throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
    }
    return retSet;
}
Also used : SDSet(org.apache.directory.fortress.core.model.SDSet) FortResponse(org.apache.directory.fortress.core.model.FortResponse) SecurityException(org.apache.directory.fortress.core.SecurityException) FortRequest(org.apache.directory.fortress.core.model.FortRequest)

Example 10 with SDSet

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

the class AdminMgrRestImpl method createSsdSet.

/**
 * {@inheritDoc}
 */
@Override
public SDSet createSsdSet(SDSet ssdSet) throws SecurityException {
    VUtil.assertNotNull(ssdSet, GlobalErrIds.SSD_NULL, CLS_NM + ".createSsdSet");
    SDSet retSet;
    FortRequest request = RestUtils.getRequest(this.contextId);
    request.setEntity(ssdSet);
    if (this.adminSess != null) {
        request.setSession(adminSess);
    }
    String szRequest = RestUtils.marshal(request);
    String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.SSD_ADD);
    FortResponse response = RestUtils.unmarshall(szResponse);
    if (response.getErrorCode() == 0) {
        retSet = (SDSet) response.getEntity();
    } else {
        throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
    }
    return retSet;
}
Also used : SDSet(org.apache.directory.fortress.core.model.SDSet) FortResponse(org.apache.directory.fortress.core.model.FortResponse) SecurityException(org.apache.directory.fortress.core.SecurityException) FortRequest(org.apache.directory.fortress.core.model.FortRequest)

Aggregations

SDSet (org.apache.directory.fortress.core.model.SDSet)58 SecurityException (org.apache.directory.fortress.core.SecurityException)37 FortRequest (org.apache.directory.fortress.core.model.FortRequest)20 FortResponse (org.apache.directory.fortress.core.model.FortResponse)20 AdminMgr (org.apache.directory.fortress.core.AdminMgr)12 UserRole (org.apache.directory.fortress.core.model.UserRole)12 AdminPermissionOperation (org.apache.directory.fortress.annotation.AdminPermissionOperation)8 ReviewMgr (org.apache.directory.fortress.core.ReviewMgr)8 Role (org.apache.directory.fortress.core.model.Role)7 User (org.apache.directory.fortress.core.model.User)5 LdapException (org.apache.directory.api.ldap.model.exception.LdapException)4 FinderException (org.apache.directory.fortress.core.FinderException)4 RoleConstraint (org.apache.directory.fortress.core.model.RoleConstraint)4 LdapConnection (org.apache.directory.ldap.client.api.LdapConnection)4 CursorException (org.apache.directory.api.ldap.model.cursor.CursorException)3 SearchCursor (org.apache.directory.api.ldap.model.cursor.SearchCursor)3 Constraint (org.apache.directory.fortress.core.model.Constraint)3 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 AccessMgr (org.apache.directory.fortress.core.AccessMgr)2