Skip to content
This repository was archived by the owner on Dec 24, 2020. It is now read-only.

Commit b4dbf1d

Browse files
author
Gerardo Ibarra
committed
first commit
0 parents  commit b4dbf1d

11 files changed

+243
-0
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; More information at http://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
indent_size = 4
9+
indent_style = space
10+
end_of_line = lf
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.md]
15+
trim_trailing_whitespace = false

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea/
2+
vendor/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Gerardo Ibarra
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

composer.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "gpibarra/laravel-permission-manager",
3+
"type": "library",
4+
"description": "Laravel Permission Manager",
5+
"keywords": [
6+
"laravel","RBAC","Permission"
7+
],
8+
"homepage": "https://github.com/gpibarra/laravel-permission-manager",
9+
"license": "MIT",
10+
"authors": [
11+
{
12+
"name": "Gerardo Ibarra",
13+
"email": "[email protected]"
14+
}
15+
],
16+
"require": {
17+
"laravel/framework": "^5.5",
18+
},
19+
"require-dev": {
20+
"phpunit/phpunit": "~6.0",
21+
"laracasts/generators": "^1.1"
22+
},
23+
"autoload": {
24+
"psr-4": {
25+
"gpibarra\\LaravelPermissionManager\\": "src"
26+
}
27+
},
28+
"autoload-dev": {
29+
"psr-4": {
30+
"gpibarra\\LaravelPermissionManager\\Test\\": "tests"
31+
}
32+
},
33+
"scripts": {
34+
"test": "phpunit"
35+
},
36+
"extra": {
37+
"laravel": {
38+
"providers": [
39+
"gpibarra\\LaravelPermissionManager\\LaravelPermissionManagerServiceProvider"
40+
]
41+
}
42+
}
43+
}

phpunit.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit backupGlobals="false"
3+
backupStaticAttributes="false"
4+
bootstrap="vendor/autoload.php"
5+
colors="true"
6+
convertErrorsToExceptions="true"
7+
convertNoticesToExceptions="true"
8+
convertWarningsToExceptions="true"
9+
processIsolation="false"
10+
stopOnFailure="false"
11+
syntaxCheck="false"
12+
>
13+
<testsuites>
14+
<testsuite name="Package Test Suite">
15+
<directory suffix=".php">./tests/</directory>
16+
</testsuite>
17+
</testsuites>
18+
</phpunit>
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?php
2+
3+
namespace gpibarra\LaravelPermissionManager;
4+
5+
use Illuminate\Routing\Router;
6+
use Illuminate\Support\ServiceProvider;
7+
use Route;
8+
9+
class LaravelPermissionManagerServiceProvider extends ServiceProvider
10+
{
11+
/**
12+
* Indicates if loading of the provider is deferred.
13+
*
14+
* @var bool
15+
*/
16+
protected $defer = false;
17+
18+
/**
19+
* Bootstrap services.
20+
*
21+
* @return void
22+
*/
23+
public function boot()
24+
{
25+
//VIEWS
26+
// - first the published views (in case they have any changes)
27+
$this->loadViewsFrom(resource_path('views/vendor/gpibarra/LaravelPermissionManager'), 'LaravelPermissionManager');
28+
// - then the stock views that come with the package, in case a published view might be missing
29+
$this->loadViewsFrom(realpath(__DIR__.'/resources/views'), 'LaravelPermissionManager');
30+
31+
// publish lang files
32+
$this->publishes([__DIR__.'/resources/lang' => resource_path('lang/vendor/gpibarra')], 'lang');
33+
34+
$this->loadTranslationsFrom(realpath(__DIR__.'/resources/lang'), 'gpibarra');
35+
36+
// publish views
37+
$this->publishes([__DIR__.'/resources/views' => resource_path('views/vendor/gpibarra/LaravelPermissionManager')], 'views');
38+
39+
// publish public PermissionManager assets
40+
$this->publishes([__DIR__.'/public' => public_path('vendor/gpibarra')], 'public');
41+
42+
//CONFIG
43+
// use the vendor configuration file as fallback
44+
$this->mergeConfigFrom(
45+
__DIR__.'/config/LaravelPermissionManager.php', 'LaravelPermissionManager'
46+
);
47+
48+
// publish config file
49+
$this->publishes([__DIR__.'/config' => config_path()], 'config');
50+
51+
52+
//Routes
53+
$routeFilePath = '/routes/laravelapermissionmanager.php';
54+
// by default, use the routes file provided in vendor
55+
$routeFilePathInUse = __DIR__.$this->routeFilePath;
56+
57+
// but if there's a file with the same name in routes/backpack, use that one
58+
if (file_exists(base_path().$this->routeFilePath)) {
59+
$routeFilePathInUse = base_path().$this->routeFilePath;
60+
}
61+
62+
$this->loadRoutesFrom($routeFilePathInUse);
63+
64+
65+
// //Helpers
66+
// require_once __DIR__.'/helpers.php';
67+
68+
}
69+
70+
/**
71+
* Register services.
72+
*
73+
* @return void
74+
*/
75+
public function register()
76+
{
77+
//
78+
}
79+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| Look & feel customizations
8+
|--------------------------------------------------------------------------
9+
|
10+
| Make it yours.
11+
|
12+
*/
13+
14+
15+
16+
];
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| gpibarra\LaravelPermissionManager Language Lines
8+
|--------------------------------------------------------------------------
9+
*/
10+
11+
12+
];
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| gpibarra\LaravelPermissionManagar Language Lines
8+
|--------------------------------------------------------------------------
9+
*/
10+
];
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
/*
4+
|--------------------------------------------------------------------------
5+
| gpibarra\LaravelPermissionManager Routes
6+
|--------------------------------------------------------------------------
7+
|
8+
| This file is where you may define all of the routes that are
9+
| handled by the gpibarra\LaravelPermissionManager package.
10+
|
11+
*/
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
use PHPUnit\Framework\TestCase as BaseTestCase;
4+
5+
class LaravelPermissionManagerTest extends BaseTestCase
6+
{
7+
/**
8+
* A basic test example.
9+
*
10+
* @return void
11+
*/
12+
public function testExample()
13+
{
14+
$this->assertTrue(true);
15+
}
16+
}

0 commit comments

Comments
 (0)