From ea460c6222cab6ae83e99fd4dfddc019a7eea5d3 Mon Sep 17 00:00:00 2001 From: Pamela Argentino Date: Thu, 16 Jun 2016 10:54:47 -0300 Subject: [PATCH] Fix PrivatePageProtection.php --- PrivatePageProtection.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/PrivatePageProtection.php b/PrivatePageProtection.php index 001af1f..f0ef170 100644 --- a/PrivatePageProtection.php +++ b/PrivatePageProtection.php @@ -234,6 +234,11 @@ function privateppGetAccessError($groups, $user) return null; } + // In some cases, $groups is an array + if (is_array($groups) && count($groups) == 1) { + $groups = $groups[0]; + } + if (is_string($groups)) { $groups = explode('|', $groups); } @@ -241,13 +246,13 @@ function privateppGetAccessError($groups, $user) $ugroups = $user->getEffectiveGroups(true); # Sysop super permissions - if (in_array('sysop', $ugroups)) { + if (in_array('sysop', $ugroups) && !in_array('sysop', $groups)) { $groups[] = 'sysop'; } $match = array_intersect($ugroups, $groups); - if ($match) { + if (count($match) > 0) { # group is allowed - keep processing return null; } else { @@ -278,7 +283,7 @@ public function getSaveAccess($groups, $user) $ugroups = $user->getEffectiveGroups(true); - if (in_array('locker', $ugroups)) { + if (count(array_intersect($groups, $ugroups)) > 0) { # group is allowed - keep processing return null; } else {