-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filament Support Panel #778
Conversation
✔️ All Checks Passed! 🛡️ 0 Security Vulnerabilities You may view the full report here. |
✔️ All Checks Passed! 🛡️ 0 Security Vulnerabilities You may view the full report here. |
✔️ All Checks Passed! 🛡️ 0 Security Vulnerabilities You may view the full report here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great - please address the changes suggested.
app/Models/User.php
Outdated
*/ | ||
public function canAccessPanel(Panel $panel): bool | ||
{ | ||
return $this->hasRole('admin'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey, we should use permissions here instead, like 'view_librarium' and add this new permission to the author role in the role and permission seeder.
app/Policies/UserPolicy.php
Outdated
@@ -16,7 +16,7 @@ class UserPolicy | |||
*/ | |||
public function viewAny(User $user) | |||
{ | |||
return false; | |||
return $user->hasRole('admin'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be view_all_users
app/Policies/UserPolicy.php
Outdated
@@ -49,7 +49,7 @@ public function create(User $user) | |||
public function update(User $user, User $model) | |||
{ | |||
// a user can update their own profile | |||
return $user->id === $model->id; | |||
return $user->id === $model->id or $user->hasRole('admin'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use permission and split in two lines
if($user->can('update_all_users') return true
...
->default() | ||
->id('librarium') | ||
->path('librarium') | ||
->login() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's implement our own login page here, use the base filament page and copy it in App\Filament\Pages\Auth
and refactor so that it uses the same throttling values as our main login flow.
🛡️ 1 Security Vulnerabilities You may view the full report here. |
@@ -47,6 +47,8 @@ public function run() | |||
Permission::findOrCreate('view_telescope'), | |||
Permission::findOrCreate('view_horizon'), | |||
Permission::findOrCreate('view_pulse'), | |||
Permission::findOrCreate('view_any_user'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should just be view_admin_panel
to give access to the filament admin panel, the user view and user update should be based on the user policy.
1ccf019
to
c269d73
Compare
✔️ All Checks Passed! 🛡️ 0 Security Vulnerabilities You may view the full report here. |
✔️ All Checks Passed! 🛡️ 0 Security Vulnerabilities You may view the full report here. |
✔️ All Checks Passed! 🛡️ 0 Security Vulnerabilities You may view the full report here. |
✔️ All Checks Passed! 🛡️ 0 Security Vulnerabilities You may view the full report here. |
✔️ All Checks Passed! 🛡️ 0 Security Vulnerabilities You may view the full report here. |
✔️ All Checks Passed! 🛡️ 0 Security Vulnerabilities You may view the full report here. |
…g to match core login
…g to match core login
9cce5e9
to
43faf29
Compare
✔️ All Checks Passed! 🛡️ 0 Security Vulnerabilities You may view the full report here. |
Implementation of a basic FilamentPHP Support Panel.
Features: