Permalink
Browse files

Item12849: implemented support for new ACL style since Foswiki >= 1.2

git-svn-id: http://svn.foswiki.org/trunk/DBCachePlugin@17710 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information...
MichaelDaum MichaelDaum
MichaelDaum authored and MichaelDaum committed May 28, 2014
1 parent 7f30669 commit a661f7a53d10efb23c0a71c336b199b677c054bc
@@ -416,11 +416,12 @@ automatically from there on.
* Set SHORTDESCRIPTION = Lightweight frontend to the <nop>DBCacheContrib
-->
| Author: | Michael Daum |
| Copyright &copy;: | 2005-2013, Michael Daum http://michaeldaumconsulting.com |
| Copyright &copy;: | 2005-2014, Michael Daum http://michaeldaumconsulting.com |
| License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
| Release: | %$RELEASE% |
| Version: | %$VERSION% |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| 28 May 2014: | implemented new ACL style compatible with Foswiki >= 1.2 |
| 04 Apr 2014: | flag rest handlers that don't require authentication |
| 15 Dec 2013: | fixed @Ref operator |
| 30 Aug 2013: | fixed crashes when calling API on non-existing web |
@@ -25,8 +25,8 @@ use Foswiki::Plugins();
#Monitor::MonitorMethod('Foswiki::Contrib::DBCachePlugin::Core');
#Monitor::MonitorMethod('Foswiki::Contrib::DBCachePlugin::WebDB');
our $VERSION = '5.46';
our $RELEASE = '5.46';
our $VERSION = '5.47';
our $RELEASE = '5.47';
our $NO_PREFS_IN_TOPIC = 1;
our $SHORTDESCRIPTION = 'Lightweighted frontend to the DBCacheContrib';
@@ -1,6 +1,6 @@
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# Copyright (C) 2005-2013 Michael Daum http://michaeldaumconsulting.com
# Copyright (C) 2005-2014 Michael Daum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -1,6 +1,6 @@
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# Copyright (C) 2005-2013 Michael Daum http://michaeldaumconsulting.com
# Copyright (C) 2005-2014 Michael Daum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -512,7 +512,7 @@ sub expandPath {
sub checkAccessPermission {
my ($this, $mode, $user, $topic) = @_;
#print STDERR "called checkAccessPermission($mode, $user, $topic) ... ";
#print STDERR "called checkAccessPermission($mode, $user, $topic) ... ";
my $cUID;
my $session = $Foswiki::Plugins::SESSION;
@@ -534,32 +534,45 @@ sub checkAccessPermission {
my $allow = $this->getACL($topic, 'ALLOWTOPIC' . $mode);
my $deny = $this->getACL($topic, 'DENYTOPIC' . $mode);
my $isDeprecatedEmptyDeny =
!defined($Foswiki::cfg{AccessControlACL}{EnableDeprecatedEmptyDeny}) || $Foswiki::cfg{AccessControlACL}{EnableDeprecatedEmptyDeny};
# Check DENYTOPIC
if (defined($deny)) {
if (scalar(@$deny) != 0) {
if ($users->isInUserList($cUID, $deny)) {
#print STDERR "1: DENY user=$user mode=$mode topic=".$topic->fastget('name'). "\n";
#print STDERR "1: DENY user=$user mode=$mode topic=".$topic->fastget('name'). "\n";
return 0;
}
} else {
# If DENYTOPIC is empty, don't deny _anyone_
#print STDERR "2: result = 1\n";
return 1;
if ($isDeprecatedEmptyDeny) {
# If DENYTOPIC is empty, don't deny _anyone_
#print STDERR "2: result = 1\n";
return 1;
} else {
$deny = undef;
}
}
}
# Check ALLOWTOPIC. If this is defined the user _must_ be in it
if (defined($allow) && scalar(@$allow) != 0) {
if (!$isDeprecatedEmptyDeny && grep {/^\*$/} @$allow) {
# ALLOWTOPIC is *, don't deny _anyone_
#print STDERR "3: result = 1\n";
return 1;
}
if ($users->isInUserList($cUID, $allow)) {
#print STDERR "3: result = 1\n";
#print STDERR "4: result = 1\n";
return 1;
}
#print STDERR "2: DENY user=$user mode=$mode topic=".$topic->fastget('name'). "\n";
#print STDERR "5: DENY user=$user mode=$mode topic=".$topic->fastget('name'). "\n";
return 0;
}
#print STDERR "5: result = 1\n";
return 1;
}
@@ -574,7 +587,7 @@ sub getACL {
return unless defined $topic;
my $text = $this->getPreference($topic, $mode);
#print STDERR "getACL($topic, $mode), text=".($text||'')."\n";
#print STDERR "getACL($topic, $mode), text=".($text||'')."\n";
return unless defined $text;
# Remove HTML tags (compatibility, inherited from Users.pm

0 comments on commit a661f7a

Please sign in to comment.