Skip to content

Commit

Permalink
Nova User Management
Browse files Browse the repository at this point in the history
Init.php
ActionEventPolicy.php
- update permissions
  • Loading branch information
anditsung committed May 19, 2020
1 parent f40f523 commit 8f9d21d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/Commands/Init.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ private function systemPermissions()
{
return [
'viewNova' => 'System',
'viewAny actions' => 'ActionResource',
'view actions' => 'ActionResource',
];
}
Expand Down
14 changes: 5 additions & 9 deletions src/Policies/ActionEventPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,15 @@ class ActionEventPolicy
{
public function viewAny($user)
{
try {
return $user->hasPermissionTo('view actions');
} catch (\Exception $exception) {
return true;
}
return $user->hasPermissionTo('viewAny actions');
}

public function view($user)
public function view($user, $model)
{
try {
return $user->hasPermissionTo('view actions');
} catch (\Exception $exception) {
if( $user->hasPermissionTo('view actions') ) {
return true;
}

return $user->id == $model->user_id;
}
}

0 comments on commit 8f9d21d

Please sign in to comment.