shawnsandy/dash-auth

v0.2.2 2018-01-24 12:41 UTC

This package is not auto-updated.

Last update: 2024-11-24 05:44:20 UTC


README

Dash Auth is simple way to create & manage Bouncer Roles & Abilities.

Install

Via Composer

"repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/shawnsandy/dash-auth"
        }
    ],
  • Add the package to your composer.json file as VCS repository, sorry there is no packagist install just yet.
$ composer require shawnsandy/dash-auth
  • From the command prompt run the above to install the package

Usage

Quick Start Laravel 5.5x and greater

SUPER_ADMIN_EMAIL=my_super_admin_here@mysite.me
  • Add the SUPER_ADMIN_EMAIL to your .env file with the email of the registered user that will act as your super-admin.
php artisan vendor:publish --tag=dashauth-config
  • From the console use the --tag option to publish config file
   'roles' => [
        'superadmin' => "Super Admin",
        'admin' => "Admin",
        'staff' => "Staff",
        'editor' => "Editor",
        'member' => "Member",
    ],

    'abilities' => [
        'assign_roles' => 'Assign Roles',
        'manage_users' => 'Manage Users',
        'manage_posts' => 'Manage Posts',
        'manage_admin' => 'Manage Site',
        'manage_systems' => 'Manage Systems',
    ],
  • Edit the config settings (optional), go to config/dashauth.php
Dashauth::routes();
  • Add the default dash routes, open routes\web.php file and add the above

Alt text

Setup SuperAdmin Role

  • Set the superadmin email in you .env file SUPERADMIN_EMAIL=youremail@you.com
  • Next go to yoursite.com/dashauth and create a super admin
  • Manage \ View privileges yoursite.com/dashauth/privileges

Manage Roles Component

Add the manage roles component to application passing the user info $user = User::find(1)

<p class="subtitle is-3">Manage Roles</p>

@component("dashauth::forms.privileges", [ "user" => $user ) ])
@slot('btn_class')  button is-link is-large is-uppercase  @endslot
@endcomponent
  • Dash auth comes with a simple component to manage roles you can add the component forms.roles component to you user record.

Alt text

Manage Abilities (privileges)

 @component('dashauth::components.privileges')
  • Assign and remove abilities to/from using the dashauth::components.privileges component.

Larvel 5.4x

Add the service provider to the config/app.php file

"providers" => [
    ShawnSandy\DashAuth\DashAuthServicesProvider::class,
]

Add the facade to config/app.php file

aliases => [
"Dashauth" => ShawnSandy\DashAuth\DashAuthFacade::class,
]

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

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

Credits

  • [Shawn Sandy][link-author]
  • [All Contributors][link-contributors]

License

The MIT License (MIT). Please see License File for more information.