2017 © Pedro Peláez
 

package watchtower

Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel 5

image

smarch/watchtower

Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel 5

  • Saturday, October 29, 2016
  • by landjea
  • Repository
  • 10 Watchers
  • 52 Stars
  • 2,538 Installations
  • HTML
  • 0 Dependents
  • 0 Suggesters
  • 22 Forks
  • 7 Open issues
  • 18 Versions
  • 1 % Grown

The README.md

Software License Laravel 5.1 Packagist Version Total Downloads GitHub stars, (*1)

The Watchtower

For Laravel 5.3 use the develop branch. Make sure you add the necessary Shinobi lines to your User model to get the permissions to work.

A front end (GUI) package for the Caffeinated/Shinobi RBAC authorization system for Laravel 5., (*2)

enter image description here, (*3)

This page is intended for installation, please check out the wiki for more information about usage., (*4)

Overview

This package is to administer / manage your roles and permissions tables with the Shinobi role based access control system for Laravel 5., (*5)

:hand: Note: Shinobi is a required part of this package. This package is merely the GUI front end for the Shinobi package and this Watchtower package does not actually provide any of the authorization functionality. If you don't already have the Shinobi package installed, it will be installed as part of the installation of Watchtower., (*6)

It will give you full control over your roles :busts_in_silhouette:, their permissions :key: and the users :bust_in_silhouette: that have access to them. You will be able to add, edit, update, delete and synchronize all three as needed., (*7)

Out of the box, Watchtower contains all the views necessary to enable Role & Permissions management. It also provides the necessary permissions to secure your site so that only those allowed to perform the admin functions are permitted. Of course, this is made possible using Shinobi and, naturally, all views and permissions are configurable so you are free to provide your own views and change the permissions the way your app requires them., (*8)


Example of the user matrix

The User Matrix, (*9)

Installation

Depending on whether or not you have already installed Shinobi, your install is pretty straightforward. Install Watchtower, add Service Providers, add Facade, run DB commands. Win., (*10)

:hand: Note Even though Watchtower uses a few packages to properly theme and layout the admin area, they are referenced through cdnjs.com and are not installed locally., (*11)

Watchtower makes use of the following packages : Bootstrap, Bootstrap theming, JQuery, Pace, Sweetalert and Modernizr. If you wish to not use the cdn versions and use local versions instead, modify the master.layout file to reflect those changes. (Or alternately, use the config file to point your master.layout to your local copies of those packages.), (*12)

:black_square_button: Composer

For Laravel 5.0 - 5.2 you can simply run this line at the command prompt.
 composer require "smarch/watchtower"
For Laravel 5.3 put the following line in your composer.json file.
"smarch/watchtower": "@dev"

:pencil: Service Provider

Once composer has installed the necessary packages for watchtower to function you need to open your laravel config page for service providers and add Watchtower. To properly function you need to have all 3 service providers referenced : Shinobi, HTML Forms and Watchtower., (*13)

config/app.php, (*14)

       /*
        * Third Party Service Providers
        */
        Caffeinated\Shinobi\ShinobiServiceProvider::class, // For RBAC
        Collective\Html\HtmlServiceProvider::class, // For Watchtower Forms to function
        Smarch\Watchtower\WatchtowerServiceProvider::class, // For Watchtower

:pencil: Facades

While Watchtower itself does not need a facade, one is provided if you wish to use one. However the Shinobi and Forms facades are used heavily by Watchtower so be sure you add them to your Facades., (*15)

config/app.php, (*16)

        /*
        * Third Party Service Providers
        */
        'Form'     => Collective\Html\FormFacade::class,  // required for Watchtower Forms
        'HTML'     => Collective\Html\HtmlFacade::class,   // required for Watchtower Forms
        'Shinobi'  => Caffeinated\Shinobi\Facades\Shinobi::class, // For RBAC functions
        //'Watchtower'=> Smarch\Watchtower\WatchtowerFacade::class, // not required, but available

:card_index: Database Migrations / Seeds

If you did not install Shinobi earlier, you will need to run the migration files to properly set up and create the necessary tables. From your command prompt (wherever you run your artisan commands) enter the following command php artisan vendor:publish and then php artisan migrate. This should properly create your necessary tables AND create the Watchtower config file (which allows you to define any views / permissions you wish to change from their defaults)., (*17)

    php artisan vendor:publish
    php artisan migrate

