Search in sources :

Example 66 with FortRequest

use of org.apache.directory.fortress.core.model.FortRequest in project directory-fortress-core by apache.

the class ReviewMgrRestImpl method findPermissions.

/**
 * {@inheritDoc}
 */
@Override
public List<Permission> findPermissions(Permission permission) throws SecurityException {
    VUtil.assertNotNull(permission, GlobalErrIds.PERM_OPERATION_NULL, CLS_NM + ".findPermissions");
    List<Permission> retPerms;
    FortRequest request = new FortRequest();
    request.setContextId(this.contextId);
    request.setEntity(permission);
    if (this.adminSess != null) {
        request.setSession(adminSess);
    }
    String szRequest = RestUtils.marshal(request);
    String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.PERM_SEARCH);
    FortResponse response = RestUtils.unmarshall(szResponse);
    if (response.getErrorCode() == 0) {
        retPerms = response.getEntities();
    } else {
        throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
    }
    return retPerms;
}
Also used : Permission(org.apache.directory.fortress.core.model.Permission) FortResponse(org.apache.directory.fortress.core.model.FortResponse) SecurityException(org.apache.directory.fortress.core.SecurityException) FortRequest(org.apache.directory.fortress.core.model.FortRequest)

Example 67 with FortRequest

use of org.apache.directory.fortress.core.model.FortRequest in project directory-fortress-core by apache.

the class ReviewMgrRestImpl method ssdRoleSet.

/**
 * {@inheritDoc}
 */
@Override
public SDSet ssdRoleSet(SDSet set) throws SecurityException {
    VUtil.assertNotNull(set, GlobalErrIds.SSD_NULL, CLS_NM + ".ssdRoleSet");
    SDSet retSet;
    FortRequest request = new FortRequest();
    request.setContextId(this.contextId);
    request.setEntity(set);
    if (this.adminSess != null) {
        request.setSession(adminSess);
    }
    String szRequest = RestUtils.marshal(request);
    String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.SSD_READ);
    FortResponse response = RestUtils.unmarshall(szResponse);
    if (response.getErrorCode() == 0) {
        retSet = (SDSet) response.getEntity();
    } else {
        throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
    }
    return retSet;
}
Also used : SDSet(org.apache.directory.fortress.core.model.SDSet) FortResponse(org.apache.directory.fortress.core.model.FortResponse) SecurityException(org.apache.directory.fortress.core.SecurityException) FortRequest(org.apache.directory.fortress.core.model.FortRequest)

Example 68 with FortRequest

use of org.apache.directory.fortress.core.model.FortRequest in project directory-fortress-core by apache.

the class ReviewMgrRestImpl method rolePermissionAttributeSets.

/**
 * {@inheritDoc}
 */
@Override
public List<PermissionAttributeSet> rolePermissionAttributeSets(Role role, boolean noInhertiance) throws SecurityException {
    VUtil.assertNotNull(role, GlobalErrIds.ROLE_NULL, CLS_NM + ".rolePermissionAttributeSets");
    List<PermissionAttributeSet> retAttrSets;
    FortRequest request = new FortRequest();
    request.setContextId(this.contextId);
    request.setEntity(role);
    request.setIsFlag(noInhertiance);
    if (this.adminSess != null) {
        request.setSession(adminSess);
    }
    String szRequest = RestUtils.marshal(request);
    String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.ROLE_PERM_ATTR_SETS);
    FortResponse response = RestUtils.unmarshall(szResponse);
    if (response.getErrorCode() == 0) {
        retAttrSets = response.getEntities();
    } else {
        throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
    }
    return retAttrSets;
}
Also used : PermissionAttributeSet(org.apache.directory.fortress.core.model.PermissionAttributeSet) FortResponse(org.apache.directory.fortress.core.model.FortResponse) SecurityException(org.apache.directory.fortress.core.SecurityException) FortRequest(org.apache.directory.fortress.core.model.FortRequest)

Example 69 with FortRequest

use of org.apache.directory.fortress.core.model.FortRequest in project directory-fortress-core by apache.

