Package com.skava.auth.repository
Interface RoleRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<Role,
,Long> org.springframework.data.jpa.repository.JpaRepository<Role,
,Long> org.springframework.data.repository.ListCrudRepository<Role,
,Long> org.springframework.data.repository.ListPagingAndSortingRepository<Role,
,Long> org.springframework.data.repository.PagingAndSortingRepository<Role,
,Long> org.springframework.data.repository.query.QueryByExampleExecutor<Role>
,org.springframework.data.querydsl.QuerydslPredicateExecutor<Role>
,org.springframework.data.repository.Repository<Role,
Long>
public interface RoleRepository
extends org.springframework.data.jpa.repository.JpaRepository<Role,Long>, org.springframework.data.querydsl.QuerydslPredicateExecutor<Role>
Repository class to represent the data access layer of the `role` entity.
- Author:
- Infosys Equinox
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
BusinessLevelRoleNamesProjection interface.static interface
RoleBusinessIdProjection interface.static interface
SSOPrivilege interface.static interface
UserRoleProjection interface. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.data.domain.Page<Role>
findAll
(org.springframework.data.jpa.domain.Specification<Role> getAllCollectionSpec, org.springframework.data.domain.Pageable pageRequest) findAllBusinessRolesByUserIdAndCollectionId
(Long userId, Long collectionId) Find by user id and collection id and get all roles including business id.findAllRolesByUserIdAndCollectionId
(List<Long> userId, Long collectionId) findBusinessRolesByUserIdAndCollectionId
(Long userId, Long collectionId) Find by user id and collection id and get all roles including business id.findByNameAndBusinessIdInAndCollectionIdIn
(String roleName, List<Long> businessIds, List<Long> collectionIds) findByNameAndCollectionIdIn
(String roleName, List<Long> collectionId) findByNameIn
(List<String> roleNames) Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save
Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlush
Methods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAll
Methods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAll
Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAll
Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
Methods inherited from interface org.springframework.data.querydsl.QuerydslPredicateExecutor
count, exists, findAll, findAll, findAll, findAll, findAll, findBy, findOne
-
Method Details
-
findAllBusinessLevelUserRolesByUserId
@Query(value="select r_u.business_id as businessid, r_u.role_name as rolenames from user_role r_u where r_u.user_id = ?1", nativeQuery=true) List<RoleRepository.BusinessLevelRoleNamesProjection> findAllBusinessLevelUserRolesByUserId(Long userId) -
findAllBusinessLevelGroupRolesByUserId
@Query(value="select c.businessid as businessid, r.name as rolenames from collection c, role r, authgroup_role ag_r, authgroup_userids ag_u where c.id = r.collectionid and r.id = ag_r.roles_id and ag_u.userids = ?1", nativeQuery=true) List<RoleRepository.BusinessLevelRoleNamesProjection> findAllBusinessLevelGroupRolesByUserId(Long userId) -
findAllRolesByUserIdAndCollectionId
@Query(value="select p.id as privilegeid, p.entity as entity,p.service as service, p.action as action, r.id as roleid, r.collectionId as collectionid , c.businessId as businessId, r.name as name, r.description as description, r.category as category, r_us.userids as userid, r.createdBy as createdBy,r.updatedBy as updatedBy,r.createdTIMESTAMP as createdTimestamp,r.updatedTIMESTAMP as updatedTimestamp from (role r INNER JOIN collection c on c.id = r.collectionid and c.id in :collectionId) LEFT JOIN (user_role as r_us) on r_us.role_id = r.id LEFT JOIN (role_privilegeset r_ps INNER JOIN privilegeset_privilege ps_p INNER JOIN privilege p) on r_us.userids in :userId and r.collectionid in :collectionId and r_ps.role_id = r_us.role_id and ps_p.privilegeset_id = r_ps.privilegesets_id and ps_p.privileges_id = p.id", nativeQuery=true) List<RoleRepository.UserRoleProjection> findAllRolesByUserIdAndCollectionId(@Param("userId") List<Long> userId, @Param("collectionId") Long collectionId) -
findAllBusinessRolesByUserIdAndCollectionId
@Query(value="select r.id as roleid, r.collectionId as collectionid , c.businessId as businessId, r.name as name, r.description as description, r.category as category,r.createdBy as createdBy,r.updatedBy as updatedBy,r.createdTIMESTAMP as createdTimestamp,r.updatedTIMESTAMP as updatedTimestamp from role r,collection c,user_role r_us where c.id = r.collectionid and r_us.role_id = r.id and r_us.userids = :userId and r.collectionid=:collectionId", nativeQuery=true) List<RoleRepository.RoleBusinessIdProjection> findAllBusinessRolesByUserIdAndCollectionId(@Param("userId") Long userId, @Param("collectionId") Long collectionId) Find by user id and collection id and get all roles including business id.- Parameters:
userId
- - The user idcollectionId
- - The collection id- Returns:
- The list of RoleBusinessIdProjection object.
-
findBusinessRolesByUserIdAndCollectionId
@Query(value="select r.id as roleid, r.collectionId as collectionid , c.businessId as businessId, r.name as name, r.description as description,r.createdBy as createdBy,r.updatedBy as updatedBy,r.createdTIMESTAMP as createdTimestamp,r.updatedTIMESTAMP as updatedTimestamp from role r,collection c,user_role r_us where c.id = r.collectionid and r_us.role_name = r.name and r_us.user_id = :userId and r.collectionid=:collectionId", nativeQuery=true) List<RoleRepository.RoleBusinessIdProjection> findBusinessRolesByUserIdAndCollectionId(@Param("userId") Long userId, @Param("collectionId") Long collectionId) Find by user id and collection id and get all roles including business id.- Parameters:
userId
- - The user idcollectionId
- - The collection id- Returns:
- The list of RoleBusinessIdProjection object.
-
findAll
-
findByNameAndCollectionIdIn
-
findByNameAndBusinessIdInAndCollectionIdIn
-
findByNameIn
@Query("SELECT p.id as privilegeId, p.entity as entity, p.service as service, p.action as action, r.type as type , r.name as roleName, r.businessId as businessId from role r LEFT JOIN r.privileges p where r.name in (:roleNames)") List<RoleRepository.SSOPrivilege> findByNameIn(@Param("roleNames") List<String> roleNames)
-