:hand: Note If you already have your roles and permissions set up, you can skip the following step and just change the Watchtower config file to reflect the permissions it should use to permit functionality., (*18)

To permit the ability to restrict and permit access to the various admin areas of Watchtower, you will need to run the Watchtower seeder which will prepopulate your database with permissions and roles., (*19)

php artisan db:seed --class Smarch\Watchtower\Seeds\WatchtowerTableSeeder

:memo: Shinobi usage requirements

If you are installing Shinobi now, with Watchtower, you will need to also make the following changes so that you can use Shinobi's RBAC functions instead of Laravel defaulting to its own "Gate" authorization methods. Modify your User model to reflect the following changes (stripping out Laravel's Authorizable contracts and traits) :, (*20)


<?php namespace App; use Illuminate\Auth\Authenticatable; use Illuminate\Database\Eloquent\Model; use Illuminate\Auth\Passwords\CanResetPassword; use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; use Caffeinated\Shinobi\Traits\ShinobiTrait; class User extends Model implements AuthenticatableContract, CanResetPasswordContract { use Authenticatable, CanResetPassword, ShinobiTrait;

For Laravel 5.3 your User model should look like this :, (*21)


<?php namespace App; use Illuminate\Notifications\Notifiable; use Illuminate\Foundation\Auth\User as Authenticatable; use Caffeinated\Shinobi\Traits\ShinobiTrait; class User extends Authenticatable { use Notifiable; use ShinobiTrait;

Once this is all finished, you should be able to go to, (*22)

:earth_americas: http://yoursite/watchtower

, (*23)

and be rewarded with a big ole warning. :smile: That's normal. This shows you that Shinobi is working and properly protecting your admin (Watchtower) area. Just login with admin@change.me and password (if you used the db:seed command) and you will have full access. If you already had a user in your database, log in with that first user to enable access. By default, the db:seed command will associate the admin role withuser->id = 1in the database., (*24)

:hand: Note If you have not setup a login redirect yet, and don't have a HOME route and view, you will probably get another route error. Create a route for Home or redirect your logins or just type the url of http://yoursite/watchtower again., (*25)

:exclamation: Laravel Authentication Views (login, etc...)

Laravel 5.2

Now you can use artisan to make all your auth views and routes using the following command :, (*26)

php artisan make:auth

This will generate the routes / views you need for authentication to work for you., (*27)

Laravel 5.1

Watchtower does not ship enabled (see note below after routes) with the default laravel authentication views/routes, since Laravel removed them in 5.1. However you can find some samples / information from Laravel here : Laravel Login / Auth Views that will provide you with the routes / views necessary to permit login and registration., (*28)

You will need the following routes for authentication. (also provided on Laravel auth link above) Copy these into your app/routes.php file (or wherever you define your routes)., (*29)

routes.php 

// Authentication routes... Route::get('auth/login', 'Auth\AuthController@getLogin'); Route::post('auth/login', 'Auth\AuthController@postLogin'); Route::get('auth/logout', 'Auth\AuthController@getLogout'); // Registration routes... Route::get('auth/register', 'Auth\AuthController@getRegister'); Route::post('auth/register', 'Auth\AuthController@postRegister'); // Password reset link request routes... Route::get('password/email', 'Auth\PasswordController@getEmail'); Route::post('password/email', 'Auth\PasswordController@postEmail'); // Password reset routes... Route::get('password/reset/{token}', 'Auth\PasswordController@getReset'); Route::post('password/reset', 'Auth\PasswordController@postReset');

:hand: Note As a convenience, the default Laravel auth views are included with Watchtower in the "vendor\smarch\watchtower\src\Views\auth" folder. Simply copy and paste the auth folder to your "root\resources\views" folder on your app to enable them., (*30)

:trident: Why "Watchtower"?

I've been a DC geek for over 30 years now. Watchtower is the name of the floating spacestation the Justice League used to monitor / administer the super heroes. ....coulda been worse. I was thinking of going with OMAC for a while. :smile:, (*31)

The Versions

29/10 2016

dev-master

9999999-dev https://github.com/SmarchSoftware/watchtower

Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel 5

  Sources   Download

MIT

The Requires

 

by Smarch Software

laravel authorization roles permissions rbac admin gui shinobi

17/09 2016

dev-develop

dev-develop https://github.com/SmarchSoftware/watchtower

Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel 5

  Sources   Download

MIT

The Requires

 

by Smarch Software

laravel authorization roles permissions rbac admin gui shinobi

12/08 2016

v1.1.5.4

1.1.5.4 https://github.com/SmarchSoftware/watchtower

Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel 5

  Sources   Download

MIT

The Requires

 

by Smarch Software

laravel authorization roles permissions rbac admin gui shinobi

23/03 2016

v1.1.5.3

1.1.5.3 https://github.com/SmarchSoftware/watchtower

Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel 5

  Sources   Download

MIT

The Requires

 

by Smarch Software

laravel authorization roles permissions rbac admin gui shinobi

02/03 2016

v1.1.5.2

1.1.5.2 https://github.com/SmarchSoftware/watchtower

Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel 5

  Sources   Download

MIT

The Requires

 

by Smarch Software

laravel authorization roles permissions rbac admin gui shinobi

24/02 2016

v1.1.5.1

1.1.5.1 https://github.com/SmarchSoftware/watchtower

Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel 5

  Sources   Download

MIT

The Requires

 

by Smarch Software

laravel authorization roles permissions rbac admin gui shinobi

12/02 2016

v1.1.5

1.1.5.0 https://github.com/SmarchSoftware/watchtower

Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel 5

  Sources   Download

MIT

The Requires

 

by Smarch Software

laravel authorization roles permissions rbac admin gui shinobi

27/01 2016

v1.1.4

1.1.4.0 https://github.com/SmarchSoftware/watchtower

Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel 5

  Sources   Download

MIT

The Requires

 

by Smarch Software

laravel authorization roles permissions rbac admin gui shinobi

25/01 2016

v1.1.3

1.1.3.0 https://github.com/SmarchSoftware/watchtower

Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel 5

  Sources   Download

MIT

The Requires

 

by Smarch Software

laravel authorization roles permissions rbac admin gui shinobi

23/01 2016

v1.1.2

1.1.2.0 https://github.com/SmarchSoftware/watchtower

Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel 5

  Sources   Download

MIT

The Requires

 

by Smarch Software

laravel authorization roles permissions rbac admin gui shinobi

23/01 2016

v1.1.1

1.1.1.0 https://github.com/SmarchSoftware/watchtower

Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel 5

  Sources   Download

MIT

The Requires

 

by Smarch Software

laravel authorization roles permissions rbac admin gui shinobi

13/01 2016

v1.1.0

1.1.0.0 https://github.com/SmarchSoftware/watchtower

Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel 5

  Sources   Download

MIT

The Requires

 

by Smarch Software

laravel authorization roles permissions rbac admin gui shinobi

13/01 2016

v1.0.1.1

1.0.1.1 https://github.com/SmarchSoftware/watchtower

Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel 5.2

  Sources   Download

MIT

The Requires

 

by Smarch Software

laravel authorization roles permissions rbac admin gui shinobi

13/01 2016

v1.0.0.1

1.0.0.1 https://github.com/SmarchSoftware/watchtower

Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel 5.1

  Sources   Download

MIT

The Requires

 

by Smarch Software

laravel authorization roles permissions rbac admin gui shinobi

11/01 2016

v1.0.1

1.0.1.0 https://github.com/SmarchSoftware/watchtower

Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel 5.1

  Sources   Download

MIT

The Requires

 

by Smarch Software

laravel authorization roles permissions rbac admin gui shinobi

05/01 2016

v1.0.0

1.0.0.0 https://github.com/SmarchSoftware/watchtower

Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel 5.1

  Sources   Download

MIT

The Requires

 

by Smarch Software

laravel authorization roles permissions rbac admin gui shinobi

21/12 2015

v0.0.2

0.0.2.0 https://github.com/SmarchSoftware/watchtower

Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel 5.1

  Sources   Download

MIT

The Requires

 

by Smarch Software

laravel authorization roles permissions rbac admin gui shinobi

21/12 2015

v0.0.1

0.0.1.0 https://github.com/SmarchSoftware/watchtower

Front-end for the Shinboi Auth system of Users / Roles / Permissions in Laravel 5.1

  Sources   Download

MIT

The Requires

 

by Smarch Software

laravel authorization roles permissions rbac admin gui shinobi