use of org.apache.directory.fortress.core.SecurityException 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;
}
use of org.apache.directory.fortress.core.SecurityException in project directory-fortress-core by apache.
the class DelReviewMgrRestImpl method assignedUsers.
/**
* {@inheritDoc}
*/
@Override
public List<User> assignedUsers(AdminRole role) throws SecurityException {
VUtil.assertNotNull(role, GlobalErrIds.ARLE_NULL, CLS_NM + ".assignedUsers");
List<User> retUsers;
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.USER_ASGNED_ADMIN);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retUsers = response.getEntities();
// do not return a null list to the caller:
if (retUsers == null) {
retUsers = new ArrayList<>();
}
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retUsers;
}
use of org.apache.directory.fortress.core.SecurityException in project directory-fortress-core by apache.
the class GroupMgrRestImpl method read.
/**
* {@inheritDoc}
*/
@Override
public Group read(Group group) throws SecurityException {
VUtil.assertNotNull(group, GlobalErrIds.GROUP_NULL, CLS_NM + ".read");
Group retGroup;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setEntity(group);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.GROUP_READ);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retGroup = (Group) response.getEntity();
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retGroup;
}
use of org.apache.directory.fortress.core.SecurityException in project directory-fortress-core by apache.
the class GroupMgrRestImpl method add.
/**
* {@inheritDoc}
*/
@Override
public Group add(Group group) throws SecurityException {
VUtil.assertNotNull(group, GlobalErrIds.GROUP_NULL, CLS_NM + ".add");
Group retGroup;
FortRequest request = RestUtils.getRequest(this.contextId);
request.setEntity(group);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.GROUP_ADD);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retGroup = (Group) response.getEntity();
} else {
throw new org.apache.directory.fortress.core.SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retGroup;
}
use of org.apache.directory.fortress.core.SecurityException in project directory-fortress-core by apache.
the class GroupMgrRestImpl method roleGroups.
/**
* {@inheritDoc}
*/
@Override
public List<Group> roleGroups(Role role) throws SecurityException {
VUtil.assertNotNull(role, GlobalErrIds.ROLE_NULL, CLS_NM + ".roleGroups");
List<Group> retGroups;
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.GROUP_ASGNED);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retGroups = response.getEntities();
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retGroups;
}
Aggregations