User module
Authentication contract changes
The interface itself has changed namespace:
Modules\Core\Contracts\Authentication
Modules\User\Contracts\Authentication
The check()
method has changed signature.
false
if no user logged in, or the logged in user, if logged in.false
if not logged in, true
if logged in.To get the current logged in user, there's a new method added: user()
.
Acessing the currently logged in user
The currently logged in user is now loaded on every view by default.
You can access the currently logged in user with the $currentUser
variable.
New permissions middleware
Before in AsgardCMS v1 permissions where checked by reading the current URI and matching that with the keys in the permissions.php
config file of every module.
This worked but wasn't very flexible and thus been removed on AsgardCMS v2.
There is a new Authorization
middleware class which can be used as displayed:
$router->get('users', [
'as' => 'admin.user.user.index',
'uses' => 'UserController@index',
'middleware' => 'can:user.users.index',
]);
The value after can:
is the corresponding key in your permissions.php
file.
users.php
config file rename
the users.php
configuration file was renamed to config.php
in the User module.
This mean if you used those configuration items in your modules you need to replace:
config('asgard.user.users
config('asgard.user.config
Translations have been removed
All translations files were removed from the individual modules and moved to the Translation module. Therefore you will need to require the Translation module in your project. This can be done by running the following command in your project:
composer require asgardcms/translation-module
New authentication views
All authentication views were updated to the latest version of AdminLTE. If you were using the default authentication views and had them published, you will need to re-publish those views. This can be done with the following command:
php artisan vendor:publish --provider="Modules\User\Providers\UserServiceProvider" --force