use of org.apache.directory.fortress.core.model.FortResponse in project directory-fortress-core by apache.
the class ReviewMgrRestImpl method findAnyPermissions.
/**
* {@inheritDoc}
*/
@Override
public List<Permission> findAnyPermissions(Permission permission) throws SecurityException {
VUtil.assertNotNull(permission, GlobalErrIds.PERM_OPERATION_NULL, CLS_NM + ".findAnyPermissions");
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_ANY);
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.FortResponse in project directory-fortress-core by apache.
the class ReviewMgrRestImpl method dsdRoleSet.
/**
* {@inheritDoc}
*/
@Override
public SDSet dsdRoleSet(SDSet set) throws SecurityException {
VUtil.assertNotNull(set, GlobalErrIds.DSD_NULL, CLS_NM + ".dsdRoleSet");
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.DSD_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.FortResponse in project directory-fortress-core by apache.
the class ReviewMgrRestImpl method authorizedPermissionRoles.
/**
* {@inheritDoc}
*/
@Override
public Set<String> authorizedPermissionRoles(Permission perm) throws SecurityException {
VUtil.assertNotNull(perm, GlobalErrIds.PERM_OPERATION_NULL, CLS_NM + ".authorizedPermissionRoles");
Set<String> retRoleNames = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setEntity(perm);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.PERM_ROLES_AUTHZED);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
Set<String> tempNames = response.getValueSet();
// This is done to use a case insensitive TreeSet for returned names.
retRoleNames.addAll(tempNames);
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retRoleNames;
}
use of org.apache.directory.fortress.core.model.FortResponse in project directory-fortress-core by apache.
the class ReviewMgrRestImpl method permissionRoles.
/**
* {@inheritDoc}
*/
@Override
public List<String> permissionRoles(Permission perm) throws SecurityException {
VUtil.assertNotNull(perm, GlobalErrIds.PERM_OBJECT_NULL, CLS_NM + ".permissionRoles");
List<String> retRoleNames;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setEntity(perm);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.PERM_ROLES);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retRoleNames = response.getValues();
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retRoleNames;
}
use of org.apache.directory.fortress.core.model.FortResponse in project directory-fortress-core by apache.
the class ReviewMgrRestImpl method readRole.
/**
* {@inheritDoc}
*/
@Override
public Role readRole(Role role) throws SecurityException {
VUtil.assertNotNull(role, GlobalErrIds.ROLE_NULL, CLS_NM + ".readRole");
Role 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.ROLE_READ);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retRole = (Role) response.getEntity();
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retRole;
}
Aggregations