From 84ae36567611bb7e28076104a7f346c82b026674 Mon Sep 17 00:00:00 2001 From: Deon George Date: Fri, 14 Oct 2016 19:33:50 +1100 Subject: [PATCH] Added RBAC and migration tools --- app/Http/Kernel.php | 1 + composer.json | 14 +- composer.lock | 619 +++++++++++++++++++++++++++++++++++++++++++- config/acl.php | 30 +++ config/app.php | 3 + 5 files changed, 662 insertions(+), 5 deletions(-) create mode 100644 config/acl.php diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 03aab5d..7ca2fee 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -46,6 +46,7 @@ class Kernel extends HttpKernel * @var array */ protected $routeMiddleware = [ + 'acl' => \Kodeine\Acl\Middleware\HasPermission::class, 'auth' => \Illuminate\Auth\Middleware\Authenticate::class, 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, diff --git a/composer.json b/composer.json index a226153..a9ea073 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,9 @@ "require": { "php": ">=5.6.4", "laravel/framework": "5.3.*", - "igaster/laravel-theme": "^1.1" + "igaster/laravel-theme": "^1.1", + "kodeine/laravel-acl": "~1.0@dev", + "zizaco/entrust": "5.2.x-dev" }, "require-dev": { "fzaninotto/faker": "~1.4", @@ -15,7 +17,9 @@ "phpunit/phpunit": "~5.0", "symfony/css-selector": "3.1.*", "symfony/dom-crawler": "3.1.*", - "phpspec/phpspec": "~2.1" + "phpspec/phpspec": "~2.1", + "xethron/migrations-generator": "dev-l5", + "way/generators": "dev-feature/laravel-five-stable" }, "autoload": { "classmap": [ @@ -49,5 +53,11 @@ }, "config": { "preferred-install": "dist" + }, + "repositories": { + "repo-name": { + "type": "git", + "url": "git@github.com:jamisonvalenta/Laravel-4-Generators.git" + } } } diff --git a/composer.lock b/composer.lock index d495c8c..f3830a9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "5420c35d34c400b749222ce4bc4e0014", - "content-hash": "aef9d557239f1271f947b99e43950818", + "hash": "fd8a419d9a2734637c4687f62c775c55", + "content-hash": "3b307ae506baac8c15ee27ed67cfc0eb", "packages": [ { "name": "classpreloader/classpreloader", @@ -362,6 +362,53 @@ ], "time": "2015-12-05 17:17:57" }, + { + "name": "kodeine/laravel-acl", + "version": "1.0.x-dev", + "source": { + "type": "git", + "url": "https://github.com/kodeine/laravel-acl.git", + "reference": "b0851b4d2ab113e210ee81432e659b8996f4fa86" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kodeine/laravel-acl/zipball/b0851b4d2ab113e210ee81432e659b8996f4fa86", + "reference": "b0851b4d2ab113e210ee81432e659b8996f4fa86", + "shasum": "" + }, + "require": { + "illuminate/support": "~5.0", + "php": ">=5.5.9" + }, + "type": "library", + "autoload": { + "psr-4": { + "Kodeine\\Acl\\": "src/Kodeine/Acl" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ahsen M.", + "homepage": "https://github.com/kodeine", + "role": "Developer" + } + ], + "description": "Light-weight role-based permissions for Laravel 5 built in Auth system.", + "keywords": [ + "acl", + "auth", + "eloquent", + "laravel", + "permissions", + "roles", + "security" + ], + "time": "2016-09-20 15:17:28" + }, { "name": "laravel/framework", "version": "v5.3.18", @@ -1922,9 +1969,425 @@ "environment" ], "time": "2016-09-01 10:05:43" + }, + { + "name": "zizaco/entrust", + "version": "5.2.x-dev", + "source": { + "type": "git", + "url": "https://github.com/Zizaco/entrust.git", + "reference": "b749bff868026336dec1ba1a16c150728697353d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Zizaco/entrust/zipball/b749bff868026336dec1ba1a16c150728697353d", + "reference": "b749bff868026336dec1ba1a16c150728697353d", + "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-03-24 15:24:42" } ], "packages-dev": [ + { + "name": "doctrine/annotations", + "version": "v1.2.7", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/f25c8aab83e0c3e976fd7d19875f198ccf2f7535", + "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "php": ">=5.3.2" + }, + "require-dev": { + "doctrine/cache": "1.*", + "phpunit/phpunit": "4.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Annotations\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "time": "2015-08-31 12:32:49" + }, + { + "name": "doctrine/cache", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "f8af318d14bdb0eff0336795b428b547bd39ccb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/f8af318d14bdb0eff0336795b428b547bd39ccb6", + "reference": "f8af318d14bdb0eff0336795b428b547bd39ccb6", + "shasum": "" + }, + "require": { + "php": "~5.5|~7.0" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "phpunit/phpunit": "~4.8|~5.0", + "predis/predis": "~1.0", + "satooshi/php-coveralls": "~0.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Caching library offering an object-oriented API for many cache backends", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "cache", + "caching" + ], + "time": "2015-12-31 16:37:02" + }, + { + "name": "doctrine/collections", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/collections.git", + "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/collections/zipball/6c1e4eef75f310ea1b3e30945e9f06e652128b8a", + "reference": "6c1e4eef75f310ea1b3e30945e9f06e652128b8a", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Collections\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Collections Abstraction library", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "array", + "collections", + "iterator" + ], + "time": "2015-04-14 22:21:58" + }, + { + "name": "doctrine/common", + "version": "v2.6.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/common.git", + "reference": "a579557bc689580c19fee4e27487a67fe60defc0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/common/zipball/a579557bc689580c19fee4e27487a67fe60defc0", + "reference": "a579557bc689580c19fee4e27487a67fe60defc0", + "shasum": "" + }, + "require": { + "doctrine/annotations": "1.*", + "doctrine/cache": "1.*", + "doctrine/collections": "1.*", + "doctrine/inflector": "1.*", + "doctrine/lexer": "1.*", + "php": "~5.5|~7.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.8|~5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "lib/Doctrine/Common" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common Library for Doctrine projects", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "collections", + "eventmanager", + "persistence", + "spl" + ], + "time": "2015-12-25 13:18:31" + }, + { + "name": "doctrine/dbal", + "version": "v2.5.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/dbal.git", + "reference": "9f8c05cd5225a320d56d4bfdb4772f10d045a0c9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/9f8c05cd5225a320d56d4bfdb4772f10d045a0c9", + "reference": "9f8c05cd5225a320d56d4bfdb4772f10d045a0c9", + "shasum": "" + }, + "require": { + "doctrine/common": ">=2.4,<2.7-dev", + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "4.*", + "symfony/console": "2.*||^3.0" + }, + "suggest": { + "symfony/console": "For helpful console commands such as SQL execution and import of files." + }, + "bin": [ + "bin/doctrine-dbal" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\DBAL\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Database Abstraction Layer", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database", + "dbal", + "persistence", + "queryobject" + ], + "time": "2016-09-09 19:13:33" + }, { "name": "doctrine/instantiator", "version": "1.0.5", @@ -1979,6 +2442,60 @@ ], "time": "2015-06-14 21:17:01" }, + { + "name": "doctrine/lexer", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Lexer\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "lexer", + "parser" + ], + "time": "2014-09-09 13:34:57" + }, { "name": "fzaninotto/faker", "version": "v1.6.0", @@ -3555,6 +4072,45 @@ "homepage": "https://symfony.com", "time": "2016-09-25 08:27:07" }, + { + "name": "way/generators", + "version": "dev-feature/laravel-five-stable", + "source": { + "type": "git", + "url": "git@github.com:jamisonvalenta/Laravel-4-Generators.git", + "reference": "a358bb44f517e2b3c1fd4f848f2646857c75b3a4" + }, + "require": { + "illuminate/support": "~5.0", + "php": ">=5.4.0" + }, + "require-dev": { + "behat/behat": "~2.5.1", + "behat/mink": "~1.5.0", + "behat/mink-extension": "~1.2.0", + "behat/mink-goutte-driver": "~1.0.9", + "behat/mink-selenium2-driver": "~1.1.1", + "phpspec/phpspec": "~2.0", + "phpunit/phpunit": "~3.7" + }, + "type": "library", + "autoload": { + "psr-0": { + "Way\\Generators": "src/" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jeffrey Way", + "email": "jeffrey@jeffrey-way.com" + } + ], + "description": "Rapidly generate resources, migrations, models, and much more.", + "time": "2015-02-17 06:26:25" + }, { "name": "webmozart/assert", "version": "1.1.0", @@ -3604,11 +4160,68 @@ "validate" ], "time": "2016-08-09 15:02:57" + }, + { + "name": "xethron/migrations-generator", + "version": "dev-l5", + "source": { + "type": "git", + "url": "https://github.com/Xethron/migrations-generator.git", + "reference": "e5e86efb5731e6859ea0d96a806159f9f2c26ce1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Xethron/migrations-generator/zipball/e5e86efb5731e6859ea0d96a806159f9f2c26ce1", + "reference": "e5e86efb5731e6859ea0d96a806159f9f2c26ce1", + "shasum": "" + }, + "require": { + "doctrine/dbal": "~2.4", + "illuminate/support": ">=4.1", + "php": ">=5.4.0", + "way/generators": "dev-feature/laravel-five-stable" + }, + "require-dev": { + "illuminate/cache": ">=4.1.0", + "illuminate/console": ">=4.1.0", + "mockery/mockery": ">=0.9.0", + "phpunit/phpunit": ">=4.0.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Xethron\\MigrationsGenerator": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Breytenbach", + "email": "bernhard@coffeecode.co.za" + } + ], + "description": "Generates Laravel Migrations from an existing database", + "keywords": [ + "artisan", + "generator", + "laravel", + "migration", + "migrations" + ], + "time": "2015-02-23 05:43:08" } ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "kodeine/laravel-acl": 20, + "zizaco/entrust": 20, + "xethron/migrations-generator": 20, + "way/generators": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/config/acl.php b/config/acl.php new file mode 100644 index 0000000..72c6c1d --- /dev/null +++ b/config/acl.php @@ -0,0 +1,30 @@ + 'Kodeine\Acl\Models\Eloquent\Role', + 'permission' => 'Kodeine\Acl\Models\Eloquent\Permission', + + /** + * Most Permissive Wins right + * If you have multiple permission aliases assigned, each alias + * has a common permission, view.house => false, but one alias + * has it set to true. If this right is enabled, true value + * wins the race, ie the most permissive wins. + */ + + 'most_permissive_wins' => false, + + /** + * Cache Minutes + * Set the minutes that roles and permissions will be cached. + */ + + 'cacheMinutes' => 1, +]; diff --git a/config/app.php b/config/app.php index 505dc52..af124d7 100644 --- a/config/app.php +++ b/config/app.php @@ -164,6 +164,9 @@ return [ Illuminate\Validation\ValidationServiceProvider::class, Illuminate\View\ViewServiceProvider::class, igaster\laravelTheme\themeServiceProvider::class, + Kodeine\Acl\AclServiceProvider::class, + Way\Generators\GeneratorsServiceProvider::class, + Xethron\MigrationsGenerator\MigrationsGeneratorServiceProvider::class, /* * Package Service Providers...