Skip to content

Commit

Permalink
update UpdateEntity.php to work with new column
Browse files Browse the repository at this point in the history
  • Loading branch information
temaotl committed Dec 11, 2024
1 parent 8d828ac commit a219685
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
11 changes: 7 additions & 4 deletions app/Console/Commands/ValidateMetaConsole.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,14 @@ private function runMDA(Federation $federation)
public function handle()
{

/* $entity = Entity::find(1);
$xml_document = $entity->xml_file;
/* $entity = Entity::find(1);
$xml_document = $entity->xml_file;
$groupLink = $entity->groups()->pluck('xml_value')->toArray();
$xml_document = $this->updateXmlGroups($xml_document, $entity->groups()->pluck('name')->toArray());
dump($xml_document);*/
dump($groupLink);
$xml_document = $this->updateXmlGroups($xml_document, $groupLink);
dump($xml_document);*/

/* if(!empty($entity->groups)) {
$groups = $entity->groups()->pluck('name')->toArray();
Expand Down
12 changes: 6 additions & 6 deletions app/Traits/DumpFromGit/EntitiesHelp/UpdateEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ private function updateXmlCategories(string $xml_document, int $category_id): st
/**
* @throws \DOMException
*/
public function updateXmlGroups(string $xml_document, array $groupsName): string
public function updateXmlGroups(string $xml_document, array $groupLink): string
{
$dom = $this->createDOM($xml_document);
$attribute = $this->prepareXmlStructure($dom);

foreach ($groupsName as $name) {
$attributeValue = $dom->createElementNS($this->samlURI, 'saml:AttributeValue', config("groups.$name"));
foreach ($groupLink as $link) {
$attributeValue = $dom->createElementNS($this->samlURI, 'saml:AttributeValue', $link);
$attribute->appendChild($attributeValue);
}

Expand Down Expand Up @@ -182,10 +182,10 @@ public function updateEntityXml($entity, array $timestampDocumentArray = []): vo
if (! empty($entity->category_id)) {
$xml_document = $this->updateXmlCategories($xml_document, $entity->category_id);
}
$groupName = $entity->groups()->pluck('name')->toArray();
$groupLink = $entity->groups()->pluck('xml_value')->toArray();

if (! empty($groupName)) {
$xml_document = $this->updateXmlGroups($xml_document, $groupName);
if (! empty($groupLink)) {
$xml_document = $this->updateXmlGroups($xml_document, $groupLink);
}

$xml_document = $this->updateRegistrationInfo($xml_document, $entity->entityid, $timestampDocumentArray);
Expand Down

0 comments on commit a219685

Please sign in to comment.