-
Notifications
You must be signed in to change notification settings - Fork 22
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
Error page for admin panel #322
base: master
Are you sure you want to change the base?
Conversation
* add a new illustration * show an error page if you dont have permissions to see admin panel content
If this is a trivial change that doesn't warrant a test or changelog entry, you can mark it as #trivial in the PR title. Generated by 🚫 Danger |
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.
Can you include screenshots of the page in the PR description please? In both dark mode & light mode.
@@ -145,6 +145,7 @@ | |||
"errorInsertGoogleEvents": "Unable to insert events in Google Calendar.", | |||
"errorLoadRequests": "Could not load requests", | |||
"errorUnknownUser": "Unknown User", | |||
"errorDontHavePermissions": "You don't have permission to access this page.", |
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.
Nit: rename to "errorNoPermissions"
if (user.isAdmin) { | ||
return true; | ||
} else { | ||
return false; | ||
} |
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.
if (user.isAdmin) { | |
return true; | |
} else { | |
return false; | |
} | |
return user.isAdmin; |
} | ||
|
||
bool checkUserIsAdmin() { | ||
final authProvider = Provider.of<AuthProvider>(context, listen: false); |
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.
I believe listen: false
isn't necessary here. (also now that I look at it it's probably not necessary above either, for the admin provider)
Show an error page if you don't have permission to see admin panel content.