Implement authentication and access control

This commit is contained in:
Zaid Abdulla committed 2018-12-26 00:22:07 -08:00
1 parent e1bdcda191
commit 327cb78f1a
27 files changed
+600 -167

No files matched your search

+8 -5
View File
@@ -8,11 +8,14 @@ import * as store from "./store";
import * as components from "./components";
function init(args) {
return new Promise(resolve => {
resolve({
deviceId: args.id,
deviceFilter: new Filter(["=", "DeviceID.ID", args.id])
});
if (!window.authorizer.hasAccess("devices", 2))
return Promise.reject(
new Error("You are not authorized to view this page")
);
return Promise.resolve({
deviceId: args.id,
deviceFilter: new Filter(["=", "DeviceID.ID", args.id])
});
}