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

+16 -7
View File
@@ -6,26 +6,35 @@ const menu = {
view: vnode => {
const active = { [vnode.attrs.page]: "active" };
return m(
"nav",
m("ul", [
let tabs = [];
if (window.authorizer.hasAccess("devices", 1))
tabs.push(
m(
"li",
{ class: active["overview"] },
m("a", { href: "#!/overview" }, "Overview")
),
)
);
if (window.authorizer.hasAccess("devices", 2))
tabs.push(
m(
"li",
{ class: active["devices"] },
m("a", { href: "#!/devices" }, "Devices")
),
)
);
if (window.authorizer.hasAccess("faults", 2))
tabs.push(
m(
"li",
{ class: active["faults"] },
m("a", { href: "#!/faults" }, "Faults")
)
])
);
);
return m("nav", m("ul", tabs));
}
};