Commit 21fe7052 authored by Leander Schulten's avatar Leander Schulten
Browse files

You can now only change the position of a device when you have the CHANGE_POSITION permission

parent 1c55d3c8
Pipeline #164955 passed with stage
in 6 minutes and 59 seconds
......@@ -153,7 +153,7 @@ ColumnLayout{
drag.minimumY: 0
drag.maximumX: map.width - 5
drag.maximumY: map.height - 5
drag.threshold: 0
drag.threshold: UserManagment.currentUser.havePermission(Permission.CHANGE_POSITION) ? 0 : 999999; // "disable dragging"
onReleased: {
// If we dont use variables the y coordinate gets resetted after setting modelData.position.x
var newX = parent.x + 2 * parent.selectScale - map.translation.x;
......@@ -230,6 +230,7 @@ ColumnLayout{
text:"x:"
}
TextInputField{
enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_POSITION);
Layout.minimumWidth: 50
text: deviceInfo.device ? deviceInfo.device.position.x : ""
validator: IntValidator{}
......@@ -240,6 +241,7 @@ ColumnLayout{
text:"y:"
}
TextInputField{
enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_POSITION);
text: deviceInfo.device ? deviceInfo.device.position.y : ""
validator: IntValidator{}
onTextChanged:if(deviceInfo.device) deviceInfo.device.position.y = text.length?text:-1
......
......@@ -107,6 +107,7 @@ ModelView{
onTextChanged: if(deviceModelView.currentModelData) deviceModelView.currentModelData.position.y = text.length?text:0
}
Button{
enabled: UserManagment.currentUser.havePermission(Permission.CHANGE_POSITION);
visible: deviceModelView.currentModelData ? deviceModelView.placeOnMapCallback && deviceModelView.currentModelData.position.x === -1 || deviceModelView.currentModelData.position.x === -1 : false
text: "Place on map"
onClicked: deviceModelView.placeOnMapCallback(deviceModelView.currentModelData)
......
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