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

rename ServiceProvider class to Entity

parent 5a13a125
Branches
Tags
No related merge requests found
...@@ -14,7 +14,7 @@ use Pod::Usage; ...@@ -14,7 +14,7 @@ use Pod::Usage;
use AccountManager::DB; use AccountManager::DB;
use AccountManager::Metadata; use AccountManager::Metadata;
use AccountManager::ServiceProvider; use AccountManager::Entity;
my %options; my %options;
GetOptions( GetOptions(
...@@ -48,7 +48,7 @@ my $ua = LWP::UserAgent->new(); ...@@ -48,7 +48,7 @@ my $ua = LWP::UserAgent->new();
$db->begin_work(); $db->begin_work();
AccountManager::ServiceProvider->delete_service_providers(all => 1); AccountManager::Entity->delete_entities(all => 1);
my %seen; my %seen;
foreach my $id (split(/, */, $configuration->{groups}->{list})) { foreach my $id (split(/, */, $configuration->{groups}->{list})) {
...@@ -89,7 +89,7 @@ foreach my $id (split(/, */, $configuration->{groups}->{list})) { ...@@ -89,7 +89,7 @@ foreach my $id (split(/, */, $configuration->{groups}->{list})) {
# avoid duplicates # avoid duplicates
next if $seen{$entry->{entityid}}++; next if $seen{$entry->{entityid}}++;
my $entity = AccountManager::ServiceProvider->new( my $entity = AccountManager::Entity->new(
db => $db, db => $db,
entityid => $entry->{entityid}, entityid => $entry->{entityid},
displayname => $entry->{display_name}, displayname => $entry->{display_name},
......
...@@ -11,7 +11,7 @@ CREATE TABLE tokens ( ...@@ -11,7 +11,7 @@ CREATE TABLE tokens (
CONSTRAINT token_email_entity UNIQUE (email_address(50),sp_entityid(50)) CONSTRAINT token_email_entity UNIQUE (email_address(50),sp_entityid(50))
) ENGINE=MyISAM DEFAULT CHARSET=utf8; ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE services ( CREATE TABLE entities (
id bigint(20) NOT NULL AUTO_INCREMENT, id bigint(20) NOT NULL AUTO_INCREMENT,
entityid varchar(200) NOT NULL, entityid varchar(200) NOT NULL,
url varchar(200) DEFAULT NULL, url varchar(200) DEFAULT NULL,
......
...@@ -15,7 +15,7 @@ use UNIVERSAL::require; ...@@ -15,7 +15,7 @@ use UNIVERSAL::require;
use AccountManager::Account; use AccountManager::Account;
use AccountManager::Metadata; use AccountManager::Metadata;
use AccountManager::ServiceProvider; use AccountManager::Entity;
use AccountManager::Token; use AccountManager::Token;
use AccountManager::Tools; use AccountManager::Tools;
use AccountManager::L10N; use AccountManager::L10N;
...@@ -346,7 +346,7 @@ sub req_select_email { ...@@ -346,7 +346,7 @@ sub req_select_email {
my $federation = $self->get_parameter(name => 'federation'); my $federation = $self->get_parameter(name => 'federation');
# Create a persistent service provider object # Create a persistent service provider object
my $sp = AccountManager::ServiceProvider->new( my $sp = AccountManager::Entity->new(
db => $self->{db}, db => $self->{db},
entityid => $entityid entityid => $entityid
); );
...@@ -423,7 +423,7 @@ sub req_complete_challenge { ...@@ -423,7 +423,7 @@ sub req_complete_challenge {
my $entityid = $self->get_parameter(name => 'entityid'); my $entityid = $self->get_parameter(name => 'entityid');
my $email = $self->get_parameter(name => 'email'); my $email = $self->get_parameter(name => 'email');
my $sp = AccountManager::ServiceProvider->new( my $sp = AccountManager::Entity->new(
db => $self->{db}, db => $self->{db},
entityid => $entityid, entityid => $entityid,
); );
...@@ -612,7 +612,7 @@ sub req_create_accounts { ...@@ -612,7 +612,7 @@ sub req_create_accounts {
$self->check_token(token => $token, entityid => $entityid); $self->check_token(token => $token, entityid => $entityid);
my $sp = AccountManager::ServiceProvider->new( my $sp = AccountManager::Entity->new(
db => $self->{db}, db => $self->{db},
entityid => $entityid, entityid => $entityid,
); );
......
package AccountManager::ServiceProvider; package AccountManager::Entity;
use strict; use strict;
use warnings; use warnings;
...@@ -9,7 +9,7 @@ use List::MoreUtils qw(any); ...@@ -9,7 +9,7 @@ use List::MoreUtils qw(any);
use Rose::DB::Object::Manager; use Rose::DB::Object::Manager;
__PACKAGE__->meta->setup( __PACKAGE__->meta->setup(
table => 'services', table => 'entities',
columns => [ columns => [
id => { type => 'bigserial', not_null => 1 }, id => { type => 'bigserial', not_null => 1 },
...@@ -24,14 +24,14 @@ __PACKAGE__->meta->setup( ...@@ -24,14 +24,14 @@ __PACKAGE__->meta->setup(
unique_key => [ 'entityid' ], unique_key => [ 'entityid' ],
); );
Rose::DB::Object::Manager->make_manager_methods('service_providers'); Rose::DB::Object::Manager->make_manager_methods('entities');
sub print { sub print {
my ($self, $fd) = @_; my ($self, $fd) = @_;
$fd = \*STDOUT unless $fd; $fd = \*STDOUT unless $fd;
printf $fd printf $fd
"Service ID=%s; entityid=%s; displayname=%s; contacts=%s\n", "Entity ID=%s; entityid=%s; displayname=%s; contacts=%s\n",
$self->id(), $self->id(),
$self->entityid(), $self->entityid(),
$self->displayname() || '', $self->displayname() || '',
......
...@@ -5,7 +5,7 @@ nobase_modules_DATA = \ ...@@ -5,7 +5,7 @@ nobase_modules_DATA = \
AccountManager/DB.pm \ AccountManager/DB.pm \
AccountManager/DB/Object.pm \ AccountManager/DB/Object.pm \
AccountManager/Metadata.pm \ AccountManager/Metadata.pm \
AccountManager/ServiceProvider.pm \ AccountManager/Entity.pm \
AccountManager/Account.pm \ AccountManager/Account.pm \
AccountManager/Tools.pm \ AccountManager/Tools.pm \
AccountManager/L10N.pm \ AccountManager/L10N.pm \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment