winex01/backpack-permission-manager

Group roles and permission field view of checklist in create of laravel backpack permission manager add-on

1.2.3 2024-08-11 14:51 UTC

This package is auto-updated.

Last update: 2024-11-11 15:19:15 UTC


README

Latest Version on Packagist Total Downloads The Whole Fruit Manifesto

This package override the Backpack PermissionManager and display the checklist field role and permissions into groups. Check the laravel permission manager package on how to setup.

Screenshots

Backpack Permission Manager Extension

Installation

Via Composer

composer require winex01/backpack-permission-manager

dont forget to make guard null

//config/backpack/base.php

// The guard that protects the Backpack admin panel.
// If null, the config.auth.defaults.guard value will be used.
// 'guard' => 'backpack',
'guard' => null

seeder

php artisan vendor:publish --provider="Winex01\BackpackPermissionManager\BackpackPermissionManagerServiceProvider" --tag="seeders"

run the seeder

php artisan db:seed --class=RolesAndPermissionsSeeder

Usage

how does it worked, im using the role_permission convention

'admin' => [
  'admin_view',
  'admin_trashed_filter', 
  'admin_debugbar', 
  'admin_web_tinker', 
  'admin_notify_newly_registered',
  'admin_notify_newly_created_manga',
  'admin_proxy_notice',
  'admin_telescope',
  'admin_widgets',
  'admin_received_contact_us',
  'admin_reply_contact_us',
]

'audit_trails' => [
  'audit_trails_list',
  'audit_trails_show', 
  'audit_trails_delete',
  'audit_trails_bulk_delete',
  'audit_trails_export',
  'audit_trails_restore_revise',
  'audit_trails_bulk_restore_revise', 
]

Restrict user without permissions:

//EntityCrudController.php
use Winex01\BackpackPermissionManager\Http\Controllers\Traits\UserPermissions;

public function setup()
{
    // some code here...
    
    // Option 1:
    $this->userPermissions('user'); // it will check all permission that starts with user_ (i recommend to use prefix such as: user_list, user_create and etc..)

    // Option 2:
    $this->userPermissions(); // if you follow roleName_permissionName and use the table's name as your roleName then you can leave it empty.

    // Option 3:
    // calling $this->userPermissions method is equivalent:
    $this->crud->denyAllAccess(); // if you want to use the checkAccess method dont forget to call denyAllAccess method first
    $this->checkAccess('users');
    $this->checkAccess('admin');
}

Uninstall this package.

composer remove winex01/backpack-permission-manager

Change log

Changes are documented here on Github. Please see the Releases tab.

Testing

composer test

Contributing

Please see contributing.md for a todolist and howtos.

Security

If you discover any security related issues, please email winnie131212592@gmail.com instead of using the issue tracker.

Credits

License

This project was released under MIT, so you can install it on top of any Backpack & Laravel project. Please see the license file for more information.

However, please note that you do need Backpack installed, so you need to also abide by its YUMMY License. That means in production you'll need a Backpack license code. You can get a free one for non-commercial use (or a paid one for commercial use) on backpackforlaravel.com.