diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Helpers/Authenticator.php | 21 | ||||
-rw-r--r-- | src/Helpers/AuthenticatorServiceProvider.php | 1 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/Helpers/Authenticator.php b/src/Helpers/Authenticator.php index db33339b..a7fbe8c7 100644 --- a/src/Helpers/Authenticator.php +++ b/src/Helpers/Authenticator.php @@ -28,6 +28,9 @@ class Authenticator /** @var int */ protected $passwordAlgorithm = PASSWORD_DEFAULT; + /** @var int */ + protected $guestRole = 10; + /** * @param ServerRequestInterface $request * @param Session $session @@ -119,7 +122,7 @@ class Authenticator } if (empty($this->permissions)) { - $this->permissions = $this->getPermissionsByGroup(-10); + $this->permissions = $this->getPermissionsByGroup($this->guestRole); } } @@ -205,6 +208,22 @@ class Authenticator } /** + * @return int + */ + public function getGuestRole() + { + return $this->guestRole; + } + + /** + * @param int $guestRole + */ + public function setGuestRole(int $guestRole) + { + $this->guestRole = $guestRole; + } + + /** * @param User $user * @return array * @codeCoverageIgnore diff --git a/src/Helpers/AuthenticatorServiceProvider.php b/src/Helpers/AuthenticatorServiceProvider.php index f06e635d..3534618d 100644 --- a/src/Helpers/AuthenticatorServiceProvider.php +++ b/src/Helpers/AuthenticatorServiceProvider.php @@ -14,6 +14,7 @@ class AuthenticatorServiceProvider extends ServiceProvider /** @var Authenticator $authenticator */ $authenticator = $this->app->make(Authenticator::class); $authenticator->setPasswordAlgorithm($config->get('password_algorithm')); + $authenticator->setGuestRole($config->get('auth_guest_role', $authenticator->getGuestRole())); $this->app->instance(Authenticator::class, $authenticator); $this->app->instance('authenticator', $authenticator); |