/*
- *
+ *
* Copyright 2016 RIFT.IO Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
console.log('Error polling: ' + url);
} else {
if (!self.isClosed) {
- self.poll = setTimeout(pollServer, 1000 || interval);
+ if(process.env.DISABLE_POLLING != "TRUE") {
+ self.poll = setTimeout(pollServer, 1000 || interval);
+ } else {
+ console.log('Polling is disabled. Finishing request.')
+ }
var data = response.body;
if (self.onmessage) {
self.onmessage(data);
u.role && u.role.map(function(r) {
userData.project[p.name].role[r.role] = true
});
+ u["rw-project-mano:mano-role"] && u["rw-project-mano:mano-role"] .map(function(r) {
+ userData.project[p.name].role[r.role] = true
+ });
}
})
});
}
c.PROJECT = {
+ TYPE: {
+ "rw-project-mano:catalog-oper": "rw-project-mano",
+ "rw-project-mano:catalog-admin": "rw-project-mano",
+ "rw-project-mano:lcm-oper": "rw-project-mano",
+ "rw-project-mano:lcm-admin": "rw-project-mano",
+ "rw-project-mano:account-oper": "rw-project-mano",
+ "rw-project-mano:account-admin": "rw-project-mano",
+ "rw-project:project-oper": "rw-project",
+ "rw-project:project-admin": "rw-project"
+ },
CATALOG_OPER: "rw-project-mano:catalog-oper",
CATALOG_ADMIN: "rw-project-mano:catalog-admin",
LCM_OPER: "rw-project-mano:lcm-oper",
ACCOUNT_ADMIN: "rw-project-mano:account-admin",
PROJECT_OPER: "rw-project:project-oper",
PROJECT_ADMIN: "rw-project:project-admin"
+
}
module.exports = c;
//Remove null values from role
projectUsers.map((u) => {
let cleanRoles = [];
+ let cleanManoRoles = [];
u.role && u.role.map((r,i) => {
let role = {};
//you may add a user without a role or a keys, but if one is present then the other must be as well.
- if(!r.role ) {
- } else {
+ if(r.role ) {
delete r.keys;
- // r.keys = projectName;
- cleanRoles.push(r)
+ // r.keys = projectName;
+ switch(ROLES.PROJECT.TYPE[r.role]) {
+ case 'rw-project-mano' : cleanManoRoles.push(r); break;
+ case 'rw-project' : cleanRoles.push(r); break;
+ }
}
});
u.role = cleanRoles;
+ u["rw-project-mano:mano-role"] = cleanManoRoles
cleanUsers.push(u);
});
return cleanUsers;
removeUserFromProject = (userIndex, e) => {
this.actions.handleRemoveUserFromProject(userIndex);
}
- updateUserRoleInProject = (userIndex, roleIndex, e) => {
- this.actions.handleUpdateUserRoleInProject({
- userIndex,
- roleIndex,
- value: JSON.parse(e.target.value)
- })
- }
toggleUserRoleInProject = (userIndex, roleIndex, e) => {
this.actions.handleToggleUserRoleInProject({
userIndex,
this.projectUsers = [];
this.selectedUser = null;
this.selectedRole = null;
- this.roles = Object.keys(ROLES.PROJECT).map((p) => {
+ this.roles = Object.keys(ROLES.PROJECT).filter((p) => {
+ return p != "TYPE";
+ }).map((p) => {
return ROLES.PROJECT[p];
})
// this.roles = ['rw-project:project-admin', 'rw-project:project-oper', 'rw-project:project-create'];
let projectUsers = this.projectUsers;
let selectedRole = self.roles[roleIndex];
if(checked) {
- if(!projectUsers[userIndex].role) projectUsers[userIndex].role = [];
+ if (!projectUsers[userIndex].role) {
+ projectUsers[userIndex].role = [];
+ }
+ if (!projectUsers[userIndex]['rw-project-mano:mano-role']) {
+ projectUsers[userIndex]['rw-project-mano:mano-role'] = [];
+ }
+ switch (ROLES.PROJECT.TYPE[self.roles[roleIndex]]) {
+ case 'rw-project' :
+ projectUsers[userIndex].role.push({
+ role: selectedRole
+ });
+ break;
+ case 'rw-project-mano' :
+ projectUsers[userIndex]["rw-project-mano:mano-role"].push({
+ role: selectedRole
+ });
+ break;
+ }
projectUsers[userIndex].role.push({
- role: self.roles[roleIndex]
+ role: selectedRole
})
} else {
let role = projectUsers[userIndex].role;