import { Component , Input , OnChanges , SimpleChanges } from '@angular/core' ; import { AccessControlList , AccessControlPermission } from '../../acl.types' ; import { Group } from '../../../management/models/group' ; @ Component ( { selector : 'cmdb-acl-objects-information-permissions-column' , templateUrl : './acl-objects-information-permissions-column.component.html' , styleUrls : [ './acl-objects-information-permissions-column.component.scss' ] } ) export class AclObjectsInformationPermissionsColumnComponent implements OnChanges { /**
     * Selected group which compares to the acl.
     */ @ Input ( ) public group : Group ; /**
     * ACL of the current row type.
     */ @ Input ( ) public acl : AccessControlList ; public permissions : Array < AccessControlPermission > = [ ] ; public generate ( ) { if ( ! this . group || ! this . acl ) { this . permissions = [ ] ; } else { const groupID = this . group . public_id ; if ( groupID in this . acl . groups . includes ) { this . permissions = this . acl . groups . includes [ groupID ] ; } } } public ngOnChanges ( changes ) { this . generate ( ) ; } }