-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ee96f20
Showing
25 changed files
with
1,514 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/.idea | ||
/vendor | ||
/node_modules | ||
package-lock.json | ||
composer.phar | ||
composer.lock | ||
phpunit.xml | ||
.phpunit.result.cache | ||
.DS_Store | ||
Thumbs.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"name": "pktharindu/nova-permissions", | ||
"description": "Laravel Nova Grouped Permissions (ACL)", | ||
"keywords": [ | ||
"laravel", | ||
"nova", | ||
"tool", | ||
"acl", | ||
"roles", | ||
"permissions", | ||
"access control", | ||
"gates", | ||
"policies", | ||
"authentication", | ||
"authorization" | ||
], | ||
"license": "MIT", | ||
"authors": [{ | ||
"name": "P. K. Tharindu", | ||
"email": "[email protected]" | ||
}], | ||
"require": { | ||
"php": ">=7.1.0", | ||
"benjaminhirsch/nova-slug-field": "^1.1" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Pktharindu\\NovaPermissions\\": "src/" | ||
} | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"Pktharindu\\NovaPermissions\\ToolServiceProvider" | ||
] | ||
} | ||
}, | ||
"config": { | ||
"sort-packages": true | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?php | ||
|
||
return [ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| User model class | ||
|-------------------------------------------------------------------------- | ||
*/ | ||
|
||
'userModel' => 'App\User', | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Nova User resource tool class | ||
|-------------------------------------------------------------------------- | ||
*/ | ||
|
||
'userResource' => 'App\Nova\User', | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| The group associated with the resource | ||
|-------------------------------------------------------------------------- | ||
*/ | ||
|
||
'roleResourceGroup' => 'Other', | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Application Permissions | ||
|-------------------------------------------------------------------------- | ||
*/ | ||
|
||
'permissions' => [ | ||
'view users' => [ | ||
'display_name' => 'View users', | ||
'description' => 'Can view users', | ||
'group' => 'User', | ||
], | ||
|
||
'create users' => [ | ||
'display_name' => 'Create users', | ||
'description' => 'Can create users', | ||
'group' => 'User', | ||
], | ||
|
||
'edit users' => [ | ||
'display_name' => 'Edit users', | ||
'description' => 'Can edit users', | ||
'group' => 'User', | ||
], | ||
|
||
'delete users' => [ | ||
'display_name' => 'Delete users', | ||
'description' => 'Can delete users', | ||
'group' => 'User', | ||
], | ||
|
||
'view roles' => [ | ||
'display_name' => 'View roles', | ||
'description' => 'Can view roles', | ||
'group' => 'Role', | ||
], | ||
|
||
'create roles' => [ | ||
'display_name' => 'Create roles', | ||
'description' => 'Can create roles', | ||
'group' => 'Role', | ||
], | ||
|
||
'edit roles' => [ | ||
'display_name' => 'Edit roles', | ||
'description' => 'Can edit roles', | ||
'group' => 'Role', | ||
], | ||
|
||
'delete roles' => [ | ||
'display_name' => 'Delete roles', | ||
'description' => 'Can delete roles', | ||
'group' => 'Role', | ||
], | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
class CreateGatesTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
// 'admin', 'editor' | ||
Schema::create('roles', function (Blueprint $table) { | ||
$table->bigIncrements('id'); | ||
$table->string('slug'); | ||
$table->string('name')->nullable(); | ||
$table->timestamps(); | ||
}); | ||
Schema::create('role_permission', function (Blueprint $table) { | ||
$table->unsignedBigInteger('role_id'); | ||
$table->string('permission_slug'); | ||
$table->timestamps(); | ||
$table->foreign('role_id') | ||
->references('id') | ||
->on('roles') | ||
->onDelete('cascade'); | ||
$table->primary(['role_id', 'permission_slug']); | ||
}); | ||
Schema::create('role_user', function (Blueprint $table) { | ||
$table->unsignedBigInteger('role_id'); | ||
$table->unsignedBigInteger('user_id'); | ||
$table->timestamps(); | ||
$table->foreign('role_id') | ||
->references('id') | ||
->on('roles') | ||
->onDelete('cascade'); | ||
|
||
$table->foreign('user_id') | ||
->references('id') | ||
->on('users') | ||
->onDelete('cascade'); | ||
$table->primary(['role_id', 'user_id']); | ||
}); | ||
} | ||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('role_permission'); | ||
Schema::dropIfExists('role_user'); | ||
Schema::dropIfExists('roles'); | ||
} | ||
} |
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"/js/tool.js": "/js/tool.js", | ||
"/css/tool.css": "/css/tool.css" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"private": true, | ||
"scripts": { | ||
"dev": "npm run development", | ||
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", | ||
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", | ||
"watch-poll": "npm run watch -- --watch-poll", | ||
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", | ||
"prod": "npm run production", | ||
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" | ||
}, | ||
"devDependencies": { | ||
"cross-env": "^5.0.0", | ||
"laravel-mix": "^1.0", | ||
"laravel-nova": "^1.0.8", | ||
"sass-loader": "^7.1.0" | ||
}, | ||
"dependencies": { | ||
"vue": "^2.5.0" | ||
} | ||
} |
Oops, something went wrong.