Class PermissionAwareCrudService<E extends PersistentObject,​D extends GenericHibernateDao<E,​Integer>>

    • Constructor Detail

      • PermissionAwareCrudService

        public PermissionAwareCrudService()
        Default constructor, which calls the type-constructor
      • PermissionAwareCrudService

        protected PermissionAwareCrudService​(Class<E> entityClass)
        Constructor that sets the concrete entity class for the service. Subclasses MUST call this constructor.
    • Method Detail

      • setDao

        @Autowired
        @Qualifier("genericDao")
        public void setDao​(D dao)
        Description copied from class: AbstractDaoService
        Subclasses must implement this class and annotate it with Autowired and Qualifier! This is necessary as there may be multiple candidates to autowire (due to hierarchy) and we have to configure the correct ones.
        Specified by:
        setDao in class AbstractDaoService<E extends PersistentObject,​D extends GenericHibernateDao<E,​Integer>>
        Parameters:
        dao - the dao to set
      • addAndSaveUserPermissions

        public void addAndSaveUserPermissions​(E entity,
                                              User user,
                                              Permission... permissions)
        This method adds (user) permissions to the passed entity and persists (!) the permission collection! If no permissions have been set before, they will be created. Otherwise the passed permissions will be added to the existing permission collection.
        Parameters:
        entity - The secured entity
        user - The user that gets permissions for the entity
        permissions - The permissions the user gets for the entity
      • removeAndSaveUserPermissions

        public void removeAndSaveUserPermissions​(E entity,
                                                 User user,
                                                 Permission... permissions)
        This method removes (user) permissions from the passed entity and persists (!) the permission collection!
        Parameters:
        entity - The secured entity
        user - The user from which the permissions for the entity will be removed
        permissions - The permissions to remove
      • addAndSaveGroupPermissions

        public void addAndSaveGroupPermissions​(E entity,
                                               UserGroup userGroup,
                                               Permission... permissions)
        This method adds (user) permissions to the passed entity and persists (!) the permission collection! If no permissions have been set before, they will be created. Otherwise the passed permissions will be added to the existing permission collection.
        Parameters:
        entity - The secured entity
        userGroup - The user group that gets permissions for the entity
        permissions - The permissions the user group gets for the entity
      • removeAndSaveGroupPermissions

        public void removeAndSaveGroupPermissions​(E entity,
                                                  UserGroup userGroup,
                                                  Permission... permissions)
        This method removes (group) permissions from the passed entity and persists (!) the permission collection!
        Parameters:
        entity - The secured entity
        userGroup - The user group from which the permissions for the entity will be removed
        permissions - The permissions to remove
      • findAllUserPermissionsOfUser

        @PreAuthorize("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(#user, \'READ\')")
        @Transactional(readOnly=true)
        public Map<PersistentObject,​PermissionCollection> findAllUserPermissionsOfUser​(User user)
        This method returns a Map that maps PersistentObjects to PermissionCollections for the passed User. I.e. the keySet of the map is the collection of all PersistentObjects where the user has at least one permission and the corresponding value contains the PermissionCollection for the passed user on the entity.
        Parameters:
        user -
        Returns:
      • findAllUserGroupPermissionsOfUserGroup

        @PreAuthorize("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(#userGroup, \'READ\')")
        @Transactional(readOnly=true)
        public Map<PersistentObject,​PermissionCollection> findAllUserGroupPermissionsOfUserGroup​(UserGroup userGroup)
        This method returns a Map that maps PersistentObjects to PermissionCollections for the passed UserGroup. I.e. the keySet of the map is the collection of all PersistentObjects where the user group has at least one permission and the corresponding value contains the PermissionCollection for the passed user group on the entity.
        Parameters:
        userGroup -
        Returns: