blob: c72ccfcf3462d114d896399ce64ac08790edea1c [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
23 this.tableModel = {};
24 this.tableModel.header =
25 ['', 'Admin', 'Operator', 'User', 'Callback'];
26
27 // TODO: When API changed from D-Bus to Redfish, 'Operator' role
28 // should have 'Configure components managed by this service'
29 // privilege checked
30 this.tableModel.data = [
31 {
32 uiData: [
33 'Configure components managed by this service', check, '', '',
34 ''
35 ]
36 },
37 {uiData: ['Configure manager resources', check, '', '', '']},
38 {
39 uiData: [
40 'Update password for current user account', check, check, check,
41 ''
42 ]
43 },
44 {uiData: ['Configure users and their accounts', check, '', '', '']},
45 {
46 uiData: [
47 'Log in to the service and read resources', check, check, check,
48 ''
49 ]
50 },
51 {uiData: ['IPMI access point', check, check, check, check]},
52 {uiData: ['Redfish access point', check, check, check, '']},
53 {uiData: ['SSH access point', check, check, check, '']},
54 {uiData: ['WebUI access point', check, check, check, '']},
55 ];
56
57 this.isCollapsed = true;
58 this.onClick = () => {
59 this.isCollapsed = !this.isCollapsed;
60 };
61 }
62 };
63 }
64 ]);
65})(window.angular);