Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-11 #12

Merged
merged 1 commit into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 27 additions & 9 deletions config/playground-auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,21 @@
|
| Options for Sanctum:
| - PLAYGROUND_AUTH_USER_PRIVILEGES - allow saving privileges in the user model.
| - PLAYGROUND_AUTH_VERIFY === privileges
| - PLAYGROUND_AUTH_VERIFY === sanctum
|
| Verification:
| - admin: $user->isAdmin()
| - policy: $user->can()
| - privileges: $user->hasPrivilege()
| - roles: $user->hasRole()
| - sanctum: $user->currentAccessToken()->can()
| - user: ! empty($user)
*/

/**
* @var string verify user|privileges|roles
* @var string verify admin|user|policy|privileges|roles|sanctum
*/
'verify' => env('PLAYGROUND_AUTH_VERIFY', 'privileges'),
'verify' => env('PLAYGROUND_AUTH_VERIFY', 'sanctum'),

/**
* @var bool sanctum Enable Sanctum
Expand All @@ -101,19 +108,22 @@
* @var bool hasRole Enable if the user model has $user->hasRole($role)
*/
'hasRole' => (bool) env('PLAYGROUND_AUTH_HAS_ROLE', false),
// 'hasRole' => (bool) env('PLAYGROUND_AUTH_HAS_ROLE', true),

/**
* @var bool userRole Enable if the user model has the attribute User::$role
*/
'userRole' => (bool) env('PLAYGROUND_AUTH_USER_ROLE', false),
// 'userRole' => (bool) env('PLAYGROUND_AUTH_USER_ROLE', true),

/**
* @var bool userRoles Enable if the user model has the attribute User::$roles
*/
'userRoles' => (bool) env('PLAYGROUND_AUTH_USER_ROLES', false),
// 'userRoles' => (bool) env('PLAYGROUND_AUTH_USER_ROLES', true),

/**
* @var string canDefault The default privilege for Auth\Can::class checks.
* A value is required for Sanctum checks.
*/
'canDefault' => env('PLAYGROUND_AUTH_CAN_DEFAULT', 'app'),

/*
|--------------------------------------------------------------------------
Expand All @@ -122,6 +132,8 @@
|
| Enabling Sanctum provides token and API key support.
|
| TODO We could/shoud add Passport support.
|
*/

'token' => [
Expand Down Expand Up @@ -150,20 +162,26 @@
* @var bool roles Check the user role(s) for applying abilities.
*/
'roles' => (bool) env('PLAYGROUND_AUTH_TOKEN_ROLES', false),
// 'roles' => (bool) env('PLAYGROUND_AUTH_TOKEN_ROLES', true),

/**
* @var bool privileges Allow the attribute User::$privileges to be used for authorization.
*/
'privileges' => (bool) env('PLAYGROUND_AUTH_TOKEN_PRIVILEGES', false),
// 'privileges' => (bool) env('PLAYGROUND_AUTH_TOKEN_PRIVILEGES', true),

/**
* @var bool sanctum The token will use Sanctum.
*/
'sanctum' => (bool) env('PLAYGROUND_AUTH_TOKEN_SANCTUM', true),
// 'sanctum' => (bool) env('PLAYGROUND_AUTH_TOKEN_SANCTUM', false),

/**
* @var bool session Save the token in the session.
*/
'session' => (bool) env('PLAYGROUND_AUTH_TOKEN_SESSION', false),

/**
* @var string session_name The session name for the token.
*/
'session_name' => env('PLAYGROUND_AUTH_TOKEN_SESSION_NAME', 'sanctum'),
],

/*
Expand Down
Loading
Loading