escolalms / auth
Escola Headless LMS Authorization
Installs: 37 044
Dependents: 39
Suggesters: 4
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Type:package
Requires
- php: >=7.4 | >=8.0
- doctrine/dbal: ^2|^3
- escolalms/categories: >=0.1
- escolalms/core: >=0.1.6
- escolalms/files: ^0
- escolalms/model-fields: ^0
- laravel/framework: >=8.0
- laravel/socialite: ^5.1
Requires (Dev)
- escolalms/notifications: ^0
- escolalms/settings: ^0.1.3
- maatwebsite/excel: ^3.1
- nunomaduro/larastan: ^1.0
- orchestra/testbench: ^6
- phpunit/phpunit: ^9.0
Suggests
- escolalms/settings: ^0.1.3
- maatwebsite/excel: ^3.1
- dev-main
- 0.2.39
- 0.2.38
- 0.2.37
- 0.2.36
- 0.2.35
- 0.2.34
- 0.2.33
- 0.2.32
- 0.2.31
- 0.2.30
- 0.2.29
- 0.2.28
- 0.2.27
- 0.2.26
- 0.2.25
- 0.2.24
- 0.2.23
- 0.2.22
- 0.2.21
- 0.2.20
- 0.2.19
- 0.2.18
- 0.2.17
- 0.2.16
- 0.2.15
- 0.2.14
- 0.2.13
- 0.2.12
- 0.2.11
- 0.2.10
- 0.2.9
- 0.2.8
- 0.2.7
- 0.2.6
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.x-dev
- 0.1.103
- 0.1.102
- 0.1.101
- 0.1.100
- 0.1.99
- 0.1.98
- 0.1.97
- 0.1.96
- 0.1.95
- 0.1.94
- 0.1.93
- 0.1.92
- 0.1.91
- 0.1.90
- 0.1.89
- 0.1.88
- 0.1.87
- 0.1.86
- 0.1.85
- 0.1.84
- 0.1.83
- 0.1.82
- 0.1.81
- 0.1.80
- 0.1.79
- 0.1.78
- 0.1.77
- 0.1.76
- 0.1.75
- 0.1.74
- 0.1.73
- 0.1.72
- 0.1.71
- 0.1.69
- 0.1.68
- 0.1.67
- 0.1.66
- 0.1.65
- 0.1.64
- 0.1.63
- 0.1.62
- 0.1.61
- 0.1.60
- 0.1.59
- 0.1.58
- 0.1.57
- 0.1.56
- 0.1.55
- 0.1.54
- 0.1.53
- 0.1.52
- 0.1.51
- 0.1.50
- 0.1.49
- 0.1.48
- 0.1.47
- 0.1.46
- 0.1.45
- 0.1.44
- 0.1.43
- 0.1.42
- 0.1.41
- 0.1.40
- 0.1.39
- 0.1.38
- 0.1.37
- 0.1.36
- 0.1.35
- 0.1.34
- 0.1.33
- 0.1.32
- 0.1.31
- 0.1.30
- 0.1.29
- 0.1.28
- 0.1.27
- 0.1.26
- 0.1.25
- 0.1.24
- 0.1.23
- 0.1.22
- 0.1.21
- 0.1.20
- 0.1.19
- 0.1.18
- 0.1.17
- 0.1.16
- 0.1.15
- 0.1.14
- 0.1.13
- 0.1.12
- 0.1.11
- 0.1.10
- 0.1.9
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1
- v0.0.6
- v0.0.5
- dev-feature/ISO2-87
- dev-feature/WELLMS-330
- dev-allowed-null-values-for-user-update
- dev-feature/WC-7
This package is auto-updated.
Last update: 2024-11-17 11:01:40 UTC
README
What does it do
Package for user authentication. In addition, the package includes:
- user management,
- group management,
- profile management,
- registration.
Installing
composer require escolalms/auth
php artisan migrate
php artisan db:seed --class="EscolaLms\Auth\Database\Seeders\AuthPermissionSeeder"
Optional:
- Run command
escolalms:admin
.
Commands
escolalms:admin
- create account with role admin
Database
category_user
- Table is used to store the user categories.groups
- Table for storing groups.group_user
- Table for storing groups assigned to the user.
User 1 -> n Categories
User 1 -> n Groups
Endpoints
All the endpoints are defined in
Tests
Run ./vendor/bin/phpunit
to run tests.
Events
AccountBlocked
- Event is dispatched after blocking the user's account (is_active=false
).AccountConfirmed
- Event is dispatched after the user verifies the account.AccountDeleted
- Event is dispatched after deleting the user.AccountMustBeEnableByAdmin
- Event is dispatched when the user registers andConfig::get('escola_auth.account_must_be_enabled_by_admin') === SettingStatusEnum::ENABLED
AccountRegistered
- Event is dispatched after the account is registered.ForgotPassword
- Event is dispatched when a password reset request is sent.Login
- Event is dispatched on successful login.Logout
- Event is dispatched after logout.PasswordChanged
- Event is dispatched after the password changed.ResetPassword
- Event is dispatched after resetting the password.UserAddedToGroup
- Event is dispatched after adding the user to the group.UserRemovedFromGroup
- Event is dispatched after removing the user from the group.
Listeners
CreatePasswordResetToken
- The listener listens for the ForgotPassword event and executes the following method.
public function handle(ForgotPassword $event): void { if (!is_callable(self::getRunEventForgotPassword()) || self::getRunEventForgotPassword()()) { $user = $event->getUser(); $this->userRepository->update([ 'password_reset_token' => Str::random(32), ], $user->getKey()); $user->refresh(); $user->notify(new ResetPassword($user->password_reset_token, $event->getReturnUrl())); } }
This is useful if you are using TemplateEmail and you don't want to send the default e-mails.
CreatePasswordResetToken::setRunEventForgotPassword( function () { $templateRepository = app(TemplateRepositoryContract::class); return empty($templateRepository->findTemplateDefault( ForgotPassword::class, EmailChannel::class )); } );
SendEmailVerificationNotification
- The listener listens for the AccountRegistered event and executes the following method.
public function handle(Registered $event) { if (!is_callable(self::getRunEventEmailVerification()) || self::getRunEventEmailVerification()()) { if ($event->user instanceof MustVerifyEmail && !$event->user->hasVerifiedEmail()) { $event->user->sendEmailVerificationNotification(); } } }
How to use this on frontend
Admin panel
Permissions
Permissions are defined in seeder.