[open-ils-commits] r12536 - trunk/Open-ILS/src/sql/Pg (scottmk)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Mar 16 10:49:14 EDT 2009
Author: scottmk
Date: 2009-03-16 10:49:12 -0400 (Mon, 16 Mar 2009)
New Revision: 12536
Modified:
trunk/Open-ILS/src/sql/Pg/006.schema.permissions.sql
Log:
For usr_has_perm* functions: super_user has all permissions
everywhere (even permissions that don't exist).
Modified: trunk/Open-ILS/src/sql/Pg/006.schema.permissions.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/006.schema.permissions.sql 2009-03-16 13:51:30 UTC (rev 12535)
+++ trunk/Open-ILS/src/sql/Pg/006.schema.permissions.sql 2009-03-16 14:49:12 UTC (rev 12536)
@@ -314,6 +314,7 @@
-- by a DISTINCT clause.
--
DECLARE
+ b_super BOOLEAN;
n_perm INTEGER;
n_min_depth INTEGER;
n_work_ou INTEGER;
@@ -322,6 +323,34 @@
n_curr_depth INTEGER;
BEGIN
--
+ -- Check for superuser
+ --
+ SELECT INTO b_super
+ super_user
+ FROM
+ actor.usr
+ WHERE
+ id = user_id;
+ --
+ IF NOT FOUND THEN
+ return; -- No user? No permissions.
+ ELSIF b_super THEN
+ --
+ -- Super user has all permissions everywhere
+ --
+ FOR n_work_ou IN
+ SELECT
+ id
+ FROM
+ actor.org_unit
+ WHERE
+ parent_ou IS NULL
+ LOOP
+ RETURN NEXT n_work_ou;
+ END LOOP;
+ RETURN;
+ END IF;
+ --
-- Translate the permission name
-- to a numeric permission id
--
More information about the open-ils-commits
mailing list