the class ReviewMgrRestImpl method readPermission.

/**
 * {@inheritDoc}
 */
@Override
public Permission readPermission(Permission permission) throws SecurityException {
    VUtil.assertNotNull(permission, GlobalErrIds.PERM_OPERATION_NULL, CLS_NM + ".readPermission");
    Permission retPerm;
    FortRequest request = new FortRequest();
    request.setContextId(this.contextId);
    request.setEntity(permission);
    if (this.adminSess != null) {
        request.setSession(adminSess);
    }
    String szRequest = RestUtils.marshal(request);
    String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.PERM_READ);
    FortResponse response = RestUtils.unmarshall(szResponse);
    if (response.getErrorCode() == 0) {
        retPerm = (Permission) response.getEntity();
    } else {
        throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
    }
    return retPerm;
}
Also used : Permission(org.apache.directory.fortress.core.model.Permission) FortResponse(org.apache.directory.fortress.core.model.FortResponse) SecurityException(org.apache.directory.fortress.core.SecurityException) FortRequest(org.apache.directory.fortress.core.model.FortRequest)

Example 70 with FortRequest

use of org.apache.directory.fortress.core.model.FortRequest in project directory-fortress-core by apache.

the class ReviewMgrRestImpl method ssdRoleSetCardinality.

/**
 * {@inheritDoc}
 */
@Override
public int ssdRoleSetCardinality(SDSet ssd) throws SecurityException {
    VUtil.assertNotNull(ssd, GlobalErrIds.SSD_NULL, CLS_NM + ".ssdRoleSetCardinality");
    SDSet retSet;
    FortRequest request = new FortRequest();
    request.setContextId(this.contextId);
    request.setEntity(ssd);
    if (this.adminSess != null) {
        request.setSession(adminSess);
    }
    String szRequest = RestUtils.marshal(request);
    String szResponse = RestUtils.getInstance().post(szRequest, HttpIds.SSD_CARD);
    FortResponse response = RestUtils.unmarshall(szResponse);
    if (response.getErrorCode() == 0) {
        retSet = (SDSet) response.getEntity();
    } else {
        throw new SecurityException(response.getErrorCode(), response.getErrorMessage());
    }
    return retSet.getCardinality();
}
Also used : SDSet(org.apache.directory.fortress.core.model.SDSet) FortResponse(org.apache.directory.fortress.core.model.FortResponse) SecurityException(org.apache.directory.fortress.core.SecurityException) FortRequest(org.apache.directory.fortress.core.model.FortRequest)

Aggregations

FortRequest (org.apache.directory.fortress.core.model.FortRequest)153 SecurityException (org.apache.directory.fortress.core.SecurityException)152 FortResponse (org.apache.directory.fortress.core.model.FortResponse)152 SDSet (org.apache.directory.fortress.core.model.SDSet)20 Permission (org.apache.directory.fortress.core.model.Permission)11 Session (org.apache.directory.fortress.core.model.Session)10 PermGrant (org.apache.directory.fortress.core.model.PermGrant)8 User (org.apache.directory.fortress.core.model.User)8 UserRole (org.apache.directory.fortress.core.model.UserRole)8 Group (org.apache.directory.fortress.core.model.Group)7 PermObj (org.apache.directory.fortress.core.model.PermObj)7 TreeSet (java.util.TreeSet)6 UserAdminRole (org.apache.directory.fortress.core.model.UserAdminRole)6 OrgUnit (org.apache.directory.fortress.core.model.OrgUnit)5 AdminRole (org.apache.directory.fortress.core.model.AdminRole)4 AdminRoleRelationship (org.apache.directory.fortress.core.model.AdminRoleRelationship)4 OrgUnitRelationship (org.apache.directory.fortress.core.model.OrgUnitRelationship)4 Props (org.apache.directory.fortress.core.model.Props)4 Role (org.apache.directory.fortress.core.model.Role)4 RoleRelationship (org.apache.directory.fortress.core.model.RoleRelationship)4