Implement device permissions REST API

This commit is contained in:
Anton Tananaev committed 2015-12-07 10:44:16 +13:00
1 parent e5b4453271
commit 8ce214876c
3 files changed
+78 -6

No files matched your search

+14 -5
View File
@@ -47,24 +47,33 @@ Ext.define('Traccar.view.UserDevicesController', {
onBeforeSelect: function (object, record, index) {
Ext.Ajax.request({
scope: this,
url: '/api/device/link',
params: {
url: '/api/rest/permissions',
jsonData: {
userId: this.userId,
deviceId: record.getData().id
},
callback: Traccar.app.getErrorHandler()
callback: function (options, success, response) {
if (!success) {
Traccar.app.showError(response);
}
}
});
},
onBeforeDeselect: function (object, record, index) {
Ext.Ajax.request({
scope: this,
method: 'DELETE',
url: '/api/device/unlink',
params: {
jsonData: {
userId: this.userId,
deviceId: record.getData().id
},
callback: Traccar.app.getErrorHandler()
callback: function (options, success, response) {
if (!success) {
Traccar.app.showError(response);
}
}
});
}
});