@Override
    public boolean canEdit(ProjectEntity entity, SecurityService securityService) {
        switch (entity.getProjectEntityType()) {
            case BUILD:
                return securityService.isProjectFunctionGranted(entity, BuildCreate.class);
            case PROMOTION_RUN:
                return securityService.isProjectFunctionGranted(entity, PromotionRunCreate.class);
            case VALIDATION_RUN:
                return securityService.isProjectFunctionGranted(entity, ValidationRunCreate.class);
            default:
                throw new PropertyUnsupportedEntityTypeException(getClass().getName(), entity.getProjectEntityType());
        }
    }
@ Override public boolean canEdit ( ProjectEntity entity , SecurityService securityService ) { switch ( entity . getProjectEntityType ( ) ) { case BUILD : return securityService . isProjectFunctionGranted ( entity , BuildCreate . class ) ; case PROMOTION_RUN : return securityService . isProjectFunctionGranted ( entity , PromotionRunCreate . class ) ; case VALIDATION_RUN : return securityService . isProjectFunctionGranted ( entity , ValidationRunCreate . class ) ; default : throw new PropertyUnsupportedEntityTypeException ( getClass ( ) . getName ( ) , entity . getProjectEntityType ( ) ) ; } }
Depends on the nature of the entity. Allowed to the ones who can create the associated entity.