use of org.apache.directory.fortress.core.model.FortResponse in project directory-fortress-core by apache.
the class ReviewMgrRestImpl method findUsers.
/**
* {@inheritDoc}
*/
@Override
public List<User> findUsers(OrgUnit ou) throws SecurityException {
VUtil.assertNotNull(ou, GlobalErrIds.ORG_NULL_USER, CLS_NM + ".findUsers");
List<User> retUsers;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
User inUser = new User();
inUser.setOu(ou.getName());
request.setEntity(inUser);
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;
}
use of org.apache.directory.fortress.core.model.FortResponse in project directory-fortress-core by apache.
the class ReviewMgrRestImpl method dsdRoleSetRoles.
/**
* {@inheritDoc}
*/
@Override
public Set<String> dsdRoleSetRoles(SDSet dsd) throws SecurityException {
VUtil.assertNotNull(dsd, GlobalErrIds.SSD_NULL, CLS_NM + ".dsdRoleSetRoles");
Set<String> retRoleNames = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setEntity(dsd);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.DSD_ROLES);
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 dsdSets.
/**
* {@inheritDoc}
*/
public List<SDSet> dsdSets(SDSet dsd) throws SecurityException {
VUtil.assertNotNull(dsd, GlobalErrIds.ROLE_NULL, CLS_NM + ".dsdSets");
List<SDSet> retDsdSets;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setEntity(dsd);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.DSD_SETS);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retDsdSets = response.getEntities();
if (retDsdSets == null) {
retDsdSets = new ArrayList<>();
}
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retDsdSets;
}
use of org.apache.directory.fortress.core.model.FortResponse in project directory-fortress-core by apache.
the class AuditMgrRestImpl method searchInvalidUsers.
/**
* {@inheritDoc}
*/
@Override
public List<AuthZ> searchInvalidUsers(UserAudit uAudit) throws SecurityException {
VUtil.assertNotNull(uAudit, GlobalErrIds.AUDT_INPUT_NULL, CLS_NM + ".searchInvalidUsers");
List<AuthZ> outRecords;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setEntity(uAudit);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.AUDIT_INVLD);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
outRecords = response.getEntities();
// do not return a null list to the caller:
if (outRecords == null) {
outRecords = new ArrayList<>();
}
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return outRecords;
}
use of org.apache.directory.fortress.core.model.FortResponse in project directory-fortress-core by apache.
the class AuditMgrRestImpl method searchUserSessions.
/**
* {@inheritDoc}
*/
@Override
public List<Mod> searchUserSessions(UserAudit uAudit) throws SecurityException {
VUtil.assertNotNull(uAudit, GlobalErrIds.AUDT_INPUT_NULL, CLS_NM + ".searchUserSessions");
List<Mod> outRecords;
FortRequest request = new FortRequest();
request.setContextId(this.contextId);
request.setEntity(uAudit);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.AUDIT_SESSIONS);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
outRecords = response.getEntities();
// do not return a null list to the caller:
if (outRecords == null) {
outRecords = new ArrayList<>();
}
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return outRecords;
}
Aggregations