Skip to content

Commit f362c84

Browse files
committed
cleaning
1 parent 490e164 commit f362c84

File tree

1 file changed

+13
-30
lines changed

1 file changed

+13
-30
lines changed

application/libraries/Providerupdater.php

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -643,33 +643,18 @@ public function updateProvider(models\Provider $ent, array $ch)
643643
* set scopes
644644
*/
645645
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+
}
670656
}
671657
}
672-
$origscopesso = null;
673658
}
674659
}
675660
if (array_key_exists('entityid', $ch) && !empty($ch['entityid'])) {
@@ -684,7 +669,7 @@ public function updateProvider(models\Provider $ent, array $ch)
684669
}
685670
}
686671

687-
$fields = array('lname', 'ldisplayname','lhelpdesk');
672+
$fields = array('lname', 'ldisplayname', 'lhelpdesk');
688673
$fieldsLongName = array(
689674
'lname' => 'OrganizationName',
690675
'ldisplayname' => 'OrganizationDisplayName',
@@ -703,7 +688,7 @@ public function updateProvider(models\Provider $ent, array $ch)
703688
$trackorigs = $ent->getMergedLocalName();
704689
} elseif ($fieldName === 'ldisplayname') {
705690
$trackorigs = $ent->getMergedLocalDisplayName();
706-
}elseif($fieldName === 'lhelpdesk'){
691+
} elseif ($fieldName === 'lhelpdesk') {
707692
$trackorigs = $ent->getHelpdeskUrlLocalized();
708693
}
709694
$isDiff = false;
@@ -737,8 +722,7 @@ public function updateProvider(models\Provider $ent, array $ch)
737722
$ent->setLocalDisplayName($ch['ldisplayname']);
738723
$trackAfter = $ent->getMergedLocalDisplayName();
739724

740-
}elseif($fieldName === 'lhelpdesk')
741-
{
725+
} elseif ($fieldName === 'lhelpdesk') {
742726
if (isset($ch['lhelpdesk']['en'])) {
743727
$ent->setHelpdeskUrl($ch['lhelpdesk']['en']);
744728
unset($ch['lhelpdesk']['en']);
@@ -756,7 +740,6 @@ public function updateProvider(models\Provider $ent, array $ch)
756740
}
757741

758742

759-
760743
if ($isAdmin) {
761744
if (array_key_exists('regauthority', $ch)) {
762745
if ($ent->getRegistrationAuthority() !== $ch['regauthority']) {

0 commit comments

Comments
 (0)