mirror of
https://github.com/getgrav/grav.git
synced 2026-05-07 08:57:06 +02:00
Fixed some admin related ACL issues
This commit is contained in:
@@ -35,6 +35,7 @@ class UserGroupCollection extends FlexCollection
|
||||
public function authorize(string $action, string $scope = null): ?bool
|
||||
{
|
||||
$authorized = null;
|
||||
/** @var UserGroupObject $object */
|
||||
foreach ($this as $object) {
|
||||
$auth = $object->authorize($action, $scope);
|
||||
if ($auth === true) {
|
||||
|
||||
@@ -1028,8 +1028,14 @@ class TwigExtension extends AbstractExtension implements GlobalsInterface
|
||||
*/
|
||||
public function authorize($action)
|
||||
{
|
||||
/** @var UserInterface|null $user */
|
||||
$user = $this->grav['user'] ?? null;
|
||||
// Admin can use Flex users even if the site does not; make sure we use the right version of the user.
|
||||
$admin = $this->grav['admin'] ?? null;
|
||||
if ($admin) {
|
||||
$user = $admin->user;
|
||||
} else {
|
||||
/** @var UserInterface|null $user */
|
||||
$user = $this->grav['user'] ?? null;
|
||||
}
|
||||
|
||||
if (!$user) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user