use of org.apache.directory.fortress.core.model.User in project directory-fortress-core by apache.
the class ReviewMgrRestImpl method readUser.
/**
* {@inheritDoc}
*/
@Override
public final User readUser(User user) throws SecurityException {
VUtil.assertNotNull(user, GlobalErrIds.USER_NULL, CLS_NM + ".readUser");
User retUser;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setEntity(user);
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.USER_READ);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retUser = (User) response.getEntity();
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retUser;
}
use of org.apache.directory.fortress.core.model.User in project directory-fortress-core by apache.
the class ReviewMgrRestImpl method findUsers.
/**
* {@inheritDoc}
*/
@Override
public final List<User> findUsers(User user) throws SecurityException {
VUtil.assertNotNull(user, GlobalErrIds.USER_NULL, CLS_NM + ".findUsers");
List<User> retUsers;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setEntity(user);
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.USER_SEARCH);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retUsers = response.getEntities();
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retUsers;
}
use of org.apache.directory.fortress.core.model.User in project directory-fortress-core by apache.
the class ReviewMgrRestImpl method authorizedUsers.
/**
* {@inheritDoc}
*/
@Override
public List<User> authorizedUsers(Role role) throws SecurityException {
VUtil.assertNotNull(role, GlobalErrIds.ROLE_NULL, CLS_NM + ".authorizedUsers");
List<User> retUsers;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setEntity(role);
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.USER_AUTHZED);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retUsers = response.getEntities();
if (retUsers == null) {
retUsers = new ArrayList<>();
}
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retUsers;
}
use of org.apache.directory.fortress.core.model.User in project directory-fortress-core by apache.
the class ReviewMgrRestImpl method assignedUsers.
@Override
public List<User> assignedUsers(Role role, RoleConstraint roleConstraint) throws SecurityException {
VUtil.assertNotNull(role, GlobalErrIds.ROLE_NULL, CLS_NM + ".assignedUsers");
VUtil.assertNotNull(roleConstraint, GlobalErrIds.ROLE_CONSTRAINT_NULL, CLS_NM + ".assignedUsers");
List<User> users;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setEntity(role);
request.setEntity2(roleConstraint);
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.USER_ASGNED_CONSTRAINTS);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
users = response.getEntities();
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return users;
}
use of org.apache.directory.fortress.core.model.User in project directory-fortress-core by apache.
the class ReviewMgrRestImpl method assignedUsers.
/**
* {@inheritDoc}
*/
@Override
public List<User> assignedUsers(Role role) throws SecurityException {
VUtil.assertNotNull(role, GlobalErrIds.ROLE_NULL, CLS_NM + ".assignedUsers");
List<User> retUsers;
FortRequest request = RestUtils.getRequest(this.contextId);
request.setEntity(role);
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.USER_ASGNED);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retUsers = response.getEntities();
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retUsers;
}
Aggregations