mirror of
https://github.com/inventree/InvenTree.git
synced 2026-11-25 09:13:08 +00:00
feat: Add facility to completely hide parts of the interface (#12842)
* fix typing issue for pylance engine * add flags to mark rough function of setting * update pr version * fix settings serialisation * render security warnings * move Transfer Orders * respect return order hiding * almost all confirm texts will have a warning * add settings for sales, purchase and buildorder deactivation * make permission check also ensure gloablsetting for view is available; reduce number of chained gates * document possible missing check * ensure we can still show the sales tab * add additional warning to group cleanup * hide more ui parts conditionally * add tests for new code and remove duplication * fix test * alternative approach to fix SSO path * remove patch; now done in serializer * ignore ldap section
This commit is contained in:
1 parent
1afe583ea5
commit
63a434c652
40 files changed
+339
-157
No files matched your search
@@ -53,3 +53,11 @@ export function userRoleLabel(role: UserRoles): string {
|
||||
return role as string;
|
||||
}
|
||||
}
|
||||
|
||||
export const roleToViewSettingMap: Partial<Record<UserRoles, string>> = {
|
||||
[UserRoles.build]: 'BUILDORDER_ENABLED',
|
||||
[UserRoles.sales_order]: 'SALESORDER_ENABLED',
|
||||
[UserRoles.purchase_order]: 'PURCHASEORDER_ENABLED',
|
||||
[UserRoles.transfer_order]: 'TRANSFERORDER_ENABLED',
|
||||
[UserRoles.return_order]: 'RETURNORDER_ENABLED'
|
||||
};
|
||||
@@ -16,6 +16,12 @@ export enum SettingType {
|
||||
Model = 'related field'
|
||||
}
|
||||
|
||||
export enum SettingFlag {
|
||||
TOGGLE = 'org.inventree.settingsflag.function_toggle',
|
||||
INTERNAL = 'org.inventree.settingsflag.internal',
|
||||
SECURITY = 'org.inventree.settingsflag.security'
|
||||
}
|
||||
|
||||
// Type interface defining a single 'setting' object
|
||||
export interface Setting {
|
||||
pk: number;
|
||||
@@ -36,6 +42,7 @@ export interface Setting {
|
||||
read_only?: boolean;
|
||||
confirm?: boolean;
|
||||
confirm_text?: string;
|
||||
flags: SettingFlag[];
|
||||
}
|
||||
|
||||
export interface SettingChoice {
|
||||
|
||||
@@ -47,6 +47,7 @@ export interface UserStateProps {
|
||||
hasChangeRole: (role: UserRoles) => boolean;
|
||||
hasAddRole: (role: UserRoles) => boolean;
|
||||
hasViewRole: (role: UserRoles) => boolean;
|
||||
hasViewVisible: (role: UserRoles) => boolean;
|
||||
checkUserPermission: (
|
||||
model: ModelType,
|
||||
permission: UserPermissions
|
||||
|
||||
Reference in new issue
Block a user