Skip to content

Commit

Permalink
#677 - check voiding for all privileges and entity type specific priv…
Browse files Browse the repository at this point in the history
…ilege
  • Loading branch information
petmongrels committed Feb 28, 2024
1 parent f36369a commit bc182b5
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@ default User getUser(String userId) {
boolean hasPrivilege(String type, long userId);

@Query(value = "select bool_or(groups.has_all_privileges) from users\n" +
" left outer join user_group ug on users.id = ug.user_id\n" +
" left outer join groups on ug.group_id = groups.id\n" +
" left outer join user_group ug on users.id = ug.user_id and ug.is_voided = false\n" +
" left outer join groups on ug.group_id = groups.id and groups.is_voided = false\n" +
"where users.id = :userId", nativeQuery = true)
Boolean hasAll(long userId);

String BASE_ENTITY_TYPE_PRIVILEGE_QUERY = "select (count(p.id) > 0) as exists from group_privilege\n" +
" join privilege p on group_privilege.privilege_id = p.id\n" +
" join groups on group_privilege.group_id = groups.id\n" +
" join user_group ug on groups.id = ug.group_id\n" +
" join groups on group_privilege.group_id = groups.id and groups.is_voided=false\n" +
" join user_group ug on groups.id = ug.group_id and ug.is_voided=false\n" +
" join users on ug.user_id = users.id\n" +
"where p.type = :type and users.id = :userId and group_privilege.allow";

Expand Down

0 comments on commit bc182b5

Please sign in to comment.