Search in sources :

Example 1 with AdminRoleRelationship

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

the class DelAdminMgrRestImpl method addDescendant.

/**
 * {@inheritDoc}
 */
@Override
public void addDescendant(AdminRole parentRole, AdminRole childRole) throws SecurityException {
    String methodName = "addDescendantRole";
    VUtil.assertNotNull(parentRole, GlobalErrIds.ARLE_PARENT_NULL, CLS_NM + "." + methodName);
    VUtil.assertNotNull(childRole, GlobalErrIds.ARLE_CHILD_NULL, CLS_NM + "." + methodName);
    FortRequest request = new FortRequest();
    request.setContextId(this.contextId);
    AdminRoleRelationship relationship = new AdminRoleRelationship();
    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.ARLE_DESC);
    FortResponse response = RestUtils.unmarshall(szResponse);
    if (response.getErrorCode() != 0) {
        throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
    }
}
Also used : AdminRoleRelationship(org.apache.directory.fortress.core.model.AdminRoleRelationship) 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 AdminRoleRelationship

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

the class DelAdminMgrRestImpl method addAscendant.

/**
 * {@inheritDoc}
 */
@Override
public void addAscendant(AdminRole childRole, AdminRole parentRole) throws SecurityException {
    String methodName = "addAscendantRole";
    VUtil.assertNotNull(parentRole, GlobalErrIds.ARLE_PARENT_NULL, CLS_NM + "." + methodName);
    VUtil.assertNotNull(childRole, GlobalErrIds.ARLE_CHILD_NULL, CLS_NM + "." + methodName);
    FortRequest request = new FortRequest();
    request.setContextId(this.contextId);
    AdminRoleRelationship relationship = new AdminRoleRelationship();
    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.ARLE_ASC);
    FortResponse response = RestUtils.unmarshall(szResponse);
    if (response.getErrorCode() != 0) {
        throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
    }
}
Also used : AdminRoleRelationship(org.apache.directory.fortress.core.model.AdminRoleRelationship) 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 AdminRoleRelationship

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

the class DelAdminMgrRestImpl method deleteInheritance.

/**
 * {@inheritDoc}
 */
@Override
public void deleteInheritance(AdminRole parentRole, AdminRole childRole) throws SecurityException {
    String methodName = "deleteInheritanceRole";
    VUtil.assertNotNull(parentRole, GlobalErrIds.ARLE_PARENT_NULL, CLS_NM + "." + methodName);
    VUtil.assertNotNull(childRole, GlobalErrIds.ARLE_CHILD_NULL, CLS_NM + "." + methodName);
    FortRequest request = new FortRequest();
    request.setContextId(this.contextId);
    AdminRoleRelationship relationship = new AdminRoleRelationship();
    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.ARLE_DELINHERIT);
    FortResponse response = RestUtils.unmarshall(szResponse);
    if (response.getErrorCode() != 0) {
        throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
    }
}
Also used : AdminRoleRelationship(org.apache.directory.fortress.core.model.AdminRoleRelationship) 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 AdminRoleRelationship

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

the class DelAdminMgrRestImpl method addInheritance.

/**
 * {@inheritDoc}
 */
@Override
public void addInheritance(AdminRole parentRole, AdminRole childRole) throws SecurityException {
    String methodName = "addInheritanceRole";
    VUtil.assertNotNull(parentRole, GlobalErrIds.ARLE_PARENT_NULL, CLS_NM + "." + methodName);
    VUtil.assertNotNull(childRole, GlobalErrIds.ARLE_CHILD_NULL, CLS_NM + "." + methodName);
    FortRequest request = new FortRequest();
    request.setContextId(this.contextId);
    AdminRoleRelationship relationship = new AdminRoleRelationship();
    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.ARLE_ADDINHERIT);
    FortResponse response = RestUtils.unmarshall(szResponse);
    if (response.getErrorCode() != 0) {
        throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
    }
}
Also used : AdminRoleRelationship(org.apache.directory.fortress.core.model.AdminRoleRelationship) 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 AdminRoleRelationship (org.apache.directory.fortress.core.model.AdminRoleRelationship)4 FortRequest (org.apache.directory.fortress.core.model.FortRequest)4 FortResponse (org.apache.directory.fortress.core.model.FortResponse)4