mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-13 10:45:29 +00:00
Make notes widget "generic" (#327)
* Make notes widget "generic" - No longer tied to the "part" model - Will allow us to use it elsewhere * Update release notes * Add helper methods for checking model permissions * Refactoring of permissions checks * Add notes to the "purchase order" widget * Fix typos * remove bom tab from part view * linting fixes
This commit is contained in:
@ -650,16 +650,20 @@ class InvenTreeAPI {
|
||||
* e.g. "part", "change"
|
||||
*/
|
||||
bool checkPermission(String role, String permission) {
|
||||
|
||||
// If we do not have enough information, assume permission is allowed
|
||||
if (roles.isEmpty) {
|
||||
debug("checkPermission - no roles defined!");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!roles.containsKey(role)) {
|
||||
debug("checkPermission - role '$role' not found!");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (roles[role] == null) {
|
||||
debug("checkPermission - role '$role' is null!");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user