Index: openacs-4/packages/acs-kernel/acs-kernel.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/acs-kernel.info,v
diff -u -r1.135 -r1.136
--- openacs-4/packages/acs-kernel/acs-kernel.info 27 Jul 2015 12:29:28 -0000 1.135
+++ openacs-4/packages/acs-kernel/acs-kernel.info 27 Jul 2015 12:51:21 -0000 1.136
@@ -9,15 +9,15 @@
f
t
-
+
OpenACS Core Team
Routines and data models providing the foundation for OpenACS-based Web services.
2013-09-08
OpenACS
The OpenACS kernel contains the core datamodel create and drop scripts for such things as objects, groups, partiies and the supporting PL/SQL and PL/pgSQL procedures.
3
-
+
Index: openacs-4/packages/acs-kernel/sql/postgresql/acs-permissions-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/acs-permissions-create.sql,v
diff -u -r1.38 -r1.39
--- openacs-4/packages/acs-kernel/sql/postgresql/acs-permissions-create.sql 23 Apr 2013 15:23:11 -0000 1.38
+++ openacs-4/packages/acs-kernel/sql/postgresql/acs-permissions-create.sql 27 Jul 2015 12:51:21 -0000 1.39
@@ -504,31 +504,17 @@
grant_permission__privilege varchar
) RETURNS integer AS $$
DECLARE
- exists_p boolean;
BEGIN
- lock table acs_permissions_lock;
-
- select count(*) > 0 into exists_p
- from acs_permissions
- where object_id = grant_permission__object_id
- and grantee_id = grant_permission__grantee_id
- and privilege = grant_permission__privilege;
-
- if not exists_p then
-
- insert into acs_permissions
- (object_id, grantee_id, privilege)
- values
- (grant_permission__object_id, grant_permission__grantee_id,
- grant_permission__privilege);
-
- end if;
-
- -- exception
- -- when dup_val_on_index then
- -- return;
-
- return 0;
+ insert into acs_permissions
+ (object_id, grantee_id, privilege)
+ values
+ (grant_permission__object_id, grant_permission__grantee_id,
+ grant_permission__privilege);
+
+ return 0;
+EXCEPTION
+ when unique_violation then
+ return 0;
END;
$$ LANGUAGE plpgsql;
@@ -549,8 +535,6 @@
) RETURNS integer AS $$
DECLARE
BEGIN
- lock table acs_permissions_lock;
-
delete from acs_permissions
where object_id = revoke_permission__object_id
and grantee_id = revoke_permission__grantee_id
Index: openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.9.0d5-5.9.0d6.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.9.0d5-5.9.0d6.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.9.0d5-5.9.0d6.sql 27 Jul 2015 12:51:21 -0000 1.1
@@ -0,0 +1,48 @@
+
+-- Antonio Pisano 2015-07-29: removed exclusive lock
+-- for this procedures as it is sufficient to handle
+-- exception/ignore the case. Locking esclusively
+-- could cause deadlock in certain situations.
+
+--
+-- procedure acs_permission__grant_permission/3
+--
+CREATE OR REPLACE FUNCTION acs_permission__grant_permission(
+ grant_permission__object_id integer,
+ grant_permission__grantee_id integer,
+ grant_permission__privilege varchar
+) RETURNS integer AS $$
+DECLARE
+BEGIN
+ insert into acs_permissions
+ (object_id, grantee_id, privilege)
+ values
+ (grant_permission__object_id, grant_permission__grantee_id,
+ grant_permission__privilege);
+
+ return 0;
+EXCEPTION
+ when unique_violation then
+ return 0;
+END;
+$$ LANGUAGE plpgsql;
+
+
+--
+-- procedure acs_permission__revoke_permission/3
+--
+CREATE OR REPLACE FUNCTION acs_permission__revoke_permission(
+ revoke_permission__object_id integer,
+ revoke_permission__grantee_id integer,
+ revoke_permission__privilege varchar
+) RETURNS integer AS $$
+DECLARE
+BEGIN
+ delete from acs_permissions
+ where object_id = revoke_permission__object_id
+ and grantee_id = revoke_permission__grantee_id
+ and privilege = revoke_permission__privilege;
+
+ return 0;
+END;
+$$ LANGUAGE plpgsql;