summaryrefslogtreecommitdiffstats
path: root/app/access-control/directives/role-table.js
blob: a6dcbfd1ac3f3184b84501b90d5e0bcd4e94b310 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
window.angular && (function(angular) {
  'use strict';

  /**
   * Role table
   * Table of privilege role descriptions
   */
  angular.module('app.accessControl').directive('roleTable', [
    '$sce',
    function($sce) {
      return {
        restrict: 'E',
        template: require('./role-table.html'),
        controllerAs: 'roleTableCtrl',
        controller: function() {
          // TODO: This is a workaround to render the checkmark svg icon
          // Would eventually like to enhance <bmc-table> component to
          // compile custom directives as table items
          const svg = require('../../assets/icons/icon-check.svg');
          const check =
              $sce.trustAsHtml(`<span class="icon__check-mark">${svg}<span>`);

          this.tableHeader = [
            {label: ''}, {label: 'Admin'}, {label: 'Operator'},
            {label: 'ReadOnly'}, {label: 'Callback'}
          ];

          // TODO: When API changed from D-Bus to Redfish, 'Operator' role
          // should have 'Configure components managed by this service'
          // privilege checked
          // TODO: When 'Operator' and 'ReadOnly' roles have ability to change
          // own account's passwords, should have 'Update password for
          // current user account' privilege checked
          // TODO: Update Callback privileges when backend removes privileges
          // for Callback role.
          this.tableData = [
            {
              uiData: [
                'Configure components managed by this service', check, '', '',
                ''
              ]
            },
            {uiData: ['Configure manager resources', check, '', '', '']},
            {
              uiData: [
                'Update password for current user account', check, '', '', ''
              ]
            },
            {uiData: ['Configure users and their accounts', check, '', '', '']},
            {
              uiData: [
                'Log in to the service and read resources', check, check, check,
                check
              ]
            },
            {uiData: ['IPMI access point', check, check, check, check]},
            {uiData: ['Redfish access point', check, check, check, check]},
            {uiData: ['SSH access point', check, check, check, check]},
            {uiData: ['WebUI access point', check, check, check, check]},
          ];

          this.isCollapsed = true;
          this.onClick = () => {
            this.isCollapsed = !this.isCollapsed;
          };
        }
      };
    }
  ]);
})(window.angular);
OpenPOWER on IntegriCloud