Search in sources :

Example 61 with SecurityException

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

the class AdminMgrRestImpl method setSsdSetCardinality.

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

Example 62 with SecurityException

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

the class AdminMgrRestImpl method addSsdRoleMember.

/**
 * {@inheritDoc}
 */
@Override
public SDSet addSsdRoleMember(SDSet ssdSet, Role role) throws SecurityException {
    VUtil.assertNotNull(ssdSet, GlobalErrIds.SSD_NULL, CLS_NM + ".addSsdRoleMember");
    VUtil.assertNotNull(role, GlobalErrIds.ROLE_NULL, CLS_NM + ".addSsdRoleMember");
    SDSet retSet;
    FortRequest request = RestUtils.getRequest(this.contextId);
    request.setEntity(ssdSet);
    request.setValue(role.getName());
    if (this.adminSess != null) {
        request.setSession(adminSess);
    }
    String szRequest = RestUtils.marshal(request);
    String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.SSD_ADD_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 63 with SecurityException

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

the class AdminMgrRestImpl method assignUser.

/**
 * {@inheritDoc}
 */
@Override
public void assignUser(UserRole uRole) throws SecurityException {
    VUtil.assertNotNull(uRole, GlobalErrIds.URLE_NULL, CLS_NM + ".assignUser");
    FortRequest request = RestUtils.getRequest(this.contextId);
    request.setEntity(uRole);
    if (this.adminSess != null) {
        request.setSession(adminSess);
    }
    String szRequest = RestUtils.marshal(request);
    String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.ROLE_ASGN);
    FortResponse response = RestUtils.unmarshall(szResponse);
    if (response.getErrorCode() != 0) {
        throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
    }
}
Also used : FortResponse(org.apache.directory.fortress.core.model.FortResponse) SecurityException(org.apache.directory.fortress.core.SecurityException) FortRequest(org.apache.directory.fortress.core.model.FortRequest)

Example 64 with SecurityException

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

the class AdminMgrRestImpl method updatePermObj.

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

Example 65 with SecurityException

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

the class AdminMgrRestImpl method deleteSsdSet.

/**
 * {@inheritDoc}
 */
@Override
public SDSet deleteSsdSet(SDSet ssdSet) throws SecurityException {
    VUtil.assertNotNull(ssdSet, GlobalErrIds.SSD_NULL, CLS_NM + ".deleteSsdSet");
    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_DELETE);
    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

SecurityException (org.apache.directory.fortress.core.SecurityException)441 FortRequest (org.apache.directory.fortress.core.model.FortRequest)152 FortResponse (org.apache.directory.fortress.core.model.FortResponse)152 User (org.apache.directory.fortress.core.model.User)125 AdminMgr (org.apache.directory.fortress.core.AdminMgr)89 UserRole (org.apache.directory.fortress.core.model.UserRole)88 Role (org.apache.directory.fortress.core.model.Role)66 ReviewMgr (org.apache.directory.fortress.core.ReviewMgr)65 Session (org.apache.directory.fortress.core.model.Session)59 Permission (org.apache.directory.fortress.core.model.Permission)56 AccessMgr (org.apache.directory.fortress.core.AccessMgr)41 DelAdminMgr (org.apache.directory.fortress.core.DelAdminMgr)39 SDSet (org.apache.directory.fortress.core.model.SDSet)37 OrgUnit (org.apache.directory.fortress.core.model.OrgUnit)36 RoleConstraint (org.apache.directory.fortress.core.model.RoleConstraint)34 UserAdminRole (org.apache.directory.fortress.core.model.UserAdminRole)33 AdminRole (org.apache.directory.fortress.core.model.AdminRole)25 PermObj (org.apache.directory.fortress.core.model.PermObj)22 Group (org.apache.directory.fortress.core.model.Group)19 PwPolicyMgr (org.apache.directory.fortress.core.PwPolicyMgr)17