Interface UserRoleRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<UserRole,Long>, org.springframework.data.jpa.repository.JpaRepository<UserRole,Long>, org.springframework.data.repository.ListCrudRepository<UserRole,Long>, org.springframework.data.repository.ListPagingAndSortingRepository<UserRole,Long>, org.springframework.data.repository.PagingAndSortingRepository<UserRole,Long>, org.springframework.data.repository.query.QueryByExampleExecutor<UserRole>, org.springframework.data.repository.Repository<UserRole,Long>

public interface UserRoleRepository extends org.springframework.data.jpa.repository.JpaRepository<UserRole,Long>
Repository class to represent the data access layer of the `user_role` entity.
Author:
Infosys Equinox
  • Method Details

    • findByUserIdAndRoleName

      UserRole findByUserIdAndRoleName(Long userId, String roleName)
    • findByUserIdAndRoleNameIn

      List<UserRole> findByUserIdAndRoleNameIn(Long userId, List<String> roleName)
    • findAllByUserIdAndCollectionId

      List<UserRole> findAllByUserIdAndCollectionId(Long userId, Long collectionId)
    • findAllByRoleName

      List<UserRole> findAllByRoleName(String roleName)
    • findAll

      List<UserRole> findAll(org.springframework.data.jpa.domain.Specification<UserRole> specification)
    • findAll

      org.springframework.data.domain.Page<UserRole> findAll(org.springframework.data.jpa.domain.Specification<UserRole> specification, org.springframework.data.domain.Pageable pageRequest)
    • findAll

      List<UserRole> findAll(org.springframework.data.jpa.domain.Specification<UserRole> specification, org.springframework.data.domain.Sort sort)
    • findAllByUserIdAndBusinessId

      List<UserRole> findAllByUserIdAndBusinessId(Long userId, Long businessId)
      This method return roles of user in the business.
      Parameters:
      userId - a Long object.
      businessId - a Long object.
      Returns:
      a List of UserRole objects.
    • findAllByUserId

      List<UserRole> findAllByUserId(Long userId)
      This method return roles of user in all business.
      Parameters:
      userId - a Long object.
      Returns:
      a List of UserRole objects.
    • findAllUserRolesAndPrivilegesByUserIdAndCollectionId

      @Query(value="select p.id as privilegeid, p.entity as entity, p.service as privilegeservice, p.action as action, u_r.collection_id as collectionid , r.type as type , u_r.business_id as businessid, u_r.service_collection_id as servicecollectionid, u_r.service as roleservice, u_r.attributes as attribute, u_r.role_name as rolename, u_r.user_id as userId, u_r.account_id as accountId from ( ( user_role u_r LEFT JOIN role r on ( (u_r.business_id = r.business_id or r.business_id = 0) and (u_r.collection_id = r.collectionId or r.collectionId = 0) and u_r.role_name = r.name ) ) LEFT JOIN ( role_privilege r_p INNER JOIN privilege p on (r_p.privilege_id = p.id) ) on ( r_p.role_id = r.id ) ) where ( u_r.user_id = :userId and u_r.collection_id = :collectionId )", nativeQuery=true) List<UserRoleRepository.UserRolePrivilegeProjection> findAllUserRolesAndPrivilegesByUserIdAndCollectionId(@Param("userId") Long userId, @Param("collectionId") Long collectionId)