diff options
| author | ckonstanski <carlos.konstanski@olo.com> | 2024-05-25 18:03:25 -0600 |
|---|---|---|
| committer | ckonstanski <carlos.konstanski@olo.com> | 2024-05-25 18:03:25 -0600 |
| commit | b8423f4d05c75094b7b9d09c6f0bb353acc9be1c (patch) | |
| tree | 3732f71f84191b26f038130c2220fb502d738251 /sql/functions/auth.has_role.sql | |
initial commit
Diffstat (limited to 'sql/functions/auth.has_role.sql')
| -rw-r--r-- | sql/functions/auth.has_role.sql | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/sql/functions/auth.has_role.sql b/sql/functions/auth.has_role.sql new file mode 100644 index 0000000..1d6cdbd --- /dev/null +++ b/sql/functions/auth.has_role.sql @@ -0,0 +1,28 @@ +drop function auth.has_role ( + p_user_id bigint, + p_role_name character varying +); + +create or replace function auth.has_role ( + p_user_id bigint, + p_role_name character varying +) +returns setof auth.user_roles_t +as $$ +begin + return query + select user_role_group_id, + user_id, + role_group_id, + role_group_name, + role_group_description, + role_group_role_id, + role_id, + role_name, + role_description + from auth.get_all_roles_for_user(p_user_id) + where role_name = p_role_name; + + return; +end; +$$ language plpgsql; |
