Interface AclEntryPersistence

  • All Superinterfaces:
    org.springframework.data.repository.CrudRepository<AclEntry,​Long>, org.springframework.data.jpa.repository.JpaRepository<AclEntry,​Long>, org.springframework.data.repository.PagingAndSortingRepository<AclEntry,​Long>, org.springframework.data.repository.query.QueryByExampleExecutor<AclEntry>, org.springframework.data.repository.Repository<AclEntry,​Long>

    public interface AclEntryPersistence
    extends org.springframework.data.jpa.repository.JpaRepository<AclEntry,​Long>
    The Interface AclEntryPersistence.
    • Method Detail

      • findByObjectIdentity

        @Query("select ae from AclEntry ae where ae.aclObjectIdentity = :aclObjectIdentity")
        List<AclEntry> findByObjectIdentity​(@Param("aclObjectIdentity")
                                            AclObjectIdentity aclObjectIdentity)
        Find by object identity.
        Parameters:
        aclObjectIdentity - the acl object identity
        Returns:
        the list
      • findBySidAndObjectIdentity

        @Query("select ae from AclEntry ae where ae.aclSid = :aclSid and ae.aclObjectIdentity = :aclObjectIdentity")
        List<AclEntry> findBySidAndObjectIdentity​(@Param("aclSid")
                                                  AclSid sid,
                                                  @Param("aclObjectIdentity")
                                                  AclObjectIdentity objectIdentity)
        List by SID and Object Identity.
        Parameters:
        sid - - SID
        objectIdentity - the ACL object identity
        Returns:
        list of ACL entries for specified SID and OID
      • findObjectIdentitiesForSidAndAclClassAndMask

        @Query("select ae.aclObjectIdentity.objectIdIdentity from AclEntry ae where ae.aclSid=?1 and ae.aclObjectIdentity.aclClass.aclClass=?2 and ae.mask=?3 and ae.granting=true")
        List<Long> findObjectIdentitiesForSidAndAclClassAndMask​(AclSid sid,
                                                                String aclClass,
                                                                int mask)
        /** Find IDs of object of aclClass for sid with specified permissions.
        Parameters:
        sid - - SID
        aclClass - - class of domain object
        mask - - permissions
        Returns:
        - returns lists of user's permissions on domain class
      • getMaxAceOrderForObjectEntity

        @Query("select max(ae.aceOrder) from AclEntry ae join ae.aclObjectIdentity aoi where aoi.id = ?1")
        Long getMaxAceOrderForObjectEntity​(long aclObjectEntityId)
        Calculates max. ace_order for acl_object_identity to avoid DuplicateIndex exception (acl_object_identity + ace_order is unique index)
        Parameters:
        aclObjectEntityId - - id of acl_object_identity table
        Returns:
        - max. ace_order value for current objectIdentityId
      • getSids

        @Query("select distinct ae.aclSid from AclEntry ae where ae.aclObjectIdentity = :objectIdentity")
        List<AclSid> getSids​(@Param("objectIdentity")
                             AclObjectIdentity objectIdentity)
        Gets the sids.
        Parameters:
        objectIdentity - the object identity
        Returns:
        the sids
      • deleteForSid

        @Modifying
        @Query("delete from AclEntry ae where ae.aclSid = :sid")
        <T extends AclSid> int deleteForSid​(@Param("sid")
                                            T sid)
        Delete AclEntries for a SID.
        Type Parameters:
        T - type extending AclSid (User, OAuthClient)
        Parameters:
        sid - the SID
        Returns:
        number of deleted entries