blob: a6dcbfd1ac3f3184b84501b90d5e0bcd4e94b310 [file] [log] [blame]
Yoshie Muranaka8c80dbd2019-08-08 10:58:04 -05001window.angular && (function(angular) {
2 'use strict';
3
4 /**
5 * Role table
6 * Table of privilege role descriptions
7 */
miramurali23afc8a792019-06-17 13:07:24 -05008 angular.module('app.accessControl').directive('roleTable', [
Yoshie Muranaka8c80dbd2019-08-08 10:58:04 -05009 '$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 Muranakab1f64242019-09-04 11:40:51 -070023 this.tableHeader = [
Gunnar Millsd11b9272019-10-21 13:49:23 -050024 {label: ''}, {label: 'Admin'}, {label: 'Operator'},
25 {label: 'ReadOnly'}, {label: 'Callback'}
Yoshie Muranakab1f64242019-09-04 11:40:51 -070026 ];
Yoshie Muranaka8c80dbd2019-08-08 10:58:04 -050027
28 // TODO: When API changed from D-Bus to Redfish, 'Operator' role
29 // should have 'Configure components managed by this service'
30 // privilege checked
Gunnar Millsd11b9272019-10-21 13:49:23 -050031 // TODO: When 'Operator' and 'ReadOnly' roles have ability to change
Yoshie Muranakac7997142019-09-03 07:31:45 -070032 // own account's passwords, should have 'Update password for
33 // current user account' privilege checked
Gunnar Millsea4968c2019-09-26 16:19:12 -050034 // TODO: Update Callback privileges when backend removes privileges
35 // for Callback role.
Yoshie Muranakab1f64242019-09-04 11:40:51 -070036 this.tableData = [
Yoshie Muranaka8c80dbd2019-08-08 10:58:04 -050037 {
38 uiData: [
39 'Configure components managed by this service', check, '', '',
40 ''
41 ]
42 },
43 {uiData: ['Configure manager resources', check, '', '', '']},
44 {
45 uiData: [
Yoshie Muranakac7997142019-09-03 07:31:45 -070046 'Update password for current user account', check, '', '', ''
Yoshie Muranaka8c80dbd2019-08-08 10:58:04 -050047 ]
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 Millsea4968c2019-09-26 16:19:12 -050053 check
Yoshie Muranaka8c80dbd2019-08-08 10:58:04 -050054 ]
55 },
56 {uiData: ['IPMI access point', check, check, check, check]},
Gunnar Millsea4968c2019-09-26 16:19:12 -050057 {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 Muranaka8c80dbd2019-08-08 10:58:04 -050060 ];
61
62 this.isCollapsed = true;
63 this.onClick = () => {
64 this.isCollapsed = !this.isCollapsed;
65 };
66 }
67 };
68 }
69 ]);
70})(window.angular);