Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/bugfix/persist-exclude-from-push…
Browse files Browse the repository at this point in the history
…-status-for-oidcng-entity-types' into release/2.5
  • Loading branch information
MKodde committed May 19, 2020
2 parents f2158dc + c8c1ff4 commit 9a4694b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@ private function generateMetadataFields(MetadataConversionDto $entity)
$metadata['coin:exclude_from_push'] = '1';
}

// When dealing with a client secret reset, keep the current exclude from push state.
$secret = $entity->getClientSecret();
if ($secret && $entity->isManageEntity() && !$entity->isExcludedFromPush()) {
$metadata['coin:exclude_from_push'] = '0';
}

$metadata += $this->generateOidcClient($entity);

if (!empty($entity->getLogoUrl())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ private function generateMetadataFields(MetadataConversionDto $entity)
$metadata['coin:exclude_from_push'] = '1';
}

// When dealing with a client secret reset, keep the current exclude from push state.
$secret = $entity->getClientSecret();
if ($secret && $entity->isManageEntity() && !$entity->isExcludedFromPush()) {
$metadata['coin:exclude_from_push'] = '0';
}

$metadata += $this->generateOidcClient($entity);

return $metadata;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static function fromApiResponse(array $metaDataFields)
$eula = isset($metaDataFields['coin:eula'])
? $metaDataFields['coin:eula'] : '';
$excludeFromPush = isset($metaDataFields['coin:exclude_from_push'])
? (int) $metaDataFields['coin:exclude_from_push'] : 0;
? (int) $metaDataFields['coin:exclude_from_push'] : null;
$oidcClient = isset($metaDataFields['coin:oidc_client'])
? (int) $metaDataFields['coin:oidc_client'] : 0;

Expand All @@ -52,7 +52,7 @@ public static function fromApiResponse(array $metaDataFields)
Assert::string($originalMetadataUrl);
Assert::string($applicationUrl);
Assert::string($eula);
Assert::integer($excludeFromPush);
Assert::nullOrIntegerish($excludeFromPush);
Assert::integer($oidcClient);

return new self(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ public function isOidcngResourceServer()

public function isExcludedFromPush()
{
if (is_null($this->getMetaData()->getCoin()->getExcludeFromPush())) {
return true;
}
return $this->getMetaData()->getCoin()->getExcludeFromPush() == 1 ? true : false;
}
}

0 comments on commit 9a4694b

Please sign in to comment.