aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/UsersController.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-01-18 09:32:54 +1300
committerGitHub <noreply@github.com>2017-01-18 09:32:54 +1300
commit6171c7275a32c3ad9653aafaf673ab93254c8d1a (patch)
tree49828903f03061e2f72fc35130055927c8a346fc /web/app/view/UsersController.js
parent4d092d96d6d872096abaf2f9883d2b578c5c8f72 (diff)
parent75828393fd64389be296c95bc67144b0c742cf48 (diff)
downloadtrackermap-web-6171c7275a32c3ad9653aafaf673ab93254c8d1a.tar.gz
trackermap-web-6171c7275a32c3ad9653aafaf673ab93254c8d1a.tar.bz2
trackermap-web-6171c7275a32c3ad9653aafaf673ab93254c8d1a.zip
Merge pull request #385 from Abyss777/manager
Implement user management
Diffstat (limited to 'web/app/view/UsersController.js')
-rw-r--r--web/app/view/UsersController.js26
1 files changed, 22 insertions, 4 deletions
diff --git a/web/app/view/UsersController.js b/web/app/view/UsersController.js
index af9d47b2..8aaa8397 100644
--- a/web/app/view/UsersController.js
+++ b/web/app/view/UsersController.js
@@ -1,6 +1,6 @@
/*
- * Copyright 2015 - 2016 Anton Tananaev (anton@traccar.org)
- * Copyright 2016 Andrey Kunitsyn (andrey@traccar.org)
+ * Copyright 2015 - 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2017 Andrey Kunitsyn (andrey@traccar.org)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -26,6 +26,7 @@ Ext.define('Traccar.view.UsersController', {
'Traccar.view.UserGroups',
'Traccar.view.UserGeofences',
'Traccar.view.UserCalendars',
+ 'Traccar.view.UserUsers',
'Traccar.view.Notifications',
'Traccar.view.BaseWindow',
'Traccar.model.User'
@@ -33,6 +34,7 @@ Ext.define('Traccar.view.UsersController', {
init: function () {
Ext.getStore('Users').load();
+ this.lookupReference('userUsersButton').setHidden(!Traccar.app.getUser().get('admin'));
},
onAddClick: function () {
@@ -147,8 +149,23 @@ Ext.define('Traccar.view.UsersController', {
}).show();
},
- onSelectionChange: function (selected) {
- var disabled = selected.length > 0;
+ onUsersClick: function () {
+ var user = this.getView().getSelectionModel().getSelection()[0];
+ Ext.create('Traccar.view.BaseWindow', {
+ title: Strings.settingsUsers,
+ items: {
+ xtype: 'userUsersView',
+ baseObjectName: 'userId',
+ linkObjectName: 'managedUserId',
+ storeName: 'Users',
+ urlApi: 'api/permissions/users',
+ baseObject: user.getId()
+ }
+ }).show();
+ },
+
+ onSelectionChange: function (selection, selected) {
+ var disabled = selected.length === 0;
this.lookupReference('toolbarEditButton').setDisabled(disabled);
this.lookupReference('toolbarRemoveButton').setDisabled(disabled);
this.lookupReference('userDevicesButton').setDisabled(disabled);
@@ -156,5 +173,6 @@ Ext.define('Traccar.view.UsersController', {
this.lookupReference('userGeofencesButton').setDisabled(disabled);
this.lookupReference('userNotificationsButton').setDisabled(disabled);
this.lookupReference('userCalendarsButton').setDisabled(disabled);
+ this.lookupReference('userUsersButton').setDisabled(disabled || selected[0].get('userLimit') === 0);
}
});