mirror of
https://github.com/traccar/traccar.git
synced 2026-08-07 05:52:01 -04:00
Implement device permissions REST API
This commit is contained in:
1 parent
e5b4453271
commit
8ce214876c
3 files changed
+78
-6
No files matched your search
@@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user