Search in sources :

Example 1 with RoleRelationship

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

the class AdminMgrRestImpl method addInheritance.

/**
 * {@inheritDoc}
 */
@Override
public void addInheritance(Role parentRole, Role childRole) throws SecurityException {
    VUtil.assertNotNull(parentRole, GlobalErrIds.PARENT_ROLE_NULL, CLS_NM + ".addInheritance");
    VUtil.assertNotNull(childRole, GlobalErrIds.CHILD_ROLE_NULL, CLS_NM + ".addInheritance");
    FortRequest request = RestUtils.getRequest(this.contextId);
    RoleRelationship relationship = new RoleRelationship();
    relationship.setParent(parentRole);
    relationship.setChild(childRole);
    request.setEntity(relationship);
    if (this.adminSess != null) {
        request.setSession(adminSess);
    }
    String szRequest = RestUtils.marshal(request);
    String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.ROLE_ADDINHERIT);
    FortResponse response = RestUtils.unmarshall(szResponse);
    if (response.getErrorCode() != 0) {
        throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
    }
}
Also used : RoleRelationship(org.apache.directory.fortress.core.model.RoleRelationship) FortResponse(org.apache.directory.fortress.core.model.FortResponse) SecurityException(org.apache.directory.fortress.core.SecurityException) FortRequest(org.apache.directory.fortress.core.model.FortRequest)

Example 2 with RoleRelationship

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

the class AdminMgrRestImpl method addAscendant.

/**
 * {@inheritDoc}
 */
@Override
public void addAscendant(Role childRole, Role parentRole) throws SecurityException {
    VUtil.assertNotNull(parentRole, GlobalErrIds.PARENT_ROLE_NULL, CLS_NM + ".addAscendant");
    VUtil.assertNotNull(childRole, GlobalErrIds.CHILD_ROLE_NULL, CLS_NM + ".addAscendant");
    FortRequest request = RestUtils.getRequest(this.contextId);
    RoleRelationship relationship = new RoleRelationship();
    relationship.setParent(parentRole);
    relationship.setChild(childRole);
    request.setEntity(relationship);
    if (this.adminSess != null) {
        request.setSession(adminSess);
    }
    String szRequest = RestUtils.marshal(request);
    String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.ROLE_ASC);
    FortResponse response = RestUtils.unmarshall(szResponse);
    if (response.getErrorCode() != 0) {
        throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
    }
}
Also used : RoleRelationship(org.apache.directory.fortress.core.model.RoleRelationship) FortResponse(org.apache.directory.fortress.core.model.FortResponse) SecurityException(org.apache.directory.fortress.core.SecurityException) FortRequest(org.apache.directory.fortress.core.model.FortRequest)

Example 3 with RoleRelationship

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

the class AdminMgrRestImpl method addDescendant.

/**
 * {@inheritDoc}
 */
@Override
public void addDescendant(Role parentRole, Role childRole) throws SecurityException {
    VUtil.assertNotNull(parentRole, GlobalErrIds.PARENT_ROLE_NULL, CLS_NM + ".addDescendant");
    VUtil.assertNotNull(childRole, GlobalErrIds.CHILD_ROLE_NULL, CLS_NM + ".addDescendant");
    FortRequest request = RestUtils.getRequest(this.contextId);
    RoleRelationship relationship = new RoleRelationship();
    relationship.setParent(parentRole);
    relationship.setChild(childRole);
    request.setEntity(relationship);
    if (this.adminSess != null) {
        request.setSession(adminSess);
    }
    String szRequest = RestUtils.marshal(request);
    String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.ROLE_DESC);
    FortResponse response = RestUtils.unmarshall(szResponse);
    if (response.getErrorCode() != 0) {
        throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
    }
}
Also used : RoleRelationship(org.apache.directory.fortress.core.model.RoleRelationship) FortResponse(org.apache.directory.fortress.core.model.FortResponse) SecurityException(org.apache.directory.fortress.core.SecurityException) FortRequest(org.apache.directory.fortress.core.model.FortRequest)

Example 4 with RoleRelationship

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

the class AdminMgrRestImpl method deleteInheritance.

/**
 * {@inheritDoc}
 */
@Override
public void deleteInheritance(Role parentRole, Role childRole) throws SecurityException {
    VUtil.assertNotNull(parentRole, GlobalErrIds.PARENT_ROLE_NULL, CLS_NM + ".deleteInheritance");
    VUtil.assertNotNull(childRole, GlobalErrIds.CHILD_ROLE_NULL, CLS_NM + ".deleteInheritance");
    FortRequest request = RestUtils.getRequest(this.contextId);
    RoleRelationship relationship = new RoleRelationship();
    relationship.setParent(parentRole);
    relationship.setChild(childRole);
    request.setEntity(relationship);
    if (this.adminSess != null) {
        request.setSession(adminSess);
    }
    String szRequest = RestUtils.marshal(request);
    String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.ROLE_DELINHERIT);
    FortResponse response = RestUtils.unmarshall(szResponse);
    if (response.getErrorCode() != 0) {
        throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
    }
}
Also used : RoleRelationship(org.apache.directory.fortress.core.model.RoleRelationship) 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)4 FortRequest (org.apache.directory.fortress.core.model.FortRequest)4 FortResponse (org.apache.directory.fortress.core.model.FortResponse)4 RoleRelationship (org.apache.directory.fortress.core.model.RoleRelationship)4