Accountant role added new permissions
This commit is contained in:
parent
133771a4b3
commit
9aec85ec9f
63
app/Listeners/Update/V30/Version308.php
Normal file
63
app/Listeners/Update/V30/Version308.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Listeners\Update\V30;
|
||||
|
||||
use App\Abstracts\Listeners\Update as Listener;
|
||||
use App\Events\Install\UpdateFinished as Event;
|
||||
use App\Traits\Permissions;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class Version308 extends Listener
|
||||
{
|
||||
use Permissions;
|
||||
|
||||
const ALIAS = 'core';
|
||||
|
||||
const VERSION = '3.0.8';
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle(Event $event)
|
||||
{
|
||||
if ($this->skipThisUpdate($event)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Log::channel('stdout')->info('Updating to 3.0.8 version...');
|
||||
|
||||
$this->updatePermissions();
|
||||
|
||||
Log::channel('stdout')->info('Done!');
|
||||
}
|
||||
|
||||
public function updatePermissions(): void
|
||||
{
|
||||
Log::channel('stdout')->info('Updating permissions...');
|
||||
|
||||
$rows = [
|
||||
'accountant' => [
|
||||
'auth-profile' => 'r,u',
|
||||
'common-reports' => 'r',
|
||||
'widgets-account-balance' => 'r',
|
||||
'widgets-bank-feeds' => 'r',
|
||||
'widgets-cash-flow' => 'r',
|
||||
'widgets-currencies' => 'r',
|
||||
'widgets-expenses-by-category' => 'r',
|
||||
'widgets-payables' => 'r',
|
||||
'widgets-profit-loss' => 'r',
|
||||
'widgets-receivables' => 'r',
|
||||
],
|
||||
];
|
||||
|
||||
Log::channel('stdout')->info('Attaching new permissions...');
|
||||
|
||||
// c=create, r=read, u=update, d=delete
|
||||
$this->attachPermissionsByRoleNames($rows);
|
||||
|
||||
Log::channel('stdout')->info('Permissions updated.');
|
||||
}
|
||||
}
|
@ -20,6 +20,7 @@ class Event extends Provider
|
||||
'App\Listeners\Update\V30\Version304',
|
||||
'App\Listeners\Update\V30\Version305',
|
||||
'App\Listeners\Update\V30\Version307',
|
||||
'App\Listeners\Update\V30\Version308',
|
||||
],
|
||||
'Illuminate\Auth\Events\Login' => [
|
||||
'App\Listeners\Auth\Login',
|
||||
|
@ -134,8 +134,10 @@ class Permissions extends Seeder
|
||||
'accountant' => [
|
||||
'admin-panel' => 'r',
|
||||
'api' => 'r',
|
||||
'auth-profile' => 'r,u',
|
||||
'common-dashboards' => 'r',
|
||||
'common-items' => 'r',
|
||||
'common-reports' => 'r',
|
||||
'purchases-bills' => 'r',
|
||||
'purchases-vendors' => 'r',
|
||||
'sales-customers' => 'r',
|
||||
@ -153,6 +155,14 @@ class Permissions extends Seeder
|
||||
'modules-item' => 'r',
|
||||
'modules-my' => 'r',
|
||||
'modules-tiles' => 'r',
|
||||
'widgets-account-balance' => 'r',
|
||||
'widgets-bank-feeds' => 'r',
|
||||
'widgets-cash-flow' => 'r',
|
||||
'widgets-currencies' => 'r',
|
||||
'widgets-expenses-by-category' => 'r',
|
||||
'widgets-payables' => 'r',
|
||||
'widgets-profit-loss' => 'r',
|
||||
'widgets-receivables' => 'r',
|
||||
],
|
||||
];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user