Skip to content

Commit

Permalink
Item12952: Changes to configure security.
Browse files Browse the repository at this point in the history
Part 2.

Defines a new configuration setting: ConfigureFilter.  If configured,
this takes precedence over the isAnAdmin test, otherwise all users in
the AdminGroup can access the configuration.
  • Loading branch information
gac410 committed Sep 12, 2014
1 parent e6115f0 commit aa5c17d
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions lib/Foswiki/Plugins/ConfigurePlugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,21 @@ sub _JSONwrap {

if ( $Foswiki::cfg{isVALID} ) {

# Check rights to use this interface - admins only
die
"You must be logged in as an administrator to use this interface."
unless Foswiki::Func::isAnAdmin();
if ( defined $Foswiki::cfg{ConfigureFilter}
&& length( $Foswiki::cfg{ConfigureFilter} ) )
{
unless ( $session->{user} =~ m/$Foswiki::cfg{ConfigureFilter}/ )
{
die
"You must have special permission to use this interface.";
}
}
else {
# Check rights to use this interface - admins only
die
"You must be logged in as an administrator to use this interface."
unless Foswiki::Func::isAnAdmin();
}
}
else {
# Otherwise we must be bootstrapping - an inherently dangerous
Expand Down

0 comments on commit aa5c17d

Please sign in to comment.