# All files / src/app/shared/models permissions.ts

100% Statements 26/26
100% Branches 2/2
100% Functions 5/5
100% Lines 23/23

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    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
    5195x

    12459x
    6281x
    25124x

    95x

    95x

    391x
    391x
    391x
    391x
    391x
    391x
    391x
    391x
    391x
    391x
    391x
    391x
    391x
    391x
    391x
    391x

    95x
     export class Permission {
      read: boolean;
      create: boolean;
      update: boolean;
      delete: boolean;

      constructor(serverPermission: Array<string> = []) {
        ['read', 'create', 'update', 'delete'].forEach(
          (permission) => (this[permission] = serverPermission.includes(permission))
        );
      }
    }

    export class Permissions {
      hosts: Permission;
      configOpt: Permission;
      pool: Permission;
      osd: Permission;
      monitor: Permission;
      rbdImage: Permission;
      iscsi: Permission;
      rbdMirroring: Permission;
      rgw: Permission;
      cephfs: Permission;
      manager: Permission;
      log: Permission;
      user: Permission;
      grafana: Permission;
      prometheus: Permission;
      nfs: Permission;

      constructor(serverPermissions: any) {
        this.hosts = new Permission(serverPermissions['hosts']);
        this.configOpt = new Permission(serverPermissions['config-opt']);
        this.pool = new Permission(serverPermissions['pool']);
        this.osd = new Permission(serverPermissions['osd']);
        this.monitor = new Permission(serverPermissions['monitor']);
        this.rbdImage = new Permission(serverPermissions['rbd-image']);
        this.iscsi = new Permission(serverPermissions['iscsi']);
        this.rbdMirroring = new Permission(serverPermissions['rbd-mirroring']);
        this.rgw = new Permission(serverPermissions['rgw']);
        this.cephfs = new Permission(serverPermissions['cephfs']);
        this.manager = new Permission(serverPermissions['manager']);
        this.log = new Permission(serverPermissions['log']);
        this.user = new Permission(serverPermissions['user']);
        this.grafana = new Permission(serverPermissions['grafana']);
        this.prometheus = new Permission(serverPermissions['prometheus']);
        this.nfs = new Permission(serverPermissions['nfs-ganesha']);
      }
    }