Skip to content

Commit 8ba39fd

Browse files
author
Sandip Patel
committed
user permissions fix
1 parent 32bd732 commit 8ba39fd

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/AdminPolicy.php

+1-6
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,9 @@ class AdminPolicy
1414
{
1515
use HandlesAuthorization;
1616

17-
public function allowed($user, $permission=null, $plugin=null)
17+
public function allowed($user, $permission=null)
1818
{
19-
// if user has no access to module
2019
$permission = $permission ?: request()->route()->getName();
21-
if( $plugin && !config('modules.enabled.' .$plugin) ) {
22-
return false;
23-
}
24-
2520
return $user->isSuperAdmin() ?: $user->checkPermission($permission);
2621
}
2722
}

src/LaravelHelper.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@
1111
{
1212
function has_module_permission($module, $permission)
1313
{
14-
if (auth()->user()->can('allowed', $permission, $module))
15-
{
14+
if( $module && !config('modules.enabled.' .$module) ) {
15+
return false;
16+
}
17+
18+
if (auth()->user()->can('allowed', $permission)) {
1619
return true;
1720
}
1821

0 commit comments

Comments
 (0)