@@ -83,12 +83,14 @@ module('Integration | Component | users | user-overview', function (hooks) {
83
83
84
84
test (' displays the update button' , async function (assert ) {
85
85
// given
86
+ const store = this .owner .lookup (' service:store' );
86
87
const user = {
87
88
firstName: ' John' ,
88
89
lastName: ' Harry' ,
89
90
email: ' john.harry@example.net' ,
90
91
username: ' john.harry0102' ,
91
92
};
93
+ user .authenticationMethods = [await store .createRecord (' authentication-method' , { identityProvider: ' abc' })];
92
94
93
95
// when
94
96
const screen = await render (<template ><UserOverview @ user ={{user }} /></template >);
@@ -392,13 +394,15 @@ module('Integration | Component | users | user-overview', function (hooks) {
392
394
module (' When the admin member click to update user details' , function () {
393
395
test (' displays the edit and cancel buttons' , async function (assert ) {
394
396
// given
397
+ const store = this .owner .lookup (' service:store' );
395
398
const user = {
396
399
firstName: ' John' ,
397
400
lastName: ' Harry' ,
398
401
email: ' john.harry@example.net' ,
399
402
username: null ,
400
403
lang: null ,
401
404
};
405
+ user .authenticationMethods = [await store .createRecord (' authentication-method' , { identityProvider: ' abc' })];
402
406
403
407
// when
404
408
const screen = await render (<template ><UserOverview @ user ={{user }} /></template >);
@@ -416,6 +420,7 @@ module('Integration | Component | users | user-overview', function (hooks) {
416
420
firstName: ' John' ,
417
421
email: ' john.harry@gmail.com' ,
418
422
username: null ,
423
+ authenticationMethods: [],
419
424
});
420
425
421
426
// when
@@ -450,6 +455,7 @@ module('Integration | Component | users | user-overview', function (hooks) {
450
455
firstName: ' John' ,
451
456
email: ' john.harry@gmail.com' ,
452
457
username: null ,
458
+ authenticationMethods: [],
453
459
});
454
460
455
461
// when
@@ -469,6 +475,7 @@ module('Integration | Component | users | user-overview', function (hooks) {
469
475
firstName: ' John' ,
470
476
email: ' john.harry@gmail.com' ,
471
477
username: null ,
478
+ authenticationMethods: [],
472
479
});
473
480
474
481
// when
@@ -486,6 +493,7 @@ module('Integration | Component | users | user-overview', function (hooks) {
486
493
firstName: ' John' ,
487
494
email: ' john.harry@gmail.com' ,
488
495
username: null ,
496
+ authenticationMethods: [],
489
497
});
490
498
491
499
// when
@@ -505,6 +513,7 @@ module('Integration | Component | users | user-overview', function (hooks) {
505
513
firstName: ' John' ,
506
514
email: null ,
507
515
username: ' user.name1212' ,
516
+ authenticationMethods: [],
508
517
});
509
518
510
519
// when
@@ -522,6 +531,7 @@ module('Integration | Component | users | user-overview', function (hooks) {
522
531
firstName: ' John' ,
523
532
email: null ,
524
533
username: ' user.name1212' ,
534
+ authenticationMethods: [],
525
535
});
526
536
527
537
// when
@@ -543,6 +553,7 @@ module('Integration | Component | users | user-overview', function (hooks) {
543
553
firstName: ' John' ,
544
554
email: null ,
545
555
username: undefined ,
556
+ authenticationMethods: [],
546
557
});
547
558
548
559
// when
@@ -563,6 +574,7 @@ module('Integration | Component | users | user-overview', function (hooks) {
563
574
firstName: ' John' ,
564
575
email: ' john.harry@gmail.com' ,
565
576
username: null ,
577
+ authenticationMethods: [],
566
578
});
567
579
568
580
const screen = await render (<template ><UserOverview @ user ={{user }} /></template >);
@@ -588,6 +600,7 @@ module('Integration | Component | users | user-overview', function (hooks) {
588
600
firstName: ' John' ,
589
601
email: ' john.harry@gmail.com' ,
590
602
username: null ,
603
+ authenticationMethods: [],
591
604
});
592
605
593
606
const screen = await render (<template ><UserOverview @ user ={{user }} /></template >);
@@ -660,6 +673,7 @@ module('Integration | Component | users | user-overview', function (hooks) {
660
673
firstName: ' John' ,
661
674
email: ' john.harry@gmail.com' ,
662
675
isPixAgent: true ,
676
+ authenticationMethods: [],
663
677
});
664
678
665
679
// when
@@ -675,11 +689,85 @@ module('Integration | Component | users | user-overview', function (hooks) {
675
689
assert .dom (anonymizationDisabledTooltip).exists ();
676
690
});
677
691
});
692
+
693
+ module (' Displays SSO information' , function (hooks ) {
694
+ class OidcIdentityProvidersStub extends Service {
695
+ get list () {
696
+ return [
697
+ {
698
+ code: ' SUNLIGHT_NAVIGATIONS' ,
699
+ organizationName: ' Sunlight Navigations' ,
700
+ },
701
+ ];
702
+ }
703
+ }
704
+
705
+ hooks .beforeEach (function () {
706
+ this .owner .register (' service:oidc-identity-providers' , OidcIdentityProvidersStub);
707
+ });
708
+
709
+ test (' When user has not SSO authentication method' , async function (assert ) {
710
+ // given
711
+ const store = this .owner .lookup (' service:store' );
712
+ const user = {
713
+ firstName: ' John' ,
714
+ lastName: ' Harry' ,
715
+ email: ' john.harry@example.net' ,
716
+ username: ' john.harry0102' ,
717
+ };
718
+ user .authenticationMethods = [await store .createRecord (' authentication-method' , { identityProvider: ' abc' })];
719
+
720
+ // when
721
+ const screen = await render (<template ><UserOverview @ user ={{user }} /></template >);
722
+
723
+ // then
724
+ assert .dom (screen .getByText (' SSO : Non' )).exists ();
725
+ });
726
+
727
+ test (' When user has OIDC authentication method' , async function (assert ) {
728
+ // given
729
+ const store = this .owner .lookup (' service:store' );
730
+ const user = {
731
+ firstName: ' John' ,
732
+ lastName: ' Harry' ,
733
+ email: ' john.harry@example.net' ,
734
+ username: ' john.harry0102' ,
735
+ };
736
+ user .authenticationMethods = [
737
+ await store .createRecord (' authentication-method' , { identityProvider: ' SUNLIGHT_NAVIGATIONS' }),
738
+ ];
739
+
740
+ // when
741
+ const screen = await render (<template ><UserOverview @ user ={{user }} /></template >);
742
+
743
+ // then
744
+ assert .dom (screen .getByText (' SSO : Oui' )).exists ();
745
+ });
746
+
747
+ test (' When user has GAR authentication method' , async function (assert ) {
748
+ // given
749
+ const store = this .owner .lookup (' service:store' );
750
+ const user = {
751
+ firstName: ' John' ,
752
+ lastName: ' Harry' ,
753
+ email: ' john.harry@example.net' ,
754
+ username: ' john.harry0102' ,
755
+ };
756
+ user .authenticationMethods = [await store .createRecord (' authentication-method' , { identityProvider: ' GAR' })];
757
+
758
+ // when
759
+ const screen = await render (<template ><UserOverview @ user ={{user }} /></template >);
760
+
761
+ // then
762
+ assert .dom (screen .getByText (' SSO : Oui' )).exists ();
763
+ });
764
+ });
678
765
});
679
766
680
767
module (' When the admin member does not have access to users actions scope' , function () {
681
768
test (' does not display the action buttons "Modifier" and "Anonymiser cet utilisateur"' , async function (assert ) {
682
769
// given
770
+ const store = this .owner .lookup (' service:store' );
683
771
class AccessControlStub extends Service {
684
772
hasAccessToUsersActionsScope = false ;
685
773
}
@@ -690,6 +778,7 @@ module('Integration | Component | users | user-overview', function (hooks) {
690
778
email: ' john.harry@example.net' ,
691
779
username: ' john.harry0102' ,
692
780
};
781
+ user .authenticationMethods = [await store .createRecord (' authentication-method' , { identityProvider: ' abc' })];
693
782
this .owner .register (' service:access-control' , AccessControlStub);
694
783
695
784
// when
0 commit comments