use of org.apache.directory.fortress.core.model.FortRequest in project directory-fortress-core by apache.
the class PwPolicyMgrRestImpl method delete.
/**
* {@inheritDoc}
*/
@Override
public void delete(PwPolicy policy) throws SecurityException {
VUtil.assertNotNull(policy, GlobalErrIds.PSWD_NAME_NULL, CLS_NM + ".delete");
FortRequest request = RestUtils.getRequest(this.contextId);
request.setEntity(policy);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.PSWD_DELETE);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() != 0) {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
}
use of org.apache.directory.fortress.core.model.FortRequest in project directory-fortress-core by apache.
the class PwPolicyMgrRestImpl method update.
/**
* {@inheritDoc}
*/
@Override
public void update(PwPolicy policy) throws SecurityException {
VUtil.assertNotNull(policy, GlobalErrIds.PSWD_PLCY_NULL, CLS_NM + ".update");
FortRequest request = RestUtils.getRequest(this.contextId);
request.setEntity(policy);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.PSWD_UPDATE);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() != 0) {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
}
use of org.apache.directory.fortress.core.model.FortRequest in project directory-fortress-core by apache.
the class RestUtils method getRequest.
/**
* create a new request and set its tenant id.
* @param szContextId contains the tenant id
* @return a brand new FortRequest
*/
static FortRequest getRequest(String szContextId) {
FortRequest request = new FortRequest();
request.setContextId(szContextId);
return request;
}
use of org.apache.directory.fortress.core.model.FortRequest 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);
if (this.adminSess != null) {
request.setSession(adminSess);
}
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;
}
use of org.apache.directory.fortress.core.model.FortRequest 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);
if (this.adminSess != null) {
request.setSession(adminSess);
}
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;
}
Aggregations