Newer
Older
package IdPAccountManager::ServiceProvider;
__PACKAGE__->meta->setup(
table => 'serviceproviders',
columns => [
id => { type => 'bigserial', not_null => 1 },
entityid => { type => 'varchar', length => 200, not_null => 1 },
displayname => { type => 'varchar', length => 500 },
contacts => { type => 'array' },
],
primary_key_columns => [ 'id' ],
unique_key => [ 'entityid' ],
);
## Print the content of a test account
sub print {
my ($self, $fd) = @_;
$fd = \*STDOUT unless $fd;
printf $fd
"ServiceProvider ID=%s; entityid=%s; displayname=%s; contacts=%s\n",
$self->id(),
$self->entityid(),
$self->displayname(),
join(',', $self->contacts());
sub is_contact {
my ($self, $email) = @_;
return any { $email eq lc($_) } $self->contacts();