Commit 26c9516d authored by Leander Schulten's avatar Leander Schulten

Permissions: Remove Settings_Tab permission and add permissions for the individual settings

parent 04a8b72c
Pipeline #195774 passed with stage
in 4 minutes and 36 seconds
...@@ -4,6 +4,7 @@ import QtQuick.Controls.Material 2.12 ...@@ -4,6 +4,7 @@ import QtQuick.Controls.Material 2.12
import QtQuick.Layouts 1.12 import QtQuick.Layouts 1.12
import QtQuick.Dialogs 1.3 as SystemDialog import QtQuick.Dialogs 1.3 as SystemDialog
import QtQuick.Window 2.12 import QtQuick.Window 2.12
import custom.licht 1.0
import "components" import "components"
Pane{ Pane{
...@@ -17,6 +18,7 @@ Pane{ ...@@ -17,6 +18,7 @@ Pane{
} }
RowLayout{ RowLayout{
id: root id: root
enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_SETTINGS_FILE_PATH)
Item{ Item{
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredWidth: inputSettingsPath.implicitWidth Layout.preferredWidth: inputSettingsPath.implicitWidth
...@@ -67,6 +69,7 @@ Pane{ ...@@ -67,6 +69,7 @@ Pane{
text: "Driver file path:" text: "Driver file path:"
} }
TextFieldFileChooser{ TextFieldFileChooser{
enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_DMX_DRIVER_LIB)
Layout.fillWidth: true Layout.fillWidth: true
folder: false folder: false
path: Settings.driverFilePath path: Settings.driverFilePath
...@@ -78,6 +81,7 @@ Pane{ ...@@ -78,6 +81,7 @@ Pane{
text: "Update pause for dmx in ms:" text: "Update pause for dmx in ms:"
} }
TextInputField{ TextInputField{
enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_DMX_UPDATE_RATE)
validator: IntValidator{ validator: IntValidator{
bottom: 10 bottom: 10
top: 10000 top: 10000
...@@ -91,6 +95,7 @@ Pane{ ...@@ -91,6 +95,7 @@ Pane{
text: "Module Directory:" text: "Module Directory:"
} }
TextFieldFileChooser{ TextFieldFileChooser{
enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_MODULE_SETTINGS)
Layout.fillWidth: true Layout.fillWidth: true
folder: true folder: true
path: Settings.moduleDirPath path: Settings.moduleDirPath
...@@ -103,6 +108,7 @@ Pane{ ...@@ -103,6 +108,7 @@ Pane{
text: "Compiler File Path:" text: "Compiler File Path:"
} }
TextFieldFileChooser{ TextFieldFileChooser{
enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_MODULE_SETTINGS)
Layout.fillWidth: true Layout.fillWidth: true
folder: true folder: true
path: Settings.compilerPath path: Settings.compilerPath
...@@ -115,6 +121,7 @@ Pane{ ...@@ -115,6 +121,7 @@ Pane{
text: "Include Path:" text: "Include Path:"
} }
TextFieldFileChooser{ TextFieldFileChooser{
enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_MODULE_SETTINGS)
Layout.fillWidth: true Layout.fillWidth: true
folder: true folder: true
path: Settings.includePath path: Settings.includePath
...@@ -127,6 +134,7 @@ Pane{ ...@@ -127,6 +134,7 @@ Pane{
text: "Compiler Flags:" text: "Compiler Flags:"
} }
TextInputField{ TextInputField{
enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_MODULE_SETTINGS)
Layout.fillWidth: true Layout.fillWidth: true
text: Settings.compilerFlags text: Settings.compilerFlags
onAccepted: Settings.compilerFlags = text; onAccepted: Settings.compilerFlags = text;
...@@ -137,6 +145,7 @@ Pane{ ...@@ -137,6 +145,7 @@ Pane{
text: "Compiler Library Flags:" text: "Compiler Library Flags:"
} }
TextInputField{ TextInputField{
enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_MODULE_SETTINGS)
Layout.fillWidth: true Layout.fillWidth: true
text: Settings.compilerLibraryFlags text: Settings.compilerLibraryFlags
onAccepted: Settings.compilerLibraryFlags = text; onAccepted: Settings.compilerLibraryFlags = text;
...@@ -158,6 +167,7 @@ Pane{ ...@@ -158,6 +167,7 @@ Pane{
text: "Theme:" text: "Theme:"
} }
Button{ Button{
enabled: UserManagment.currentUser.havePermission(Permission.MODIFY_THEME)
text: "Modify Theme and appearance" text: "Modify Theme and appearance"
onClicked: modifyThemeWindow.show() onClicked: modifyThemeWindow.show()
} }
......
...@@ -109,7 +109,6 @@ ApplicationWindow { ...@@ -109,7 +109,6 @@ ApplicationWindow {
} }
VerticalTabButton { VerticalTabButton {
text: qsTr("Settings") text: qsTr("Settings")
enabled: UserManagment.currentUser.havePermission(Permission.SETTINGS_TAB);
} }
VerticalTabButton { VerticalTabButton {
text: qsTr("Modules") text: qsTr("Modules")
......
...@@ -46,13 +46,37 @@ public: ...@@ -46,13 +46,37 @@ public:
/** /**
* @brief The Permission enum contains all Permissions a User can have * @brief The Permission enum contains all Permissions a User can have
*/ */
enum Permission{ enum Permission {
Admin=0, Read=1, Write=2, Admin = 0,
ADD_DEVICE=3,REMOVE_DEVICE=4,CHANGE_POSITION=5, CHANGE_NAME=6,CHANGE_DEVICE_DMX_CHANNEL=7, Read = 1,
DEVICE_TAB=8,DEVICE_PROTOTYPE_TAB=9,PROGRAMM_PROTOTYPE_TAY=10,PROGRAMM_TAB=11, Write = 2,
MOVE_CONTROL_ITEM=12, ADD_CONTROL_ITEM=13, CHANGE_GROUP_NAME=14, CHANGE_GROUP_DEVICES=15, CHANGE_MIN_MAX_MAPPING=16, CHANGE_TIMEOUTS=17, REMOVE_CONTROL_ITEM=18, ADD_DEVICE = 3,
SETTINGS_TAB=19, MODULES_TAB=20, MODULE_PROGRAMS_TAB=21, CHANGE_CONTROL_ITEM_VISIBILITY=22, REMOVE_DEVICE = 4,
LAST_PERMISSION=23 CHANGE_POSITION = 5,
CHANGE_NAME = 6,
CHANGE_DEVICE_DMX_CHANNEL = 7,
DEVICE_TAB = 8,
DEVICE_PROTOTYPE_TAB = 9,
PROGRAMM_PROTOTYPE_TAY = 10,
PROGRAMM_TAB = 11,
MOVE_CONTROL_ITEM = 12,
ADD_CONTROL_ITEM = 13,
CHANGE_GROUP_NAME = 14,
CHANGE_GROUP_DEVICES = 15,
CHANGE_MIN_MAX_MAPPING = 16,
CHANGE_TIMEOUTS = 17,
REMOVE_CONTROL_ITEM = 18,
// SETTINGS_TAB = 19,
MODULES_TAB = 20,
MODULE_PROGRAMS_TAB = 21,
CHANGE_CONTROL_ITEM_VISIBILITY = 22,
CHANGE_DMX_DRIVER_LIB = 23,
CHANGE_DMX_UPDATE_RATE = 24,
CHANGE_SETTINGS_FILE_PATH = 25,
CHANGE_MODULE_SETTINGS = 26,
MODIFY_THEME = 27,
SAVE_SLIDE_SHOW_SETTINGS = 28,
LAST_PERMISSION = 29,
}; };
Q_ENUM(Permission) Q_ENUM(Permission)
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment