blob: c23fed898cd6b5e331a04fffb8bf556c201e0278 [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 */
8 angular.module('app.users').directive('roleTable', [
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 Muranakab1f64242019-09-04 11:40:51 -070023 this.tableHeader = [
24 {label: ''}, {label: 'Admin'}, {label: 'Operator'}, {label: 'User'},
25 {label: 'Callback'}
26 ];
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
Yoshie Muranakac7997142019-09-03 07:31:45 -070031 // 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
Yoshie Muranakab1f64242019-09-04 11:40:51 -070034 this.tableData = [
Yoshie Muranaka8c80dbd2019-08-08 10:58:04 -050035 {
36 uiData: [
37 'Configure components managed by this service', check, '', '',
38 ''
39 ]
40 },
41 {uiData: ['Configure manager resources', check, '', '', '']},
42 {
43 uiData: [
Yoshie Muranakac7997142019-09-03 07:31:45 -070044 'Update password for current user account', check, '', '', ''
Yoshie Muranaka8c80dbd2019-08-08 10:58:04 -050045 ]
46 },
47 {uiData: ['Configure users and their accounts', check, '', '', '']},
48 {
49 uiData: [
50 'Log in to the service and read resources', check, check, check,
51 ''
52 ]
53 },
54 {uiData: ['IPMI access point', check, check, check, check]},
55 {uiData: ['Redfish access point', check, check, check, '']},
56 {uiData: ['SSH access point', check, check, check, '']},
57 {uiData: ['WebUI access point', check, check, check, '']},
58 ];
59
60 this.isCollapsed = true;
61 this.onClick = () => {
62 this.isCollapsed = !this.isCollapsed;
63 };
64 }
65 };
66 }
67 ]);
68})(window.angular);