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());
}
}
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());
}
}
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());
}
}
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());
}
}
Aggregations