summaryrefslogtreecommitdiff
path: root/sql/functions/auth.has_role.sql
blob: 1d6cdbdd694a844db8e49a571286021cc64b1ce3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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;