11import { NgClass } from '@angular/common' ;
2- import {
3- Component ,
4- inject ,
5- Input ,
6- input ,
7- OnDestroy ,
8- OnInit ,
9- output ,
10- viewChild ,
11- } from '@angular/core' ;
2+ import { Component , inject , Input , input , OnDestroy , OnInit , output , viewChild } from '@angular/core' ;
123import { FormsModule } from '@angular/forms' ;
134import { ActivatedRoute } from '@angular/router' ;
145import { AccessPolicy } from '@core/access-policy/access-policy' ;
@@ -113,11 +104,7 @@ export class AccessPolicyViewComponent implements OnInit, OnDestroy {
113104 . getMultifactor ( )
114105 . pipe ( take ( 1 ) )
115106 . subscribe ( ( mfSettings ) => {
116- this . bypassAllowed =
117- ! ! mfSettings . mfa_key_ldap ||
118- ! ! mfSettings . mfa_secret_ldap ||
119- ! ! mfSettings . mfa_key ||
120- ! ! mfSettings . mfa_secret ;
107+ this . bypassAllowed = ! ! mfSettings . mfa_key_ldap || ! ! mfSettings . mfa_secret_ldap || ! ! mfSettings . mfa_key || ! ! mfSettings . mfa_secret ;
121108 } ) ;
122109 }
123110
@@ -133,20 +120,13 @@ export class AccessPolicyViewComponent implements OnInit, OnDestroy {
133120 this . windows . hideSpinner ( ) ;
134121 if ( this . activatedRoute . snapshot . params . id ) {
135122 this . accessClient =
136- policies . find (
137- ( x ) =>
138- x . id == this . activatedRoute . snapshot . params . id || x . id == this . accessPolicyId ( ) ,
139- ) ?? new AccessPolicy ( ) ;
123+ policies . find ( ( x ) => x . id == this . activatedRoute . snapshot . params . id || x . id == this . accessPolicyId ( ) ) ?? new AccessPolicy ( ) ;
140124 }
141- this . ipAddresses = this . accessClient . ipRange
142- . map ( ( x : any ) => ( x instanceof Object ? x . start + '-' + x . end : x ) )
143- . join ( ', ' ) ;
125+ this . ipAddresses = this . accessClient . ipRange . map ( ( x : any ) => ( x instanceof Object ? x . start + '-' + x . end : x ) ) . join ( ', ' ) ;
144126
145127 this . mfaAccess = this . accessClient . mfaStatus ?? MfaAccessEnum . Noone ;
146128 this . selectedGroups = this . accessClient . groups . map ( ( x ) => this . getMultiselectOption ( x ) ) ;
147- this . selectedMfaGroups = this . accessClient . mfaGroups . map ( ( x ) =>
148- this . getMultiselectOption ( x ) ,
149- ) ;
129+ this . selectedMfaGroups = this . accessClient . mfaGroups . map ( ( x ) => this . getMultiselectOption ( x ) ) ;
150130 } ,
151131 error : ( ) => {
152132 this . windows . hideSpinner ( ) ;
@@ -189,9 +169,7 @@ export class AccessPolicyViewComponent implements OnInit, OnDestroy {
189169 if ( ! result ) {
190170 return ;
191171 }
192- this . ipAddresses = result . addresses
193- . map ( ( x : any ) => ( x instanceof Object ? x . start + '-' + x . end : x ) )
194- . join ( ', ' ) ;
172+ this . ipAddresses = result . addresses . map ( ( x : any ) => ( x instanceof Object ? x . start + '-' + x . end : x ) ) . join ( ', ' ) ;
195173 this . accessClient . ipRange = result . addresses ;
196174 } ) ;
197175 }
@@ -219,6 +197,10 @@ export class AccessPolicyViewComponent implements OnInit, OnDestroy {
219197 } ) ;
220198 }
221199
200+ onChangeSelectedItems ( $event : MultiselectModel [ ] ) {
201+ this . accessClient . groups = $event . map ( ( x ) => x . id ) ;
202+ }
203+
222204 checkMfaGroups ( ) {
223205 this . retrieveGroups ( this . mfaGroupsQuery )
224206 . pipe ( take ( 1 ) )
@@ -245,9 +227,7 @@ export class AccessPolicyViewComponent implements OnInit, OnDestroy {
245227 }
246228 return from ( this . ldapTreeview . load ( '' ) ) . pipe (
247229 take ( 1 ) ,
248- switchMap ( ( root ) =>
249- this . api . search ( SearchQueries . findEntities ( groupQuery , root ?. [ 0 ] ?. id ?? '' , [ 'group' ] ) ) ,
250- ) ,
230+ switchMap ( ( root ) => this . api . search ( SearchQueries . findEntities ( groupQuery , root ?. [ 0 ] ?. id ?? '' , [ 'group' ] ) ) ) ,
251231 map ( ( result ) => {
252232 return result . search_result . map ( ( x ) => {
253233 const name = new RegExp ( Constants . RegexGetNameFromDn ) . exec ( x . object_name ) ;
0 commit comments