authen
.public
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
fn_user_primary_group
Parameters
Name
Type
Mode
v_user_id
integer
IN
v_prop_id
integer
IN
Definition
SELECT ug.id FROM public.user_roles ur JOIN public.user_group ug ON ug.id = ur.group_id WHERE ur.user_id = v_user_id AND ur.prop_id = v_prop_id AND ur.active ORDER BY CASE ug.group_type WHEN 'S' THEN 1 WHEN 'G' THEN 2 WHEN 'P' THEN 3 WHEN 'D' THEN 4 WHEN 'U' THEN 5 ELSE 9 END, ug.id LIMIT 1