use of org.apache.directory.fortress.core.model.FortRequest in project directory-fortress-core by apache.
the class AdminMgrRestImpl method removePermissionAttributeFromSet.
/**
* {@inheritDoc}
*/
@Override
public void removePermissionAttributeFromSet(PermissionAttribute permAttribute, String attributeSetName) throws SecurityException {
VUtil.assertNotNull(permAttribute, GlobalErrIds.PERM_ATTRIBUTE_SET_NULL, CLS_NM + ".removePermissionAttributeFromSet");
VUtil.assertNotNull(attributeSetName, GlobalErrIds.PERM_ATTRIBUTE_SET_NM_NULL, CLS_NM + ".removePermissionAttributeFromSet");
FortRequest request = RestUtils.getRequest(this.contextId);
request.setEntity(permAttribute);
request.setValue(attributeSetName);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.PERM_DELETE_PERM_ATTRIBUTE_TO_SET);
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 AdminMgrRestImpl method deleteDsdRoleMember.
/**
* {@inheritDoc}
*/
@Override
public SDSet deleteDsdRoleMember(SDSet dsdSet, Role role) throws SecurityException {
VUtil.assertNotNull(dsdSet, GlobalErrIds.SSD_NULL, CLS_NM + ".deleteDsdRoleMember");
VUtil.assertNotNull(role, GlobalErrIds.ROLE_NULL, CLS_NM + ".deleteSsdRoleMember");
SDSet retSet;
FortRequest request = RestUtils.getRequest(this.contextId);
request.setEntity(dsdSet);
request.setValue(role.getName());
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.DSD_DEL_MEMBER);
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.FortRequest in project directory-fortress-core by apache.
the class AdminMgrRestImpl method createSsdSet.
/**
* {@inheritDoc}
*/
@Override
public SDSet createSsdSet(SDSet ssdSet) throws SecurityException {
VUtil.assertNotNull(ssdSet, GlobalErrIds.SSD_NULL, CLS_NM + ".createSsdSet");
SDSet retSet;
FortRequest request = RestUtils.getRequest(this.contextId);
request.setEntity(ssdSet);
if (this.adminSess != null) {
request.setSession(adminSess);
}
String szRequest = RestUtils.marshal(request);
String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.SSD_ADD);
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.FortRequest in project directory-fortress-core by apache.
the class AdminMgrRestImpl method disableUser.
/**
* {@inheritDoc}
*/
@Override
public void disableUser(User user) throws SecurityException {
VUtil.assertNotNull(user, GlobalErrIds.USER_NULL, CLS_NM + ".disableUser");
FortRequest request = RestUtils.getRequest(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_DISABLE);
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 AdminMgrRestImpl method updateRole.
/**
* {@inheritDoc}
*/
@Override
public Role updateRole(Role role) throws SecurityException {
VUtil.assertNotNull(role, GlobalErrIds.ROLE_NULL, CLS_NM + ".updateRole");
Role retRole;
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.ROLE_UPDATE);
FortResponse response = RestUtils.unmarshall(szResponse);
if (response.getErrorCode() == 0) {
retRole = (Role) response.getEntity();
} else {
throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
}
return retRole;
}
Aggregations