Yoshie Muranaka | 8c80dbd | 2019-08-08 10:58:04 -0500 | [diff] [blame] | 1 | window.angular && (function(angular) { |
| 2 | 'use strict'; |
| 3 | |
| 4 | /** |
| 5 | * Role table |
| 6 | * Table of privilege role descriptions |
| 7 | */ |
miramurali23 | afc8a79 | 2019-06-17 13:07:24 -0500 | [diff] [blame] | 8 | angular.module('app.accessControl').directive('roleTable', [ |
Yoshie Muranaka | 8c80dbd | 2019-08-08 10:58:04 -0500 | [diff] [blame] | 9 | '$sce', |
| 10 | function($sce) { |
| 11 | return { |
| 12 | restrict: 'E', |
| 13 | template: require('./role-table.html'), |
| 14 | controllerAs: 'roleTableCtrl', |
| 15 | controller: function() { |
| 16 | // TODO: This is a workaround to render the checkmark svg icon |
| 17 | // Would eventually like to enhance <bmc-table> component to |
| 18 | // compile custom directives as table items |
| 19 | const svg = require('../../assets/icons/icon-check.svg'); |
| 20 | const check = |
| 21 | $sce.trustAsHtml(`<span class="icon__check-mark">${svg}<span>`); |
| 22 | |
Yoshie Muranaka | b1f6424 | 2019-09-04 11:40:51 -0700 | [diff] [blame] | 23 | this.tableHeader = [ |
| 24 | {label: ''}, {label: 'Admin'}, {label: 'Operator'}, {label: 'User'}, |
| 25 | {label: 'Callback'} |
| 26 | ]; |
Yoshie Muranaka | 8c80dbd | 2019-08-08 10:58:04 -0500 | [diff] [blame] | 27 | |
| 28 | // TODO: When API changed from D-Bus to Redfish, 'Operator' role |
| 29 | // should have 'Configure components managed by this service' |
| 30 | // privilege checked |
Yoshie Muranaka | c799714 | 2019-09-03 07:31:45 -0700 | [diff] [blame] | 31 | // TODO: When 'Operator' and 'User' roles have ability to change |
| 32 | // own account's passwords, should have 'Update password for |
| 33 | // current user account' privilege checked |
Gunnar Mills | ea4968c | 2019-09-26 16:19:12 -0500 | [diff] [blame^] | 34 | // TODO: Update Callback privileges when backend removes privileges |
| 35 | // for Callback role. |
Yoshie Muranaka | b1f6424 | 2019-09-04 11:40:51 -0700 | [diff] [blame] | 36 | this.tableData = [ |
Yoshie Muranaka | 8c80dbd | 2019-08-08 10:58:04 -0500 | [diff] [blame] | 37 | { |
| 38 | uiData: [ |
| 39 | 'Configure components managed by this service', check, '', '', |
| 40 | '' |
| 41 | ] |
| 42 | }, |
| 43 | {uiData: ['Configure manager resources', check, '', '', '']}, |
| 44 | { |
| 45 | uiData: [ |
Yoshie Muranaka | c799714 | 2019-09-03 07:31:45 -0700 | [diff] [blame] | 46 | 'Update password for current user account', check, '', '', '' |
Yoshie Muranaka | 8c80dbd | 2019-08-08 10:58:04 -0500 | [diff] [blame] | 47 | ] |
| 48 | }, |
| 49 | {uiData: ['Configure users and their accounts', check, '', '', '']}, |
| 50 | { |
| 51 | uiData: [ |
| 52 | 'Log in to the service and read resources', check, check, check, |
Gunnar Mills | ea4968c | 2019-09-26 16:19:12 -0500 | [diff] [blame^] | 53 | check |
Yoshie Muranaka | 8c80dbd | 2019-08-08 10:58:04 -0500 | [diff] [blame] | 54 | ] |
| 55 | }, |
| 56 | {uiData: ['IPMI access point', check, check, check, check]}, |
Gunnar Mills | ea4968c | 2019-09-26 16:19:12 -0500 | [diff] [blame^] | 57 | {uiData: ['Redfish access point', check, check, check, check]}, |
| 58 | {uiData: ['SSH access point', check, check, check, check]}, |
| 59 | {uiData: ['WebUI access point', check, check, check, check]}, |
Yoshie Muranaka | 8c80dbd | 2019-08-08 10:58:04 -0500 | [diff] [blame] | 60 | ]; |
| 61 | |
| 62 | this.isCollapsed = true; |
| 63 | this.onClick = () => { |
| 64 | this.isCollapsed = !this.isCollapsed; |
| 65 | }; |
| 66 | } |
| 67 | }; |
| 68 | } |
| 69 | ]); |
| 70 | })(window.angular); |