2017 © Pedro Peláez
 

library lmod-authz

Auth & Authorization system

image

irisit/lmod-authz

Auth & Authorization system

  • Thursday, January 4, 2018
  • by Bouhnosaure
  • Repository
  • 3 Watchers
  • 0 Stars
  • 39 Installations
  • HTML
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 20 Versions
  • 8 % Grown

The README.md

Authz Module

Documentation du module d'authentification et d'authorisation, (*1)

Fonctionnalités

Guest

  • Sign up ✓
  • Sign in ✓
  • Forgot password ✓
  • Reset password ✓

User

  • Edit account information ✓
  • Edit account password ✓

Admin

  • List of users -- Create user ✓ -- Edit user ✓ -- Enable / Disable user -- Send password on new user ✓ -- Assign role to user ✓, (*2)

  • List of permissions -- Parse from source file ✓ -- Edit descriptions, (*3)

  • List of roles -- Create role -- Edit role --- Assign permissions to role, (*4)

Install

Begin by installing this package through Composer. Edit your project's composer.json file to require laravelcollective/html., (*5)

composer require "laravelcollective/html":"^5.4.0", (*6)

Next, add your new provider to the providers array of config/app.php:, (*7)

  'providers' => [
    // ...
    Collective\Html\HtmlServiceProvider::class,
    Irisit\Authz\AuthzServiceProvider::class,
    // ...
  ],

Finally, add two class aliases to the aliases array of config/app.php:, (*8)

  'aliases' => [
    // ...
      'Form' => Collective\Html\FormFacade::class,
      'Html' => Collective\Html\HtmlFacade::class,
    // ...
  ],

Replace all the in the App\User::class, (*9)

<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Irisit\Authz\Models\BaseUser as Authenticatable;

class User extends Authenticatable
{
    use Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'firstname',
        'lastname',
        'email',
        'password',
        'role_id'
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];
}

Replace in migrations the name attribute by, (*10)

$table->string('firstname');
$table->string('lastname'); 

Replace the line in App\Http\Kernel.php, (*11)

'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,, (*12)

by, (*13)

'guest' => \Irisit\Authz\Http\Middleware\RedirectIfAuthenticated::class,, (*14)

And add at the end ( after guest ), (*15)

'role' => \Irisit\Authz\Http\Middleware\RedirectIfNotRole::class,, (*16)

so you can use the middleware 'role' to protect a route or a group like this middleware => 'role:admin,manager', (*17)

Run, (*18)

php artisan db:seed --class=Irisit\Authz\Database\Seeds\DatabaseSeeder, (*19)

Add to config/filesystem.php, (*20)

        'base' => [
            'driver' => 'local',
            'root' => base_path() . DIRECTORY_SEPARATOR,
        ],

Add this to app/Exceptions/Handler.php, (*21)

/**
 * @override
 * @param \Illuminate\Http\Request $request
 * @param AuthenticationException $exception
 * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse|\Illuminate\Http\Response
 */
protected function unauthenticated($request, AuthenticationException $exception)
{
    return $request->expectsJson()
        ? response()->json(['message' => 'Unauthenticated.'], 401)
        : redirect()->guest(route('authz.get_login'));
}

And run php artisan vendor:publish --provider="Irisit\Authz\AuthzServiceProvider" to get the configuration file and the seeder file, (*22)

For the seeder add $this->call(RoleTableSeeder::class); to the /database/seeders/DatabaseSeeder.php, (*23)

The Versions

04/01 2018

dev-master

9999999-dev

Auth & Authorization system

  Sources   Download

MIT

The Requires

 

by monkeyC

04/01 2018

0.1.6

0.1.6.0

Auth & Authorization system

  Sources   Download

MIT

The Requires

 

by monkeyC

02/01 2018

0.1.5

0.1.5.0

Auth & Authorization system

  Sources   Download

MIT

The Requires

 

by monkeyC

27/12 2017

0.1.4

0.1.4.0

Auth & Authorization system

  Sources   Download

MIT

The Requires

 

by monkeyC

27/12 2017

0.1.3

0.1.3.0

Auth & Authorization system

  Sources   Download

MIT

The Requires

 

by monkeyC

27/12 2017

0.1.2

0.1.2.0

Auth & Authorization system

  Sources   Download

MIT

The Requires

 

by monkeyC

20/11 2017

0.1.1

0.1.1.0

Auth & Authorization system

  Sources   Download

MIT

The Requires

 

by monkeyC

05/10 2017

0.1.0

0.1.0.0

Auth & Authorization system

  Sources   Download

MIT

The Requires

 

by monkeyC

16/09 2017

0.0.12

0.0.12.0

Auth & Authorization system

  Sources   Download

MIT

The Requires

 

by monkeyC

16/09 2017

0.0.11

0.0.11.0

Auth & Authorization system

  Sources   Download

MIT

The Requires

 

by monkeyC

16/09 2017

0.0.10

0.0.10.0

Auth & Authorization system

  Sources   Download

MIT

The Requires

 

by monkeyC

16/09 2017

0.0.8

0.0.8.0

Auth & Authorization system

  Sources   Download

MIT

The Requires

 

by monkeyC

16/09 2017

0.0.9

0.0.9.0

Auth & Authorization system

  Sources   Download

MIT

The Requires

 

by monkeyC

16/09 2017

0.0.7

0.0.7.0

Auth & Authorization system

  Sources   Download

MIT

The Requires

 

by monkeyC

16/09 2017

0.0.6

0.0.6.0

Auth & Authorization system

  Sources   Download

MIT

The Requires

 

by monkeyC

15/09 2017

0.0.5

0.0.5.0

Auth & Authorization system

  Sources   Download

MIT

The Requires

 

by monkeyC

15/09 2017

0.0.4

0.0.4.0

Auth & Authorization system

  Sources   Download

MIT

The Requires

 

by monkeyC

13/09 2017

0.0.3

0.0.3.0

Auth & Authorization system

  Sources   Download

MIT

The Requires

 

by monkeyC

04/09 2017

0.0.2

0.0.2.0

Auth & Authorization system

  Sources   Download

MIT

The Requires

 

by monkeyC

22/08 2017

0.0.1

0.0.1.0

Auth & Autorization system

  Sources   Download

MIT

The Requires

 

by monkeyC