Search in sources :

Example 41 with SDSet

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

the class ReviewMgrRestImpl method dsdRoleSet.

/**
 * {@inheritDoc}
 */
@Override
public SDSet dsdRoleSet(SDSet set) throws SecurityException {
    VUtil.assertNotNull(set, GlobalErrIds.DSD_NULL, CLS_NM + ".dsdRoleSet");
    SDSet retSet;
    FortRequest request = new FortRequest();
    request.setContextId(this.contextId);
    request.setEntity(set);
    if (this.adminSess != null) {
        request.setSession(adminSess);
    }
    String szRequest = RestUtils.marshal(request);
    String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.DSD_READ);
    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 42 with SDSet

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

the class ReviewMgrRestImpl method dsdRoleSetCardinality.

/**
 * {@inheritDoc}
 */
@Override
public int dsdRoleSetCardinality(SDSet dsd) throws SecurityException {
    VUtil.assertNotNull(dsd, GlobalErrIds.DSD_NULL, CLS_NM + ".dsdRoleSetCardinality");
    SDSet retSet;
    FortRequest request = new FortRequest();
    request.setContextId(this.contextId);
    request.setEntity(dsd);
    if (this.adminSess != null) {
        request.setSession(adminSess);
    }
    String szRequest = RestUtils.marshal(request);
    String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.DSD_CARD);
    FortResponse response = RestUtils.unmarshall(szResponse);
    if (response.getErrorCode() == 0) {
        retSet = (SDSet) response.getEntity();
    } else {
        throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
    }
    return retSet.getCardinality();
}
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 43 with SDSet

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

the class ReviewMgrRestImpl method ssdSets.

/**
 * {@inheritDoc}
 */
public List<SDSet> ssdSets(SDSet ssd) throws SecurityException {
    VUtil.assertNotNull(ssd, GlobalErrIds.ROLE_NULL, CLS_NM + ".ssdSets");
    List<SDSet> retSsdSets;
    FortRequest request = new FortRequest();
    request.setContextId(this.contextId);
    request.setEntity(ssd);
    if (this.adminSess != null) {
        request.setSession(adminSess);
    }
    String szRequest = RestUtils.marshal(request);
    String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.SSD_SETS);
    FortResponse response = RestUtils.unmarshall(szResponse);
    if (response.getErrorCode() == 0) {
        retSsdSets = response.getEntities();
        if (retSsdSets == null) {
            retSsdSets = new ArrayList<>();
        }
    } else {
        throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
    }
    return retSsdSets;
}
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 44 with SDSet

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

the class ReviewMgrRestImpl method dsdSets.

/**
 * {@inheritDoc}
 */
public List<SDSet> dsdSets(SDSet dsd) throws SecurityException {
    VUtil.assertNotNull(dsd, GlobalErrIds.ROLE_NULL, CLS_NM + ".dsdSets");
    List<SDSet> retDsdSets;
    FortRequest request = new FortRequest();
    request.setContextId(this.contextId);
    request.setEntity(dsd);
    if (this.adminSess != null) {
        request.setSession(adminSess);
    }
    String szRequest = RestUtils.marshal(request);
    String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.DSD_SETS);
    FortResponse response = RestUtils.unmarshall(szResponse);
    if (response.getErrorCode() == 0) {
        retDsdSets = response.getEntities();
        if (retDsdSets == null) {
            retDsdSets = new ArrayList<>();
        }
    } else {
        throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
    }
    return retDsdSets;
}
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 45 with SDSet

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

the class AdminMgrRestImpl method setDsdSetCardinality.

/**
 * {@inheritDoc}
 */
@Override
public SDSet setDsdSetCardinality(SDSet dsdSet, int cardinality) throws SecurityException {
    VUtil.assertNotNull(dsdSet, GlobalErrIds.SSD_NULL, CLS_NM + ".setSsdSetCardinality");
    SDSet retSet;
    FortRequest request = RestUtils.getRequest(this.contextId);
    dsdSet.setCardinality(cardinality);
    request.setEntity(dsdSet);
    if (this.adminSess != null) {
        request.setSession(adminSess);
    }
    String szRequest = RestUtils.marshal(request);
    String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.DSD_CARD_UPDATE);
    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