Skip to content
Snippets Groups Projects
Commit e84a4d20 authored by Guillaume ROUSSE's avatar Guillaume ROUSSE
Browse files

add multi-valued federations column

parent 05bdbbce
No related branches found
No related tags found
No related merge requests found
......@@ -86,25 +86,35 @@ foreach my $id (split(/, */, $configuration->{groups}->{list})) {
}
foreach my $entry (@$entities) {
# skip duplicates
next if $seen{$entry->{entityid}}++;
# skip entities different from SP or IdP
next if !$entry->{type};
my $entity = AccountManager::Entity->new(
db => $db,
type => $entry->{type},
entityid => $entry->{entityid},
displayname => $entry->{display_name},
information_url => $entry->{information_url},
organization_url => $entry->{organization_url},
);
$entity->contacts(uniq map { $_->{EmailAddress} } @{$entry->{contacts}})
if $entry->{contacts};
my $entity;
if ($seen{$entry->{entityid}}++) {
$entity = AccountManager::Entity->new(
db => $db,
entityid => $entry->{entityid},
);
$entity->load();
$entity->federations(
$entity->federations(), $id
);
$entity->update();
} else {
$entity = AccountManager::Entity->new(
db => $db,
type => $entry->{type},
entityid => $entry->{entityid},
displayname => $entry->{display_name},
information_url => $entry->{information_url},
organization_url => $entry->{organization_url},
);
$entity->contacts(uniq map { $_->{EmailAddress} } @{$entry->{contacts}})
if $entry->{contacts};
$entity->federations($id);
$entity->save();
}
$entity->save();
}
}
......
......@@ -19,8 +19,9 @@ CREATE TABLE entities (
organization_url varchar(200) DEFAULT NULL,
displayname varchar(500) DEFAULT NULL,
contacts varchar(2000) DEFAULT NULL,
federations varchar(50) DEFAULT NULL,
PRIMARY KEY (id),
UNIQUE KEY entityid (entityid)
KEY entityid (entityid)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;
CREATE TABLE accounts (
......
......@@ -19,6 +19,7 @@ __PACKAGE__->meta->setup(
information_url => { type => 'varchar', length => 200 },
organization_url => { type => 'varchar', length => 200 },
contacts => { type => 'array' },
federations => { type => 'array' },
],
primary_key_columns => [ 'id' ],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment