Search in sources :

Example 1 with CreateListPermissionException

use of net.geoprism.registry.roles.CreateListPermissionException in project geoprism-registry by terraframe.

the class ListType method enforceActorHasPermission.

public void enforceActorHasPermission(Operation op) {
    if (!doesActorHaveWritePermission()) {
        if (op.equals(Operation.CREATE)) {
            CreateListPermissionException ex = new CreateListPermissionException();
            ex.setOrganization(this.getOrganization().getDisplayLabel().getValue());
            throw ex;
        } else if (op.equals(Operation.WRITE)) {
            UpdateListPermissionException ex = new UpdateListPermissionException();
            ex.setOrganization(this.getOrganization().getDisplayLabel().getValue());
            throw ex;
        }
    }
}
Also used : UpdateListPermissionException(net.geoprism.registry.roles.UpdateListPermissionException) CreateListPermissionException(net.geoprism.registry.roles.CreateListPermissionException)

Example 2 with CreateListPermissionException

use of net.geoprism.registry.roles.CreateListPermissionException in project geoprism-registry by terraframe.

the class MasterList method enforceActorHasPermission.

public void enforceActorHasPermission(Operation op) {
    if (!doesActorHaveWritePermission()) {
        if (op.equals(Operation.CREATE)) {
            CreateListPermissionException ex = new CreateListPermissionException();
            ex.setOrganization(this.getOrganization().getDisplayLabel().getValue());
            throw ex;
        } else if (op.equals(Operation.WRITE)) {
            UpdateListPermissionException ex = new UpdateListPermissionException();
            ex.setOrganization(this.getOrganization().getDisplayLabel().getValue());
            throw ex;
        }
    }
}
Also used : UpdateListPermissionException(net.geoprism.registry.roles.UpdateListPermissionException) CreateListPermissionException(net.geoprism.registry.roles.CreateListPermissionException)

Example 3 with CreateListPermissionException

use of net.geoprism.registry.roles.CreateListPermissionException in project geoprism-registry by terraframe.

the class ListTypeService method enforceWritePermissions.

private void enforceWritePermissions(ListType listType) {
    ServerGeoObjectType geoObjectType = listType.getGeoObjectType();
    Organization organization = geoObjectType.getOrganization();
    if (!ServiceFactory.getGeoObjectPermissionService().canWrite(organization.getCode(), geoObjectType)) {
        CreateListPermissionException ex = new CreateListPermissionException();
        ex.setOrganization(organization.getDisplayLabel().getValue());
        throw ex;
    }
}
Also used : Organization(net.geoprism.registry.Organization) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) CreateListPermissionException(net.geoprism.registry.roles.CreateListPermissionException)

Example 4 with CreateListPermissionException

use of net.geoprism.registry.roles.CreateListPermissionException in project geoprism-registry by terraframe.

the class ListTypeService method enforceReadPermissions.

private void enforceReadPermissions(ListType listType) {
    ServerGeoObjectType geoObjectType = listType.getGeoObjectType();
    Organization organization = geoObjectType.getOrganization();
    if (!ServiceFactory.getGeoObjectPermissionService().canRead(organization.getCode(), geoObjectType)) {
        CreateListPermissionException ex = new CreateListPermissionException();
        ex.setOrganization(organization.getDisplayLabel().getValue());
        throw ex;
    }
}
Also used : Organization(net.geoprism.registry.Organization) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) CreateListPermissionException(net.geoprism.registry.roles.CreateListPermissionException)

Aggregations

CreateListPermissionException (net.geoprism.registry.roles.CreateListPermissionException)4 Organization (net.geoprism.registry.Organization)2 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)2 UpdateListPermissionException (net.geoprism.registry.roles.UpdateListPermissionException)2