aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-10-08 16:01:12 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-10-08 16:01:12 +1300
commit58d7f195375a8d32f5260da7d4cea437ad564223 (patch)
tree787254e771859e57022fab32d4062ffd78afb3b3
parent06e0f5fd8f32e8f0fbcbce6efd2fcc759b718689 (diff)
downloadtrackermap-web-58d7f195375a8d32f5260da7d4cea437ad564223.tar.gz
trackermap-web-58d7f195375a8d32f5260da7d4cea437ad564223.tar.bz2
trackermap-web-58d7f195375a8d32f5260da7d4cea437ad564223.zip
Implement user readonly flag
-rw-r--r--web/app/model/User.js3
-rw-r--r--web/app/view/DevicesController.js2
-rw-r--r--web/app/view/SettingsMenuController.js2
-rw-r--r--web/app/view/UserDialog.js7
-rw-r--r--web/app/view/UserDialogController.js1
5 files changed, 13 insertions, 2 deletions
diff --git a/web/app/model/User.js b/web/app/model/User.js
index e9eec18c..8c7638f8 100644
--- a/web/app/model/User.js
+++ b/web/app/model/User.js
@@ -32,6 +32,9 @@ Ext.define('Traccar.model.User', {
name: 'password',
type: 'string'
}, {
+ name: 'readonly',
+ type: 'boolean'
+ }, {
name: 'admin',
type: 'boolean'
}, {
diff --git a/web/app/view/DevicesController.js b/web/app/view/DevicesController.js
index 89da779f..02463241 100644
--- a/web/app/view/DevicesController.js
+++ b/web/app/view/DevicesController.js
@@ -45,7 +45,7 @@ Ext.define('Traccar.view.DevicesController', {
},
init: function () {
- var readonly = Traccar.app.getServer().get('readonly') && !Traccar.app.getUser().get('admin');
+ var readonly = Traccar.app.getPreference('readonly', false) && !Traccar.app.getUser().get('admin');
this.lookupReference('toolbarAddButton').setVisible(!readonly);
this.lookupReference('toolbarEditButton').setVisible(!readonly);
this.lookupReference('toolbarRemoveButton').setVisible(!readonly);
diff --git a/web/app/view/SettingsMenuController.js b/web/app/view/SettingsMenuController.js
index 7a2b718b..eee0097b 100644
--- a/web/app/view/SettingsMenuController.js
+++ b/web/app/view/SettingsMenuController.js
@@ -34,7 +34,7 @@ Ext.define('Traccar.view.SettingsMenuController', {
init: function () {
var admin, readonly;
admin = Traccar.app.getUser().get('admin');
- readonly = Traccar.app.getServer().get('readonly');
+ readonly = Traccar.app.getPreference('readonly', false);
if (admin) {
this.lookupReference('settingsServerButton').setHidden(false);
this.lookupReference('settingsUsersButton').setHidden(false);
diff --git a/web/app/view/UserDialog.js b/web/app/view/UserDialog.js
index 92e3c5b8..f717da72 100644
--- a/web/app/view/UserDialog.js
+++ b/web/app/view/UserDialog.js
@@ -44,6 +44,13 @@ Ext.define('Traccar.view.UserDialog', {
allowBlank: false
}, {
xtype: 'checkboxfield',
+ name: 'readonly',
+ fieldLabel: Strings.serverReadonly,
+ allowBlank: false,
+ disabled: true,
+ reference: 'readonlyField'
+ }, {
+ xtype: 'checkboxfield',
name: 'admin',
fieldLabel: Strings.userAdmin,
allowBlank: false,
diff --git a/web/app/view/UserDialogController.js b/web/app/view/UserDialogController.js
index d7d19ff3..98d0edef 100644
--- a/web/app/view/UserDialogController.js
+++ b/web/app/view/UserDialogController.js
@@ -22,6 +22,7 @@ Ext.define('Traccar.view.UserDialogController', {
init: function () {
if (Traccar.app.getUser().get('admin')) {
this.lookupReference('adminField').setDisabled(false);
+ this.lookupReference('readonlyField').setDisabled(false);
}
},