1: function wp_access
2: (v_presentation_id IN wp_presentations.presentation_id%TYPE,
3: v_user_id IN users.user_id%TYPE,
4: v_role IN user_group_map.role%TYPE,
5: v_public_p IN wp_presentations.public_p%TYPE,
6: v_creation_user IN users.user_id%TYPE,
7: v_group_id IN user_groups.group_id%TYPE
8: )
9: return varchar is
10: a_role user_group_map.role%TYPE;
11: begin
12: if v_creation_user = v_user_id then
13: return 'admin';
14: end if;
15: begin
16: select role into a_role
17: from user_group_map
18: where group_id = v_group_id
19: and user_id = v_user_id;
20: exception
21: -- nothing at all!
22: when no_data_found then
23: a_role := null;
24: end;
25: if v_role = 'write' and a_role = 'read' then
26: a_role := null;
27: elsif v_role = 'admin' and a_role <> 'admin' then
28: a_role := null;
29: end if;
30: if v_role = 'read' and v_public_p = 't' and a_role is null then
31: a_role := 'read';
32: end if;
33: return a_role;
34: end;
|