79 lines
2.3 KiB
PHP
79 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace IriksIT\Manager\Modules\Users;
|
|
|
|
use IriksIT\Manager\Modules\BaseModule;
|
|
use IriksIT\Manager\Support\Names;
|
|
use IriksIT\Manager\Support\Permission;
|
|
|
|
class UsersModule extends BaseModule
|
|
{
|
|
public function key(): string
|
|
{
|
|
return 'users';
|
|
}
|
|
|
|
public function label(): string
|
|
{
|
|
return 'Users';
|
|
}
|
|
|
|
public function enabledByDefault(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function tables(): array
|
|
{
|
|
return ['groups', 'group_user'];
|
|
}
|
|
|
|
public function permissions(): array
|
|
{
|
|
return [
|
|
new Permission('accounts.manage', 'Create, change and delete accounts, and put them in groups', 'Accounts'),
|
|
];
|
|
}
|
|
|
|
public function navigation(): array
|
|
{
|
|
return [
|
|
['label' => 'Accounts', 'section' => 'Administration', 'route' => Names::route('accounts.index'), 'permission' => 'accounts.manage'],
|
|
['label' => 'Groups', 'section' => 'Administration', 'route' => Names::route('groups.index'), 'permission' => 'groups.manage'],
|
|
];
|
|
}
|
|
|
|
/** The tour: the second step, for everyone while the feature is on. */
|
|
public function tutorial(): array
|
|
{
|
|
if (! config('manager.two_factor.enabled', true)) {
|
|
return [];
|
|
}
|
|
|
|
return [['title' => 'A second lock on your login', 'text' => 'Besides your password you can type a code of 6 digits from an app on your phone. Then nobody gets in with only your password. Open My account, at the bottom of the menu, and press Set up.', 'menu' => 'profile.show']];
|
|
}
|
|
|
|
public function actions(): array
|
|
{
|
|
return [
|
|
'accounts.store' => ['Created an account'],
|
|
'accounts.update' => ['Changed an account'],
|
|
'accounts.destroy' => ['Deleted an account'],
|
|
'groups.store' => ['Created a group'],
|
|
'groups.update' => ['Changed a group'],
|
|
'groups.destroy' => ['Deleted a group'],
|
|
'accounts.two_factor_reset' => ['Reset the second step of an account'],
|
|
];
|
|
}
|
|
|
|
public function views(): array
|
|
{
|
|
return ['accounts.index' => 'Opened the accounts', 'groups.index' => 'Opened the groups'];
|
|
}
|
|
|
|
public function commands(): array
|
|
{
|
|
return [CreateManagerUser::class];
|
|
}
|
|
}
|