diff options
author | Abyss777 <abyss@fox5.ru> | 2017-01-13 09:26:24 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2017-01-16 16:58:52 +0500 |
commit | 34c878d014a065981d56859cb73564bfa2bc478e (patch) | |
tree | a303aa2f2671faf2c0a4c0870e0aafea5e430ba4 /web/app/view/UsersController.js | |
parent | ede04a679525bb95fcc5ca0a327e8e915f58564e (diff) | |
download | trackermap-web-34c878d014a065981d56859cb73564bfa2bc478e.tar.gz trackermap-web-34c878d014a065981d56859cb73564bfa2bc478e.tar.bz2 trackermap-web-34c878d014a065981d56859cb73564bfa2bc478e.zip |
Initial manager implementation
Diffstat (limited to 'web/app/view/UsersController.js')
-rw-r--r-- | web/app/view/UsersController.js | 26 |
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); } }); |