1
0
mirror of https://github.com/Kovah/LinkAce.git synced 2025-01-17 21:28:30 +01:00

Remove the Laravel Permissions package (#36)

This commit is contained in:
Kovah 2019-03-01 14:15:14 +01:00
parent 4e22e33923
commit f4981c5677
No known key found for this signature in database
GPG Key ID: AAAA031BA9830D7B
6 changed files with 6 additions and 92 deletions

View File

@ -30,11 +30,6 @@ class RegisterUserCommand extends Command
*/
protected $description = 'Register a new user';
private $user_roles = [
'admin',
'user',
];
/**
* RegisterUser constructor.
*/
@ -69,16 +64,12 @@ class RegisterUserCommand extends Command
$password = $this->secret('Please enter a password for ' . $name);
$role = $this->choice('Please choose the user role:', $this->user_roles, 'user');
$new_user = User::create([
'name' => $name,
'email' => $email,
'password' => Hash::make($password),
]);
$new_user->assignRole($role);
$this->info('User ' . $name . ' registered.');
return;
}

View File

@ -19,10 +19,6 @@ class SystemSettingsController extends Controller
*/
public function getSystemSettings()
{
if (!auth()->user()->hasRole('admin')) {
abort(403);
}
return view('actions.settings.system');
}
@ -42,10 +38,6 @@ class SystemSettingsController extends Controller
*/
public function generateCronToken(Request $request)
{
if (!auth()->user()->hasRole('admin')) {
abort(403);
}
$new_token = Str::random(32);
Setting::updateOrCreate(

View File

@ -4,7 +4,6 @@ namespace App\Models;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Spatie\Permission\Traits\HasRoles;
/**
* Class User
@ -21,7 +20,6 @@ use Spatie\Permission\Traits\HasRoles;
class User extends Authenticatable
{
use Notifiable;
use HasRoles;
/**
* The attributes that are mass assignable.

View File

@ -12,7 +12,6 @@
"laravel/tinker": "^1.0",
"predis/predis": "^1.1",
"shaarli/netscape-bookmark-parser": "^2.1",
"spatie/laravel-permission": "^2.31",
"vinkla/alert": "^3.0.0",
"watson/rememberable": "^2.0"
},

68
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "61ecf329332d3fe2925409dede678144",
"content-hash": "313cf8fe91a97df39b0ea11a2008533a",
"packages": [
{
"name": "dnoegel/php-xdg-base-dir",
@ -2385,71 +2385,6 @@
],
"time": "2018-10-06T14:43:38+00:00"
},
{
"name": "spatie/laravel-permission",
"version": "2.31.0",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-permission.git",
"reference": "5f9960854295c6aec1c706aaa3b146962d6ee905"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-permission/zipball/5f9960854295c6aec1c706aaa3b146962d6ee905",
"reference": "5f9960854295c6aec1c706aaa3b146962d6ee905",
"shasum": ""
},
"require": {
"illuminate/auth": "~5.3.0|~5.4.0|~5.5.0|~5.6.0|~5.7.0",
"illuminate/container": "~5.3.0|~5.4.0|~5.5.0|~5.6.0|~5.7.0",
"illuminate/contracts": "~5.3.0|~5.4.0|~5.5.0|~5.6.0|~5.7.0",
"illuminate/database": "~5.4.0|~5.5.0|~5.6.0|~5.7.0",
"php": ">=7.0"
},
"require-dev": {
"orchestra/testbench": "~3.4.2|~3.5.0|~3.6.0|~3.7.0",
"phpunit/phpunit": "^5.7|6.2|^7.0",
"predis/predis": "^1.1"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Spatie\\Permission\\PermissionServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Spatie\\Permission\\": "src"
},
"files": [
"src/helpers.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Freek Van der Herten",
"email": "freek@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
}
],
"description": "Permission handling for Laravel 5.4 and up",
"homepage": "https://github.com/spatie/laravel-permission",
"keywords": [
"acl",
"laravel",
"permission",
"security",
"spatie"
],
"time": "2019-02-04T03:56:54+00:00"
},
{
"name": "swiftmailer/swiftmailer",
"version": "v6.1.3",
@ -3574,6 +3509,7 @@
"flash",
"laravel"
],
"abandoned": "laracasts/flash",
"time": "2018-08-23T11:35:12+00:00"
},
{

View File

@ -94,12 +94,10 @@
<a href="{{ route('get-export') }}" class="dropdown-item">
@lang('export.export')
</a>
@role('admin')
<div class="dropdown-divider"></div>
<a href="{{ route('get-sysstemsettings') }}" class="dropdown-item">
@lang('settings.system_settings')
</a>
@endrole
<div class="dropdown-divider"></div>
<a href="{{ route('get-sysstemsettings') }}" class="dropdown-item">
@lang('settings.system_settings')
</a>
</div>
</li>
@endguest