use of org.apache.directory.fortress.core.model.FortRequest in project directory-fortress-core by apache.
the class DelAdminMgrRestImpl method add.
/**
* {@inheritDoc}
*/
@Override
public OrgUnit add(OrgUnit entity) throws SecurityException {
VUtil.assertNotNull(entity, GlobalErrIds.ORG_NULL, CLS_NM + ".addOU");
OrgUnit retOrg;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setEntity(entity);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.ORG_ADD);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retOrg = (OrgUnit) response.getEntity();
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retOrg;
}
use of org.apache.directory.fortress.core.model.FortRequest in project directory-fortress-core by apache.
the class DelAdminMgrRestImpl method deletePermObj.
/**
* {@inheritDoc}
*/
@Override
public void deletePermObj(PermObj pObj) throws SecurityException {
VUtil.assertNotNull(pObj, GlobalErrIds.PERM_OBJECT_NULL, CLS_NM + ".deletePermObj");
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
pObj.setAdmin(true);
request.setEntity(pObj);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.OBJ_DELETE);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() != 0) {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
}
use of org.apache.directory.fortress.core.model.FortRequest in project directory-fortress-core by apache.
the class DelReviewMgrRestImpl method readRole.
/**
* {@inheritDoc}
*/
@Override
public AdminRole readRole(AdminRole role) throws SecurityException {
VUtil.assertNotNull(role, GlobalErrIds.ARLE_NULL, CLS_NM + ".readRole");
AdminRole retRole;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setEntity(role);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.ARLE_READ);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retRole = (AdminRole) response.getEntity();
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retRole;
}
use of org.apache.directory.fortress.core.model.FortRequest in project directory-fortress-core by apache.
the class DelReviewMgrRestImpl method findRoles.
/**
* {@inheritDoc}
*/
@Override
public List<AdminRole> findRoles(String searchVal) throws SecurityException {
VUtil.assertNotNull(searchVal, GlobalErrIds.ARLE_NM_NULL, CLS_NM + ".findRoles");
List<AdminRole> retRoles;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setValue(searchVal);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.ARLE_SEARCH);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retRoles = response.getEntities();
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retRoles;
}
use of org.apache.directory.fortress.core.model.FortRequest in project directory-fortress-core by apache.
the class DelReviewMgrRestImpl method assignedRoles.
/**
* {@inheritDoc}
*/
@Override
public List<UserAdminRole> assignedRoles(User user) throws SecurityException {
VUtil.assertNotNull(user, GlobalErrIds.USER_NULL, CLS_NM + ".assignedRoles");
List<UserAdminRole> retUserRoles;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setEntity(user);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.ARLE_ASGNED);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retUserRoles = response.getEntities();
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retUserRoles;
}
Aggregations