Skip to content

Commit

Permalink
Merge branch 'pr/2871' into pull-request-2871
Browse files Browse the repository at this point in the history
* pr/2871:
  Rename _acl_add to _acl_addOrUpdate
  Fix #1115
  • Loading branch information
splitbrain committed Oct 15, 2019
2 parents 589c037 + 32168a7 commit 55cc5b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/plugins/acl/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function handle()
if ($cmd == 'save' && $scope && $this->who && $INPUT->has('acl')) {
// handle additions or single modifications
$this->deleteACL($scope, $this->who);
$this->addACL($scope, $this->who, $INPUT->int('acl'));
$this->addOrUpdateACL($scope, $this->who, $INPUT->int('acl'));
} elseif ($cmd == 'del' && $scope && $this->who) {
// handle single deletions
$this->deleteACL($scope, $this->who);
Expand Down Expand Up @@ -716,9 +716,12 @@ protected function getExactPermisson()
*
* @author Frank Schubert <frank@schokilade.de>
*/
public function addACL($acl_scope, $acl_user, $acl_level)
public function addOrUpdateACL($acl_scope, $acl_user, $acl_level)
{
global $config_cascade;

// first make sure we won't end up with 2 lines matching this user and scope. See issue #1115
$this->deleteACL($acl_scope, $acl_user);
$acl_user = auth_nameencode($acl_user, true);

// max level for pagenames is edit
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/acl/remote.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function addAcl($scope, $user, $level)

/** @var admin_plugin_acl $apa */
$apa = plugin_load('admin', 'acl');
return $apa->addACL($scope, $user, $level);
return $apa->addOrUpdateACL($scope, $user, $level);
}

/**
Expand Down

0 comments on commit 55cc5b9

Please sign in to comment.