From dd438d444eb6dc32eff1a4d909ea03838489cc77 Mon Sep 17 00:00:00 2001 From: Guillaume Rousse <guillaume.rousse@renater.fr> Date: Fri, 8 Dec 2017 15:15:38 +0100 Subject: [PATCH] simplification: rename ServiceProvider as Service --- bin/account-manager.pl.in | 10 +++++----- conf/create-manager-db.sql | 2 +- .../{ServiceProvider.pm => Service.pm} | 4 ++-- lib/AccountManager/Service/Manager.pm | 15 +++++++++++++++ lib/AccountManager/ServiceProvider/Manager.pm | 15 --------------- lib/AccountManager/WebRequest.pm | 6 +++--- lib/Makefile.am | 4 ++-- 7 files changed, 28 insertions(+), 28 deletions(-) rename lib/AccountManager/{ServiceProvider.pm => Service.pm} (92%) create mode 100644 lib/AccountManager/Service/Manager.pm delete mode 100644 lib/AccountManager/ServiceProvider/Manager.pm diff --git a/bin/account-manager.pl.in b/bin/account-manager.pl.in index 1414838..ecf15bb 100755 --- a/bin/account-manager.pl.in +++ b/bin/account-manager.pl.in @@ -17,8 +17,8 @@ use Pod::Usage; use AccountManager::Token; use AccountManager::Token::Manager; -use AccountManager::ServiceProvider; -use AccountManager::ServiceProvider::Manager; +use AccountManager::Service; +use AccountManager::Service::Manager; use AccountManager::Account; use AccountManager::Account::Manager; use AccountManager::SAMLMetadata; @@ -195,7 +195,7 @@ sub add_provider { ) unless $options{contacts}; ## Check if entry already exists in DB first - my $provider = AccountManager::ServiceProvider->new( + my $provider = AccountManager::Service->new( db => $db, entityid => $options{sp_entityid} ); @@ -206,7 +206,7 @@ sub add_provider { $provider->contacts($options{contacts}); $provider->displayname($options{displayname}) if $options{displayname}; } else { - $provider = AccountManager::ServiceProvider->new( + $provider = AccountManager::Service->new( db => $db, entityid => $options{sp_entityid}, contacts => $options{contacts}, @@ -223,7 +223,7 @@ sub add_provider { sub list_providers { my %args; - my $providers = AccountManager::ServiceProvider::Manager->get_serviceproviders(db => $db, %args); + my $providers = AccountManager::Service::Manager->get_services(db => $db, %args); if (! @$providers) { printf "No service provider in DB\n"; diff --git a/conf/create-manager-db.sql b/conf/create-manager-db.sql index 534ad1e..9c162f1 100644 --- a/conf/create-manager-db.sql +++ b/conf/create-manager-db.sql @@ -18,7 +18,7 @@ CREATE TABLE `tokens` ( CONSTRAINT token_email_entity UNIQUE (email_address(50),sp_entityid(50)) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -CREATE TABLE `serviceproviders` ( +CREATE TABLE `services` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `entityid` varchar(200) NOT NULL, `displayname` varchar(500) DEFAULT NULL, diff --git a/lib/AccountManager/ServiceProvider.pm b/lib/AccountManager/Service.pm similarity index 92% rename from lib/AccountManager/ServiceProvider.pm rename to lib/AccountManager/Service.pm index b1ffcd2..2676f98 100644 --- a/lib/AccountManager/ServiceProvider.pm +++ b/lib/AccountManager/Service.pm @@ -1,4 +1,4 @@ -package AccountManager::ServiceProvider; +package AccountManager::Service; use strict; use warnings; @@ -8,7 +8,7 @@ use base 'AccountManager::DB::Object'; use List::MoreUtils qw(any); __PACKAGE__->meta->setup( - table => 'serviceproviders', + table => 'services', columns => [ id => { type => 'bigserial', not_null => 1 }, diff --git a/lib/AccountManager/Service/Manager.pm b/lib/AccountManager/Service/Manager.pm new file mode 100644 index 0000000..dfab75b --- /dev/null +++ b/lib/AccountManager/Service/Manager.pm @@ -0,0 +1,15 @@ +package AccountManager::Service::Manager; + +use strict; +use warnings; + +use base qw(Rose::DB::Object::Manager); + +use AccountManager::Service; + +sub object_class { 'AccountManager::Service' } + +__PACKAGE__->make_manager_methods('services'); + +1; + diff --git a/lib/AccountManager/ServiceProvider/Manager.pm b/lib/AccountManager/ServiceProvider/Manager.pm deleted file mode 100644 index 651bb0c..0000000 --- a/lib/AccountManager/ServiceProvider/Manager.pm +++ /dev/null @@ -1,15 +0,0 @@ -package AccountManager::ServiceProvider::Manager; - -use strict; -use warnings; - -use base qw(Rose::DB::Object::Manager); - -use AccountManager::ServiceProvider; - -sub object_class { 'AccountManager::ServiceProvider' } - -__PACKAGE__->make_manager_methods('serviceproviders'); - -1; - diff --git a/lib/AccountManager/WebRequest.pm b/lib/AccountManager/WebRequest.pm index 0681575..0081266 100644 --- a/lib/AccountManager/WebRequest.pm +++ b/lib/AccountManager/WebRequest.pm @@ -13,7 +13,7 @@ use List::MoreUtils qw(uniq); use AccountManager::Account; use AccountManager::Account::Manager; use AccountManager::Token; -use AccountManager::ServiceProvider; +use AccountManager::Service; use AccountManager::SAMLMetadata; use AccountManager::Tools; @@ -215,7 +215,7 @@ sub req_select_sp { } # Create a persistent service provider object - my $provider = AccountManager::ServiceProvider->new( + my $provider = AccountManager::Service->new( db => $self->{db}, entityid => $self->{in}->{sp_entityid} ); @@ -290,7 +290,7 @@ sub req_generate_token { return; } - my $provider = AccountManager::ServiceProvider->new( + my $provider = AccountManager::Service->new( db => $self->{db}, entityid => $self->{in}->{sp_entityid}, ); diff --git a/lib/Makefile.am b/lib/Makefile.am index d737bc5..e8a5143 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -6,8 +6,8 @@ nobase_modules_DATA = \ AccountManager/DB.pm \ AccountManager/DB/Object.pm \ AccountManager/SAMLMetadata.pm \ - AccountManager/ServiceProvider.pm \ - AccountManager/ServiceProvider/Manager.pm \ + AccountManager/Service.pm \ + AccountManager/Service/Manager.pm \ AccountManager/Account.pm \ AccountManager/Account/Manager.pm \ AccountManager/Tools.pm \ -- GitLab