Commit cab4ffcd authored by Rune Myrhaug's avatar Rune Myrhaug
Browse files

isSuperAdmin

parent d284f98e
Pipeline #2986 passed with stages
in 2 minutes and 46 seconds
......@@ -214,6 +214,21 @@ class EduLab {
return false;
}
isSuperAdmin(groups) {
var group;
var i;
for(i = 0; i < groups.length; i++) {
group = groups[i];
if (group.type === 'fc:org' && group.id === 'fc:org:uninett.no') {
if (group.membership.primaryAffiliation && group.membership.primaryAffiliation === 'employee') {
return true;
}
}
}
return false;
}
backendConfiguration(req, res) {
var data = {};
......@@ -221,6 +236,7 @@ class EduLab {
.then((apidata) => {
data.groups = apidata;
data.isAdmin = this.isAdmin(data.groups);
data.isSuperAdmin = this.isSuperAdmin(data.groups);
})
.then(() => this.getAPI(req, '/iaas/locations'))
.then((apidata) => {
......@@ -247,6 +263,7 @@ class EduLab {
var data = {};
data.authenticated = !!req.user;
data.isAdmin = false;
data.isSuperAdmin = false;
if (req.user) {
data.user = req.user.data;
data.groups = req.groups;
......@@ -268,6 +285,7 @@ class EduLab {
.then((apidata) => {
data.groups = apidata;
data.isAdmin = this.isAdmin(data.groups);
data.isSuperAdmin = this.isSuperAdmin(data.groups);
})
.then(() => {
data.x = JSON.stringify(data, undefined, 2);
......@@ -293,6 +311,7 @@ class EduLab {
.then((apidata) => {
data.groups = apidata;
data.isAdmin = this.isAdmin(data.groups);
data.isSuperAdmin = this.isSuperAdmin(data.groups);
})
.then(() => this.getAPI(req, '/iaas/locations'))
.then((apidata) => {
......
......@@ -59,9 +59,9 @@
<li class="active"><a href="/">Forsiden</a></li>
{{#isAdmin}}
{{#isSuperAdmin}}
<li><a href="/debug">Debug</a></li>
{{/isAdmin}}
{{/isSuperAdmin}}
{{#isAdmin}}
<li><a href="/powerbireport">Forbruk</a></li>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment