@@ -643,33 +643,18 @@ public function updateProvider(models\Provider $ent, array $ch)
643
643
* set scopes
644
644
*/
645
645
if (array_key_exists ('scopes ' , $ ch ) && (!in_array ('scope ' , $ dissalowedparts ) || empty ($ entid ))) {
646
- $ origscopesso = implode (', ' , $ ent ->getScope ('idpsso ' ));
647
- $ origscopeaa = implode (', ' , $ ent ->getScope ('aa ' ));
648
- if (array_key_exists ('idpsso ' , $ ch ['scopes ' ]) && !empty ($ ch ['scopes ' ]['idpsso ' ])) {
649
- $ idpssoscopes = array_filter (preg_split ("/[\s,]+/ " , $ ch ['scopes ' ]['idpsso ' ]));
650
- $ ent ->setScope ('idpsso ' , array_unique ($ idpssoscopes ));
651
- if ($ origscopesso != implode (', ' , $ idpssoscopes )) {
652
- $ m ['Scope IDPSSO ' ] = array ('before ' => $ origscopesso , 'after ' => implode (', ' , $ idpssoscopes ));
653
- }
654
- } else {
655
- $ ent ->setScope ('idpsso ' , array ());
656
- if (!empty ($ origscopesso )) {
657
- $ m ['Scope IDPSSO ' ] = array ('before ' => $ origscopesso , 'after ' => '' );
658
- }
659
- }
660
- if (array_key_exists ('aa ' , $ ch ['scopes ' ]) && !empty ($ ch ['scopes ' ]['aa ' ])) {
661
- $ aascopes = array_filter (preg_split ("/[\s,]+/ " , $ ch ['scopes ' ]['aa ' ]));
662
- $ ent ->setScope ('aa ' , array_unique ($ aascopes ));
663
- if ($ origscopeaa != implode (', ' , $ aascopes )) {
664
- $ m ['Scope AA ' ] = array ('before ' => $ origscopeaa , 'after ' => implode (', ' , $ aascopes ));
665
- }
666
- } else {
667
- $ ent ->setScope ('aa ' , array ());
668
- if (!empty ($ origscopeaa )) {
669
- $ m ['Scope AA ' ] = array ('before ' => $ origscopeaa , 'after ' => '' );
646
+
647
+ $ scopeTypes = array ('idpsso ' , 'aa ' );
648
+ foreach ($ scopeTypes as $ scopeType ) {
649
+ $ origScopes = implode (', ' , $ ent ->getScope ($ scopeType ));
650
+ if (array_key_exists ($ scopeType , $ ch ['scopes ' ]) && !empty ($ ch ['scopes ' ][$ scopeType ])) {
651
+ $ newScopes = array_filter (preg_split ("/[\s,]+/ " , $ ch ['scopes ' ][$ scopeType ]));
652
+ $ ent ->setScope ($ scopeType , array_unique ($ newScopes ));
653
+ if ($ origScopes != implode (', ' , $ newScopes )) {
654
+ $ m ['Scope ' . $ scopeType . '' ] = array ('before ' => $ origScopes , 'after ' => implode (', ' , $ newScopes ));
655
+ }
670
656
}
671
657
}
672
- $ origscopesso = null ;
673
658
}
674
659
}
675
660
if (array_key_exists ('entityid ' , $ ch ) && !empty ($ ch ['entityid ' ])) {
@@ -684,7 +669,7 @@ public function updateProvider(models\Provider $ent, array $ch)
684
669
}
685
670
}
686
671
687
- $ fields = array ('lname ' , 'ldisplayname ' ,'lhelpdesk ' );
672
+ $ fields = array ('lname ' , 'ldisplayname ' , 'lhelpdesk ' );
688
673
$ fieldsLongName = array (
689
674
'lname ' => 'OrganizationName ' ,
690
675
'ldisplayname ' => 'OrganizationDisplayName ' ,
@@ -703,7 +688,7 @@ public function updateProvider(models\Provider $ent, array $ch)
703
688
$ trackorigs = $ ent ->getMergedLocalName ();
704
689
} elseif ($ fieldName === 'ldisplayname ' ) {
705
690
$ trackorigs = $ ent ->getMergedLocalDisplayName ();
706
- }elseif ($ fieldName === 'lhelpdesk ' ){
691
+ } elseif ($ fieldName === 'lhelpdesk ' ) {
707
692
$ trackorigs = $ ent ->getHelpdeskUrlLocalized ();
708
693
}
709
694
$ isDiff = false ;
@@ -737,8 +722,7 @@ public function updateProvider(models\Provider $ent, array $ch)
737
722
$ ent ->setLocalDisplayName ($ ch ['ldisplayname ' ]);
738
723
$ trackAfter = $ ent ->getMergedLocalDisplayName ();
739
724
740
- }elseif ($ fieldName === 'lhelpdesk ' )
741
- {
725
+ } elseif ($ fieldName === 'lhelpdesk ' ) {
742
726
if (isset ($ ch ['lhelpdesk ' ]['en ' ])) {
743
727
$ ent ->setHelpdeskUrl ($ ch ['lhelpdesk ' ]['en ' ]);
744
728
unset($ ch ['lhelpdesk ' ]['en ' ]);
@@ -756,7 +740,6 @@ public function updateProvider(models\Provider $ent, array $ch)
756
740
}
757
741
758
742
759
-
760
743
if ($ isAdmin ) {
761
744
if (array_key_exists ('regauthority ' , $ ch )) {
762
745
if ($ ent ->getRegistrationAuthority () !== $ ch ['regauthority ' ]) {
0 commit comments