Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
pktharindu committed Mar 23, 2019
0 parents commit ee96f20
Show file tree
Hide file tree
Showing 25 changed files with 1,514 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitignore
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
43 changes: 43 additions & 0 deletions composer.json
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
}
83 changes: 83 additions & 0 deletions config/novapermissions.php
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',
],
],
];
58 changes: 58 additions & 0 deletions database/migrations/create_gates_table.php.stub
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 added dist/css/tool.css
Empty file.
1 change: 1 addition & 0 deletions dist/js/tool.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions dist/mix-manifest.json
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"
}
21 changes: 21 additions & 0 deletions package.json
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"
}
}
Loading

0 comments on commit ee96f20

Please sign in to comment.