aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/access.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/engine/lib/access.php b/engine/lib/access.php
index d9f48e6e2..b290700eb 100644
--- a/engine/lib/access.php
+++ b/engine/lib/access.php
@@ -278,7 +278,11 @@
$user_guid = (int) $user_guid;
$collections = get_write_access_array();
- if (array_key_exists($collection_id, $collections) && $user = get_user($user_guid)) {
+ if (!($collection = get_access_collection($collection_id)))
+ return false;
+
+ if ((array_key_exists($collection_id, $collections) || $collection->owner_guid == 0)
+ && $user = get_user($user_guid)) {
global $CONFIG;
insert_data("insert into {$CONFIG->dbprefix}access_collection_membership set access_collection_id = {$collection_id}, user_guid = {$user_guid}");
@@ -303,7 +307,10 @@
$user_guid = (int) $user_guid;
$collections = get_write_access_array();
- if (array_key_exists($collection_id, $collections) && $user = get_user($user_guid)) {
+ if (!($collection = get_access_collection($collection_id)))
+ return false;
+
+ if ((array_key_exists($collection_id, $collections) || $collection->owner_guid == 0) && $user = get_user($user_guid)) {
global $CONFIG;
delete_data("delete from {$CONFIG->dbprefix}access_collection_membership where access_collection_id = {$collection_id} and user_guid = {$user_guid}");