use laratrust to replace entrust #78
This commit is contained in:
parent
936349cbeb
commit
5bedbba2a7
@ -6,7 +6,6 @@ use Faker\Generator as Faker;
|
||||
* Add any number of airports. Don't really care if they're real or not
|
||||
*/
|
||||
$factory->define(App\Models\Airport::class, function (Faker $faker) {
|
||||
|
||||
return [
|
||||
'id' => strtoupper($faker->unique()->text(5)),
|
||||
'icao' => function(array $apt) { return $apt['id']; },
|
||||
|
@ -37,68 +37,6 @@ class CreateUsersTable extends Migration
|
||||
$table->index('email');
|
||||
$table->index('api_key');
|
||||
});
|
||||
|
||||
// Create table for storing roles
|
||||
Schema::create('roles', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name')->unique();
|
||||
$table->string('display_name')->nullable();
|
||||
$table->string('description')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
// Create table for associating roles to users (Many-to-Many)
|
||||
Schema::create('role_user', function (Blueprint $table) {
|
||||
$table->unsignedInteger('user_id');
|
||||
$table->unsignedInteger('role_id');
|
||||
|
||||
$table->foreign('user_id')->references('id')->on('users')
|
||||
->onUpdate('cascade')->onDelete('cascade');
|
||||
$table->foreign('role_id')->references('id')->on('roles')
|
||||
->onUpdate('cascade')->onDelete('cascade');
|
||||
|
||||
$table->primary(['user_id', 'role_id']);
|
||||
$table->index(['role_id', 'user_id']);
|
||||
});
|
||||
|
||||
// Create table for storing permissions
|
||||
Schema::create('permissions', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name')->unique();
|
||||
$table->string('display_name')->nullable();
|
||||
$table->string('description')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
// Create table for associating permissions to roles (Many-to-Many)
|
||||
Schema::create('permission_role', function (Blueprint $table) {
|
||||
$table->unsignedInteger('permission_id');
|
||||
$table->unsignedInteger('role_id');
|
||||
|
||||
$table->foreign('permission_id')->references('id')->on('permissions')
|
||||
->onUpdate('cascade')->onDelete('cascade');
|
||||
$table->foreign('role_id')->references('id')->on('roles')
|
||||
->onUpdate('cascade')->onDelete('cascade');
|
||||
|
||||
$table->primary(['permission_id', 'role_id']);
|
||||
});
|
||||
|
||||
# create a default user/role
|
||||
$roles = [
|
||||
[
|
||||
'id' => 1,
|
||||
'name' => 'admin',
|
||||
'display_name' => 'Administrators',
|
||||
],
|
||||
[
|
||||
'id' => 2,
|
||||
'name' => 'user',
|
||||
'display_name' => 'Pilot'
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
$this->addData('roles', $roles);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,9 +47,5 @@ class CreateUsersTable extends Migration
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
Schema::dropIfExists('permission_role');
|
||||
Schema::dropIfExists('permissions');
|
||||
Schema::dropIfExists('role_user');
|
||||
Schema::dropIfExists('roles');
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class RolesPermissionsTables extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
// Create table for storing roles
|
||||
Schema::create('roles', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name')->unique();
|
||||
$table->string('display_name')->nullable();
|
||||
$table->string('description')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
// Create table for storing permissions
|
||||
Schema::create('permissions', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name')->unique();
|
||||
$table->string('display_name')->nullable();
|
||||
$table->string('description')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
// Create table for associating roles to users and teams (Many To Many Polymorphic)
|
||||
Schema::create('role_user', function (Blueprint $table) {
|
||||
$table->unsignedInteger('role_id');
|
||||
$table->unsignedInteger('user_id');
|
||||
$table->string('user_type');
|
||||
|
||||
$table->foreign('role_id')->references('id')->on('roles')
|
||||
->onUpdate('cascade')->onDelete('cascade');
|
||||
|
||||
$table->primary(['user_id', 'role_id', 'user_type']);
|
||||
});
|
||||
|
||||
// Create table for associating permissions to users (Many To Many Polymorphic)
|
||||
Schema::create('permission_user', function (Blueprint $table) {
|
||||
$table->unsignedInteger('permission_id');
|
||||
$table->unsignedInteger('user_id');
|
||||
$table->string('user_type');
|
||||
|
||||
$table->foreign('permission_id')->references('id')->on('permissions')
|
||||
->onUpdate('cascade')->onDelete('cascade');
|
||||
|
||||
$table->primary(['user_id', 'permission_id', 'user_type']);
|
||||
});
|
||||
|
||||
// Create table for associating permissions to roles (Many-to-Many)
|
||||
Schema::create('permission_role', function (Blueprint $table) {
|
||||
$table->unsignedInteger('permission_id');
|
||||
$table->unsignedInteger('role_id');
|
||||
|
||||
$table->foreign('permission_id')->references('id')->on('permissions')
|
||||
->onUpdate('cascade')->onDelete('cascade');
|
||||
$table->foreign('role_id')->references('id')->on('roles')
|
||||
->onUpdate('cascade')->onDelete('cascade');
|
||||
|
||||
$table->primary(['permission_id', 'role_id']);
|
||||
});
|
||||
|
||||
# create a default user/role
|
||||
$roles = [
|
||||
[
|
||||
'id' => 1,
|
||||
'name' => 'admin',
|
||||
'display_name' => 'Administrators',
|
||||
],
|
||||
[
|
||||
'id' => 2,
|
||||
'name' => 'user',
|
||||
'display_name' => 'Pilot'
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
$this->addData('roles', $roles);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('permission_user');
|
||||
Schema::dropIfExists('permission_role');
|
||||
Schema::dropIfExists('permissions');
|
||||
Schema::dropIfExists('role_user');
|
||||
Schema::dropIfExists('roles');
|
||||
}
|
||||
}
|
@ -55,12 +55,16 @@ users:
|
||||
role_user:
|
||||
- user_id: 1
|
||||
role_id: 1
|
||||
user_type: App\Models\User
|
||||
- user_id: 1
|
||||
role_id: 2
|
||||
user_type: App\Models\User
|
||||
- user_id: 2
|
||||
role_id: 2
|
||||
user_type: App\Models\User
|
||||
- user_id: 3
|
||||
role_id: 2
|
||||
user_type: App\Models\User
|
||||
|
||||
# ranks
|
||||
ranks:
|
||||
|
@ -54,8 +54,8 @@ class Kernel extends HttpKernel
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'role' => \Zizaco\Entrust\Middleware\EntrustRole::class,
|
||||
'permission' => \Zizaco\Entrust\Middleware\EntrustPermission::class,
|
||||
'ability' => \Zizaco\Entrust\Middleware\EntrustAbility::class,
|
||||
#'role' => \Laratrust\Middleware\LaratrustRole::class,
|
||||
#'permission' => \Laratrust\Middleware\LaratrustPermission::class,
|
||||
#'ability' => \Laratrust\Middleware\LaratrustAbility::class,
|
||||
];
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ class RedirectIfAuthenticated
|
||||
public function handle($request, Closure $next, $guard = null)
|
||||
{
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect('/home');
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
use Zizaco\Entrust\EntrustPermission;
|
||||
use Laratrust\Models\LaratrustPermission;
|
||||
|
||||
class Permission extends EntrustPermission
|
||||
class Permission extends LaratrustPermission
|
||||
{
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
use Zizaco\Entrust\EntrustRole;
|
||||
use Laratrust\Models\LaratrustRole;
|
||||
|
||||
class Role extends EntrustRole
|
||||
class Role extends LaratrustRole
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Zizaco\Entrust\Traits\EntrustUserTrait;
|
||||
use Laratrust\Traits\LaratrustUserTrait;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Contracts\Auth\CanResetPassword;
|
||||
|
||||
@ -20,12 +20,12 @@ use Illuminate\Contracts\Auth\CanResetPassword;
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @mixin \Illuminate\Notifications\Notifiable
|
||||
* @mixin \Zizaco\Entrust\Traits\EntrustUserTrait
|
||||
* @mixin \Laratrust\Traits\LaratrustUserTrait
|
||||
*/
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use Notifiable;
|
||||
use EntrustUserTrait;
|
||||
use LaratrustUserTrait;
|
||||
//use SoftDeletes;
|
||||
|
||||
public $table = 'users';
|
||||
|
@ -60,11 +60,11 @@ class DatabaseService extends BaseService
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
#try {
|
||||
DB::table($table)->insert($row);
|
||||
} catch(QueryException $e) {
|
||||
Log::info($e->getMessage());
|
||||
}
|
||||
#} catch(QueryException $e) {
|
||||
# Log::info($e->getMessage());
|
||||
#}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
{
|
||||
"name": "phpvms/phpvms",
|
||||
"version": "7.0.0-dev",
|
||||
"description": "phpVMS - Virtual Airline Administration",
|
||||
@ -23,7 +23,6 @@
|
||||
"doctrine/dbal": "v2.5.12",
|
||||
"doctrine/inflector": "v1.1.0",
|
||||
"doctrine/instantiator": "v1.0.5",
|
||||
"zizaco/entrust": "5.2.x-dev",
|
||||
"prettus/l5-repository": "2.6.28",
|
||||
"spatie/laravel-pjax": "1.3.1",
|
||||
"symfony/inflector": "v3.4.0",
|
||||
@ -45,6 +44,7 @@
|
||||
"sebastiaanluca/laravel-helpers": "1.0.2",
|
||||
"jackiedo/timezonelist": "5.x",
|
||||
"tivie/php-os-detector": "1.1.0",
|
||||
"santigarcor/laratrust": "5.0.3",
|
||||
"nabeel/vacentral": "dev-master"
|
||||
},
|
||||
"require-dev": {
|
||||
|
273
composer.lock
generated
273
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "f657a54ce87b561f6f413f836cbd20a3",
|
||||
"content-hash": "a34f3d409e7a3e41c650c2c201b3e2e7",
|
||||
"packages": [
|
||||
{
|
||||
"name": "composer/semver",
|
||||
@ -427,7 +427,7 @@
|
||||
"Doctrine\\DBAL\\": "lib/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -750,7 +750,7 @@
|
||||
"Egulias\\EmailValidator\\": "EmailValidator"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -796,7 +796,7 @@
|
||||
"Parsedown": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -856,7 +856,7 @@
|
||||
"GuzzleHttp\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -914,7 +914,7 @@
|
||||
"src/functions_include.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -969,7 +969,7 @@
|
||||
"src/functions_include.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -1031,7 +1031,7 @@
|
||||
"Hashids\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -1138,7 +1138,7 @@
|
||||
"InfyOm\\AdminLTETemplates\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -1199,7 +1199,7 @@
|
||||
"src/helpers.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -1249,7 +1249,7 @@
|
||||
"Jackiedo\\Timezonelist\\": "src/Jackiedo/Timezonelist"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -1326,6 +1326,51 @@
|
||||
],
|
||||
"time": "2016-12-07T09:37:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "kkszymanowski/traitor",
|
||||
"version": "0.2.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/KKSzymanowski/Traitor.git",
|
||||
"reference": "05462468d0592545448f1a2877d045f5048abea1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/KKSzymanowski/Traitor/zipball/05462468d0592545448f1a2877d045f5048abea1",
|
||||
"reference": "05462468d0592545448f1a2877d045f5048abea1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"nikic/php-parser": "^1.0|^2.0|^3.0",
|
||||
"php": ">=5.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.1"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Traitor\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kuba Szymanowski",
|
||||
"email": "kuba.szymanowski@inf24.pl"
|
||||
}
|
||||
],
|
||||
"description": "Add a trait use statement to existing PHP class",
|
||||
"keywords": [
|
||||
"add",
|
||||
"php",
|
||||
"trait"
|
||||
],
|
||||
"time": "2017-08-28T11:34:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laracasts/flash",
|
||||
"version": "3.0.2",
|
||||
@ -1495,7 +1540,7 @@
|
||||
"Illuminate\\": "src/Illuminate/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -2024,7 +2069,7 @@
|
||||
"Cron\\": "src/Cron/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -2073,7 +2118,7 @@
|
||||
"src/DeepCopy/deep_copy.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -2117,7 +2162,7 @@
|
||||
"VaCentral\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -2211,7 +2256,7 @@
|
||||
"PhpParser\\": "lib/PhpParser"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
@ -2644,7 +2689,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -2797,7 +2842,7 @@
|
||||
"Prophecy\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -2915,7 +2960,7 @@
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
@ -3056,7 +3101,7 @@
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
@ -3137,7 +3182,7 @@
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
@ -3260,7 +3305,7 @@
|
||||
"Prettus\\Repository\\": "src/Prettus/Repository/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -3685,6 +3730,75 @@
|
||||
],
|
||||
"time": "2017-03-25T12:08:31+00:00"
|
||||
},
|
||||
{
|
||||
"name": "santigarcor/laratrust",
|
||||
"version": "5.0.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/santigarcor/laratrust.git",
|
||||
"reference": "dcded937608c4b8e356968597903925a61fa06c5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/santigarcor/laratrust/zipball/dcded937608c4b8e356968597903925a61fa06c5",
|
||||
"reference": "dcded937608c4b8e356968597903925a61fa06c5",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/auth": "~5.2",
|
||||
"illuminate/cache": "~5.2",
|
||||
"illuminate/console": "~5.2",
|
||||
"illuminate/database": "^5.2.32",
|
||||
"illuminate/support": "~5.2",
|
||||
"kkszymanowski/traitor": "^0.2.0",
|
||||
"php": ">=5.5.9"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": ">=0.9.9",
|
||||
"orchestra/testbench": "~3.2",
|
||||
"phpunit/phpunit": ">=4.1"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Laratrust\\LaratrustServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"Laratrust": "Laratrust\\LaratrustFacade"
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Laratrust\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Santiago Garcia",
|
||||
"homepage": "http://santigarcor.me"
|
||||
}
|
||||
],
|
||||
"description": "This package provides a flexible way to add Role-based Permissions to Laravel",
|
||||
"keywords": [
|
||||
"Teams",
|
||||
"acl",
|
||||
"authorization",
|
||||
"laratrust",
|
||||
"laravel",
|
||||
"multiusers",
|
||||
"permissions",
|
||||
"php",
|
||||
"rbac",
|
||||
"roles"
|
||||
],
|
||||
"time": "2017-12-02T21:56:51+00:00"
|
||||
},
|
||||
{
|
||||
"name": "scriptfusion/phpunit-immediate-exception-printer",
|
||||
"version": "1.3.0",
|
||||
@ -3863,7 +3977,7 @@
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
@ -4438,7 +4552,7 @@
|
||||
"src/helpers.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -4621,7 +4735,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -4730,7 +4844,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -4898,7 +5012,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -4952,7 +5066,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -5040,7 +5154,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -5241,7 +5355,7 @@
|
||||
"bootstrap.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -5298,7 +5412,7 @@
|
||||
"bootstrap.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -5357,7 +5471,7 @@
|
||||
"Resources/stubs"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -5409,7 +5523,7 @@
|
||||
"Symfony\\Polyfill\\Util\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -5464,7 +5578,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -5521,7 +5635,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -5604,7 +5718,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -5688,7 +5802,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -5756,7 +5870,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -5821,7 +5935,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -6014,7 +6128,7 @@
|
||||
"Tivie\\OS\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"APACHE 2.0"
|
||||
],
|
||||
@ -6235,7 +6349,7 @@
|
||||
"Webpatser\\Uuid": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -6364,7 +6478,7 @@
|
||||
"src/helper.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -6421,7 +6535,7 @@
|
||||
"Zend\\Diactoros\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-2-Clause"
|
||||
],
|
||||
@ -6433,74 +6547,6 @@
|
||||
"psr-7"
|
||||
],
|
||||
"time": "2017-10-12T15:24:51+00:00"
|
||||
},
|
||||
{
|
||||
"name": "zizaco/entrust",
|
||||
"version": "5.2.x-dev",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Zizaco/entrust.git",
|
||||
"reference": "3623cc052937d9e62543402b50f24065720d44b9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Zizaco/entrust/zipball/3623cc052937d9e62543402b50f24065720d44b9",
|
||||
"reference": "3623cc052937d9e62543402b50f24065720d44b9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/cache": "~5.0",
|
||||
"illuminate/console": "~5.0",
|
||||
"illuminate/support": "~5.0",
|
||||
"php": ">=5.5.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"illuminate/database": "~5.0",
|
||||
"mockery/mockery": "dev-master",
|
||||
"phpunit/phpunit": "~4.1",
|
||||
"sami/sami": "dev-master"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/commands"
|
||||
],
|
||||
"psr-4": {
|
||||
"Zizaco\\Entrust\\": "src/Entrust/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Andrew Elkins",
|
||||
"homepage": "http://andrewelkins.com"
|
||||
},
|
||||
{
|
||||
"name": "Zizaco Zizuini",
|
||||
"email": "zizaco@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Ben Batschelet",
|
||||
"homepage": "http://github.com/bbatsche"
|
||||
},
|
||||
{
|
||||
"name": "Michele Angioni",
|
||||
"email": "michele.angioni@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "This package provides a flexible way to add Role-based Permissions to Laravel",
|
||||
"keywords": [
|
||||
"acl",
|
||||
"auth",
|
||||
"illuminate",
|
||||
"laravel",
|
||||
"permission",
|
||||
"roles"
|
||||
],
|
||||
"time": "2016-12-29T06:25:06+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
@ -6715,7 +6761,7 @@
|
||||
"Whoops\\": "src/Whoops/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -7107,7 +7153,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -7131,7 +7177,6 @@
|
||||
"stability-flags": {
|
||||
"infyomlabs/laravel-generator": 20,
|
||||
"infyomlabs/adminlte-templates": 20,
|
||||
"zizaco/entrust": 20,
|
||||
"makinacorpus/php-bloom": 20,
|
||||
"nabeel/vacentral": 20
|
||||
},
|
||||
|
@ -57,7 +57,6 @@ return [
|
||||
Prettus\Repository\Providers\RepositoryServiceProvider::class,
|
||||
InfyOm\Generator\InfyOmGeneratorServiceProvider::class,
|
||||
InfyOm\AdminLTETemplates\AdminLTETemplatesServiceProvider::class,
|
||||
Zizaco\Entrust\EntrustServiceProvider::class,
|
||||
Spatie\Fractal\FractalServiceProvider::class,
|
||||
SebastiaanLuca\Helpers\Methods\GlobalHelpersServiceProvider::class,
|
||||
SebastiaanLuca\Helpers\Collections\CollectionMacrosServiceProvider::class,
|
||||
@ -86,7 +85,6 @@ return [
|
||||
'Crypt' => Illuminate\Support\Facades\Crypt::class,
|
||||
'DB' => Illuminate\Support\Facades\DB::class,
|
||||
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
|
||||
'Entrust' => Zizaco\Entrust\EntrustFacade::class,
|
||||
'Event' => Illuminate\Support\Facades\Event::class,
|
||||
'File' => Illuminate\Support\Facades\File::class,
|
||||
'Flash' => Laracasts\Flash\Flash::class,
|
||||
|
@ -1,92 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of Entrust,
|
||||
* a role & permission management solution for Laravel.
|
||||
*
|
||||
* @license MIT
|
||||
* @package Zizaco\Entrust
|
||||
*/
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Entrust Role Model
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the Role model used by Entrust to create correct relations. Update
|
||||
| the role if it is in a different namespace.
|
||||
|
|
||||
*/
|
||||
'role' => 'App\Models\Role',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Entrust Roles Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the roles table used by Entrust to save roles to the database.
|
||||
|
|
||||
*/
|
||||
'roles_table' => 'roles',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Entrust Permission Model
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the Permission model used by Entrust to create correct relations.
|
||||
| Update the permission if it is in a different namespace.
|
||||
|
|
||||
*/
|
||||
'permission' => 'App\Models\Permission',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Entrust Permissions Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the permissions table used by Entrust to save permissions to the
|
||||
| database.
|
||||
|
|
||||
*/
|
||||
'permissions_table' => 'permissions',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Entrust permission_role Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the permission_role table used by Entrust to save relationship
|
||||
| between permissions and roles to the database.
|
||||
|
|
||||
*/
|
||||
'permission_role_table' => 'permission_role',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Entrust role_user Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the role_user table used by Entrust to save assigned roles to the
|
||||
| database.
|
||||
|
|
||||
*/
|
||||
'role_user_table' => 'role_user',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| User Foreign key on Entrust's role_user Table (Pivot)
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'user_foreign_key' => 'user_id',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Role Foreign key on Entrust's role_user Table (Pivot)
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'role_foreign_key' => 'role_id',
|
||||
|
||||
];
|
210
config/laratrust.php
Normal file
210
config/laratrust.php
Normal file
@ -0,0 +1,210 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of Laratrust,
|
||||
* a role & permission management solution for Laravel.
|
||||
*
|
||||
* @license MIT
|
||||
* @package Laratrust
|
||||
*/
|
||||
|
||||
return [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Use MorphMap in relationships between models
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If true, the morphMap feature is going to be used. The array values that
|
||||
| are going to be used are the ones inside the 'user_models' array.
|
||||
|
|
||||
*/
|
||||
'use_morph_map' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Use cache in the package
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Defines if Laratrust will use Laravel's Cache to cache the roles and permissions.
|
||||
|
|
||||
*/
|
||||
'use_cache' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Use teams feature in the package
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Defines if Laratrust will use the teams feature.
|
||||
| Please check the docs to see what you need to do in case you have the package already configured.
|
||||
|
|
||||
*/
|
||||
'use_teams' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Strict check for roles/permissions inside teams
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Determines if a strict check should be done when checking if a role or permission
|
||||
| is attached inside a team.
|
||||
| If it's false, when checking a role/permission without specifying the team,
|
||||
| it will check only if the user has attached that role/permission ignoring the team.
|
||||
|
|
||||
*/
|
||||
'teams_strict_check' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laratrust User Models
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the array that contains the information of the user models.
|
||||
| This information is used in the add-trait command, and for the roles and
|
||||
| permissions relationships with the possible user models.
|
||||
|
|
||||
| The key in the array is the name of the relationship inside the roles and permissions.
|
||||
|
|
||||
*/
|
||||
'user_models' => [
|
||||
'users' => 'App\Models\User',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laratrust Models
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These are the models used by Laratrust to define the roles, permissions and teams.
|
||||
| If you want the Laratrust models to be in a different namespace or
|
||||
| to have a different name, you can do it here.
|
||||
|
|
||||
*/
|
||||
'models' => [
|
||||
/**
|
||||
* Role model
|
||||
*/
|
||||
'role' => 'App\Models\Role',
|
||||
|
||||
/**
|
||||
* Permission model
|
||||
*/
|
||||
'permission' => 'App\Models\Permission',
|
||||
|
||||
/**
|
||||
* Team model
|
||||
*/
|
||||
'team' => 'App\Team',
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laratrust Tables
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These are the tables used by Laratrust to store all the authorization data.
|
||||
|
|
||||
*/
|
||||
'tables' => [
|
||||
/**
|
||||
* Roles table.
|
||||
*/
|
||||
'roles' => 'roles',
|
||||
|
||||
/**
|
||||
* Permissions table.
|
||||
*/
|
||||
'permissions' => 'permissions',
|
||||
|
||||
/**
|
||||
* Teams table.
|
||||
*/
|
||||
'teams' => 'teams',
|
||||
|
||||
/**
|
||||
* Role - User intermediate table.
|
||||
*/
|
||||
'role_user' => 'role_user',
|
||||
|
||||
/**
|
||||
* Permission - User intermediate table.
|
||||
*/
|
||||
'permission_user' => 'permission_user',
|
||||
|
||||
/**
|
||||
* Permission - Role intermediate table.
|
||||
*/
|
||||
'permission_role' => 'permission_role',
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laratrust Foreign Keys
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These are the foreign keys used by laratrust in the intermediate tables.
|
||||
|
|
||||
*/
|
||||
'foreign_keys' => [
|
||||
/**
|
||||
* User foreign key on Laratrust's role_user and permission_user tables.
|
||||
*/
|
||||
'user' => 'user_id',
|
||||
|
||||
/**
|
||||
* Role foreign key on Laratrust's role_user and permission_role tables.
|
||||
*/
|
||||
'role' => 'role_id',
|
||||
|
||||
/**
|
||||
* Role foreign key on Laratrust's permission_user and permission_role tables.
|
||||
*/
|
||||
'permission' => 'permission_id',
|
||||
|
||||
/**
|
||||
* Role foreign key on Laratrust's role_user and permission_user tables.
|
||||
*/
|
||||
'team' => 'team_id',
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laratrust Middleware
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This configuration helps to customize the Laratrust middleware behavior.
|
||||
|
|
||||
*/
|
||||
'middleware' => [
|
||||
/**
|
||||
* Define if the laratrust middleware are registered automatically in the service provider
|
||||
*/
|
||||
'register' => true,
|
||||
|
||||
/**
|
||||
* Method to be called in the middleware return case.
|
||||
* Available: abort|redirect
|
||||
*/
|
||||
'handling' => 'abort',
|
||||
|
||||
/**
|
||||
* Parameter passed to the middleware_handling method
|
||||
*/
|
||||
'params' => '403',
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Laratrust Magic 'can' Method
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Supported cases for the magic can method (Refer to the docs).
|
||||
| Available: camel_case|snake_case|kebab_case
|
||||
|
|
||||
*/
|
||||
'magic_can_method_case' => 'kebab_case',
|
||||
];
|
@ -51,7 +51,11 @@ class EnvironmentService
|
||||
if(\extension_loaded('apc')) {
|
||||
$opts['CACHE_DRIVER'] = 'apc';
|
||||
} else {
|
||||
$opts['CACHE_DRIVER'] = 'array';
|
||||
if($opts['APP_ENV'] === 'dev') {
|
||||
$opts['CACHE_DRIVER'] = 'array';
|
||||
} else {
|
||||
$opts['CACHE_DRIVER'] = 'file';
|
||||
}
|
||||
}
|
||||
|
||||
return $opts;
|
||||
|
@ -95,14 +95,15 @@
|
||||
<p>Profile</p>
|
||||
</a>
|
||||
</li>
|
||||
@if(Entrust::hasRole('admin'))
|
||||
|
||||
@role('admin')
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{!! url('/admin') !!}">
|
||||
<i class="fa fa-circle-o-notch" aria-hidden="true"></i>
|
||||
<p>Admin</p>
|
||||
</a>
|
||||
</li>
|
||||
@endif
|
||||
@endrole
|
||||
|
||||
{{-- Show the module links for being logged out --}}
|
||||
@foreach($moduleSvc->getFrontendLinks($logged_in=true) as &$link)
|
||||
|
@ -24,8 +24,10 @@ users:
|
||||
role_user:
|
||||
- user_id: 1
|
||||
role_id: 1
|
||||
user_type: App\Models\User
|
||||
- user_id: 1
|
||||
role_id: 2
|
||||
user_type: App\Models\User
|
||||
|
||||
ranks:
|
||||
- id: 1
|
||||
|
Loading…
Reference in New Issue
Block a user