use of org.apache.directory.fortress.core.model.FortRequest in project directory-fortress-core by apache.
the class ReviewMgrRestImpl method findPermissions.
/**
* {@inheritDoc}
*/
@Override
public List<Permission> findPermissions(Permission permission) throws SecurityException {
VUtil.assertNotNull(permission, GlobalErrIds.PERM_OPERATION_NULL, CLS_NM + ".findPermissions");
List<Permission> retPerms;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setEntity(permission);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.PERM_SEARCH);
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 ssdRoleSet.
/**
* {@inheritDoc}
*/
@Override
public SDSet ssdRoleSet(SDSet set) throws SecurityException {
VUtil.assertNotNull(set, GlobalErrIds.SSD_NULL, CLS_NM + ".ssdRoleSet");
SDSet retSet;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setEntity(set);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.SSD_READ);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retSet = (SDSet) response.getEntity();
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retSet;
}
use of org.apache.directory.fortress.core.model.FortRequest in project directory-fortress-core by apache.
the class ReviewMgrRestImpl method rolePermissionAttributeSets.
/**
* {@inheritDoc}
*/
@Override
public List<PermissionAttributeSet> rolePermissionAttributeSets(Role role, boolean noInhertiance) throws SecurityException {
VUtil.assertNotNull(role, GlobalErrIds.ROLE_NULL, CLS_NM + ".rolePermissionAttributeSets");
List<PermissionAttributeSet> retAttrSets;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setEntity(role);
request.setIsFlag(noInhertiance);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.ROLE_PERM_ATTR_SETS);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retAttrSets = response.getEntities();
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retAttrSets;
}
use of org.apache.directory.fortress.core.model.FortRequest in project directory-fortress-core by apache.
the class ReviewMgrRestImpl method readPermission.
/**
* {@inheritDoc}
*/
@Override
public Permission readPermission(Permission permission) throws SecurityException {
VUtil.assertNotNull(permission, GlobalErrIds.PERM_OPERATION_NULL, CLS_NM + ".readPermission");
Permission retPerm;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setEntity(permission);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.PERM_READ);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retPerm = (Permission) response.getEntity();
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retPerm;
}
use of org.apache.directory.fortress.core.model.FortRequest in project directory-fortress-core by apache.
the class ReviewMgrRestImpl method ssdRoleSetCardinality.
/**
* {@inheritDoc}
*/
@Override
public int ssdRoleSetCardinality(SDSet ssd) throws SecurityException {
VUtil.assertNotNull(ssd, GlobalErrIds.SSD_NULL, CLS_NM + ".ssdRoleSetCardinality");
SDSet retSet;
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_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();
}
Aggregations