use of org.apache.directory.fortress.core.model.FortRequest in project directory-fortress-core by apache.
the class ReviewMgrRestImpl method dsdRoleSetCardinality.
/**
* {@inheritDoc}
*/
@Override
public int dsdRoleSetCardinality(SDSet dsd) throws SecurityException {
VUtil.assertNotNull(dsd, GlobalErrIds.DSD_NULL, CLS_NM + ".dsdRoleSetCardinality");
SDSet retSet;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setEntity(dsd);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.DSD_CARD);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retSet = (SDSet) response.getEntity();
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retSet.getCardinality();
}
use of org.apache.directory.fortress.core.model.FortRequest in project directory-fortress-core by apache.
the class ReviewMgrRestImpl method userPermissions.
/**
* {@inheritDoc}
*/
@Override
public List<Permission> userPermissions(User user) throws SecurityException {
VUtil.assertNotNull(user, GlobalErrIds.USER_NULL, CLS_NM + ".userPermissions");
List<Permission> retPerms;
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.USER_PERMS);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retPerms = response.getEntities();
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retPerms;
}
use of org.apache.directory.fortress.core.model.FortRequest in project directory-fortress-core by apache.
the class ReviewMgrRestImpl method findPermObjs.
/**
* {@inheritDoc}
*/
@Override
public List<PermObj> findPermObjs(OrgUnit ou) throws SecurityException {
VUtil.assertNotNull(ou, GlobalErrIds.ORG_NULL_PERM, CLS_NM + ".findPermObjs");
List<PermObj> retObjs;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
PermObj inObj = new PermObj();
inObj.setOu(ou.getName());
request.setEntity(inObj);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.OBJ_SEARCH);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retObjs = response.getEntities();
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retObjs;
}
use of org.apache.directory.fortress.core.model.FortRequest in project directory-fortress-core by apache.
the class ReviewMgrRestImpl method findRoles.
/**
* {@inheritDoc}
*/
@Override
public List<Role> findRoles(String searchVal) throws SecurityException {
VUtil.assertNotNull(searchVal, GlobalErrIds.ROLE_NM_NULL, CLS_NM + ".findRoles");
List<Role> 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.ROLE_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 ReviewMgrRestImpl method ssdSets.
/**
* {@inheritDoc}
*/
public List<SDSet> ssdSets(SDSet ssd) throws SecurityException {
VUtil.assertNotNull(ssd, GlobalErrIds.ROLE_NULL, CLS_NM + ".ssdSets");
List<SDSet> retSsdSets;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setEntity(ssd);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.SSD_SETS);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retSsdSets = response.getEntities();
if (retSsdSets == null) {
retSsdSets = new ArrayList<>();
}
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retSsdSets;
}
Aggregations