From: Laurence Maultsby Date: Tue, 2 May 2017 16:22:44 +0000 (-0400) Subject: Project page rw-mano fix X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=cefb13b7e32e68315f5f246ff27010315c830834;p=osm%2FUI.git Project page rw-mano fix Signed-off-by: Laurence Maultsby --- diff --git a/skyquake/framework/widgets/skyquake_rbac/skyquakeRBAC.jsx b/skyquake/framework/widgets/skyquake_rbac/skyquakeRBAC.jsx index 0245e235e..c1d3b0123 100644 --- a/skyquake/framework/widgets/skyquake_rbac/skyquakeRBAC.jsx +++ b/skyquake/framework/widgets/skyquake_rbac/skyquakeRBAC.jsx @@ -65,7 +65,7 @@ SkyquakeRBAC.contextTypes = { function checkForRoleAccess(project, PlatformRole, allow) { if (allow.indexOf('*') > -1) return true; for (let i = 0; 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 ) { + if(r.role) { delete r.keys; // r.keys = projectName; switch(ROLES.PROJECT.TYPE[r.role]) { @@ -150,7 +150,8 @@ class ProjectManagementDashboard extends React.Component { } }); u.role = cleanRoles; - u["rw-project-mano:mano-role"] = cleanManoRoles + u["rw-project-mano:mano-role"] = u["rw-project-mano:mano-role"] || []; + u["rw-project-mano:mano-role"] = u["rw-project-mano:mano-role"].concat(cleanManoRoles); cleanUsers.push(u); }); return cleanUsers; diff --git a/skyquake/plugins/project_management/src/dashboard/projectMgmtStore.js b/skyquake/plugins/project_management/src/dashboard/projectMgmtStore.js index 0c14dd906..e112bb680 100644 --- a/skyquake/plugins/project_management/src/dashboard/projectMgmtStore.js +++ b/skyquake/plugins/project_management/src/dashboard/projectMgmtStore.js @@ -69,7 +69,7 @@ export default class ProjectManagementStore { let ProjectData = { 'name': project['name'], 'description': project['description'], - 'projectUsers': project['project-config'] && project['project-config']['user'] || [] + 'projectUsers': (project['project-config'] && project['project-config']['user'] || []) } let state = _.merge({ activeIndex: projectIndex, @@ -173,17 +173,19 @@ export default class ProjectManagementStore { let {userIndex, roleIndex, checked} = data; let projectUsers = this.projectUsers; let selectedRole = self.roles[roleIndex]; + let roleType = (ROLES.PROJECT.TYPE[selectedRole] == 'rw-project-mano') ? "rw-project-mano:mano-role" : "role"; + // if(checked) { - if (!projectUsers[userIndex].role) { - projectUsers[userIndex].role = []; + if (!projectUsers[userIndex][roleType]) { + projectUsers[userIndex][roleType] = []; } - projectUsers[userIndex].role.push({ + projectUsers[userIndex][roleType].push({ role: self.roles[roleIndex] }) } else { - let role = projectUsers[userIndex].role; + let role = projectUsers[userIndex][roleType]; let roleIndex = _.findIndex(role, {role:selectedRole}) - projectUsers[userIndex].role.splice(roleIndex, 1) + projectUsers[userIndex][roleType].splice(roleIndex, 1) } self.setState({projectUsers});