From: Laurence Maultsby Date: Tue, 11 Apr 2017 14:54:26 +0000 (-0400) Subject: Initial RBAC plugin display. Included about and debug page not rendering fix X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=96b7649b2db9ab306a20b43db5f77b6111d746ed;p=osm%2FUI.git Initial RBAC plugin display. Included about and debug page not rendering fix Signed-off-by: Laurence Maultsby --- diff --git a/skyquake/framework/utils/roleConstants.js b/skyquake/framework/utils/roleConstants.js index 95e36fcb1..96c4bf329 100644 --- a/skyquake/framework/utils/roleConstants.js +++ b/skyquake/framework/utils/roleConstants.js @@ -7,8 +7,12 @@ c.PLATFORM = { } c.PROJECT = { - MANO_OPER: "rw-project-mano:mano-oper", - MANO_ADMIN: "rw-project-mano:mano-admin", + CATALOG_OPER: "rw-project-mano:catalog-oper", + CATALOG_ADMIN: "rw-project-mano:catalog-admin", + LCM_OPER: "rw-project-mano:lcm-oper", + LCM_ADMIN: "rw-project-mano:lcm-admin", + ACCOUNT_OPER: "rw-project-mano:account-oper", + ACCOUNT_ADMIN: "rw-project-mano:account-admin", PROJECT_ADMIN: "rw-project:project-admin", PROJECT_OPER: "rw-project:project-oper", } diff --git a/skyquake/framework/widgets/form_controls/formControls.scss b/skyquake/framework/widgets/form_controls/formControls.scss index afa8508d7..1e29db742 100644 --- a/skyquake/framework/widgets/form_controls/formControls.scss +++ b/skyquake/framework/widgets/form_controls/formControls.scss @@ -15,7 +15,7 @@ * limitations under the License. * */ -@import 'style/_colors.scss'; +@import '../../style/_colors.scss'; .sqTextInput { display: -ms-flexbox; diff --git a/skyquake/framework/widgets/skyquake_rbac/skyquakeRBAC.jsx b/skyquake/framework/widgets/skyquake_rbac/skyquakeRBAC.jsx index e00e67254..cbb6a567f 100644 --- a/skyquake/framework/widgets/skyquake_rbac/skyquakeRBAC.jsx +++ b/skyquake/framework/widgets/skyquake_rbac/skyquakeRBAC.jsx @@ -26,15 +26,16 @@ export default class SkyquakeRBAC extends React.Component { super(props); } render() { - const User = this.context.userProfile.data; + const User = this.context.userProfile; + const UserData = User.data; let HTML = null; // If user object has platform property then it has been populated by the back end. - if(User) { - const PlatformRole = User.platform.role; + if(UserData) { + const PlatformRole = UserData.platform.role; const isPlatformSuper = PlatformRole[PLATFORM.SUPER]; const isPlatformAdmin = PlatformRole[PLATFORM.ADMIN]; const isPlatformOper = PlatformRole[PLATFORM.OPER]; - const hasRoleAccess = checkForRoleAccess(User.project[this.props.project], PlatformRole, this.props.allow)//false//(this.props.roles.indexOf(userProfile.projectRole) > -1) + const hasRoleAccess = checkForRoleAccess(UserData.project[User.projectId], PlatformRole, this.props.allow)//false//(this.props.roles.indexOf(userProfile.projectRole) > -1) if (isPlatformSuper) { HTML = this.props.children; } else { diff --git a/skyquake/plugins/accounts/config.json b/skyquake/plugins/accounts/config.json index 7bea692ab..35828888f 100644 --- a/skyquake/plugins/accounts/config.json +++ b/skyquake/plugins/accounts/config.json @@ -4,6 +4,7 @@ "dashboard": "./account/accountsDashboard.jsx", "order": 3, "priority":1, + "allow": ["rw-rbac-platform:super-admin", "rw-project-mano:account-oper", "rw-project-mano:account-admin"], "routes": [ { "label": "Accounts Dashboard", diff --git a/skyquake/plugins/composer/config.json b/skyquake/plugins/composer/config.json index 80a2a0c4d..34b108475 100644 --- a/skyquake/plugins/composer/config.json +++ b/skyquake/plugins/composer/config.json @@ -5,6 +5,10 @@ "name": "Catalog", "dashboard" : "./src/components/ComposerApp.js", "order": 2, + "allow": [ + "rw-rbac-platform:super-admin", + "rw-project-mano:catalog-oper", + "rw-project-mano:catalog-admin"], "routes" : [{ "label": "Catalog", "route": "/", diff --git a/skyquake/plugins/launchpad/config.json b/skyquake/plugins/launchpad/config.json index 851239f96..1f4d1459a 100644 --- a/skyquake/plugins/launchpad/config.json +++ b/skyquake/plugins/launchpad/config.json @@ -4,6 +4,7 @@ "dashboard": "./launchpad.jsx", "order": 1, "priority":1, + "allow": ["rw-rbac-platform:super-admin", "rw-project-mano:lcm-oper", "rw-project-mano:lcm-admin"], "routes": [ { "label": "Dashboard", diff --git a/skyquake/plugins/project_management/src/dashboard/projectMgmt.scss b/skyquake/plugins/project_management/src/dashboard/projectMgmt.scss index a21aaa913..eca6a5993 100644 --- a/skyquake/plugins/project_management/src/dashboard/projectMgmt.scss +++ b/skyquake/plugins/project_management/src/dashboard/projectMgmt.scss @@ -6,7 +6,7 @@ @import "style/_colors.scss"; .projectManagement { - max-width: 900px; + max-width: 1200px; .skyquakePanel-wrapper { overflow-x: hidden; @@ -154,7 +154,7 @@ } .userTable { .FormSection-body { - max-width: 652px; + max-width: 952px; overflow-x: auto; } } diff --git a/skyquake/plugins/project_management/src/dashboard/projectMgmtStore.js b/skyquake/plugins/project_management/src/dashboard/projectMgmtStore.js index ec3a099ba..71c10a272 100644 --- a/skyquake/plugins/project_management/src/dashboard/projectMgmtStore.js +++ b/skyquake/plugins/project_management/src/dashboard/projectMgmtStore.js @@ -3,6 +3,7 @@ */ import ProjectManagementActions from './projectMgmtActions.js'; import ProjectManagementSource from './projectMgmtSource.js'; +import ROLES from 'utils/roleConstants.js'; import _ from 'lodash'; export default class ProjectManagementStore { constructor() { @@ -15,8 +16,10 @@ export default class ProjectManagementStore { this.projectUsers = []; this.selectedUser = null; this.selectedRole = null; - this.roles = ['rw-project:project-admin', 'rw-project:project-oper', 'rw-project:project-create' - ]; + this.roles = Object.keys(ROLES.PROJECT).map((p) => { + return ROLES.PROJECT[p]; + }) + // this.roles = ['rw-project:project-admin', 'rw-project:project-oper', 'rw-project:project-create']; this.users = []; this.activeIndex = null; this.isReadOnly = true; diff --git a/skyquake/plugins/user_management/config.json b/skyquake/plugins/user_management/config.json index 03662144d..38de12f5b 100644 --- a/skyquake/plugins/user_management/config.json +++ b/skyquake/plugins/user_management/config.json @@ -11,7 +11,8 @@ "label": "User Management Dashboard", "route": "user-management", "component": "./dashboard/dashboard.jsx", - "type": "internal" + "type": "internal", + "allow": ["rw-rbac-platform:super-admin", "rw-rbac-platform:platform-admin", "rw-rbac-platform:platform-oper"] },{ "label": "Platform Role Management", "route": "platform", diff --git a/skyquake/plugins/user_management/src/dashboard/userMgmt.scss b/skyquake/plugins/user_management/src/dashboard/userMgmt.scss index 4e935eafe..a265f0dbf 100644 --- a/skyquake/plugins/user_management/src/dashboard/userMgmt.scss +++ b/skyquake/plugins/user_management/src/dashboard/userMgmt.scss @@ -83,7 +83,7 @@ } } - .rbacButtonGroup { + .rbacButtonGroup, .buttonSection { margin: 0 0.5rem 0.5rem; background: #ddd; padding-bottom: 0.5rem; diff --git a/skyquake/plugins/user_management/src/userProfile/userProfile.jsx b/skyquake/plugins/user_management/src/userProfile/userProfile.jsx index d7cb6005a..a7868583c 100644 --- a/skyquake/plugins/user_management/src/userProfile/userProfile.jsx +++ b/skyquake/plugins/user_management/src/userProfile/userProfile.jsx @@ -237,7 +237,9 @@ class UserProfileDashboard extends React.Component { {passwordSectionHTML} - {formButtonsHTML} +
+ {formButtonsHTML} +