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

simplification: rename ServiceProvider as Service

parent 47bd9d12
Branches
Tags
No related merge requests found
...@@ -17,8 +17,8 @@ use Pod::Usage; ...@@ -17,8 +17,8 @@ use Pod::Usage;
use AccountManager::Token; use AccountManager::Token;
use AccountManager::Token::Manager; use AccountManager::Token::Manager;
use AccountManager::ServiceProvider; use AccountManager::Service;
use AccountManager::ServiceProvider::Manager; use AccountManager::Service::Manager;
use AccountManager::Account; use AccountManager::Account;
use AccountManager::Account::Manager; use AccountManager::Account::Manager;
use AccountManager::SAMLMetadata; use AccountManager::SAMLMetadata;
...@@ -195,7 +195,7 @@ sub add_provider { ...@@ -195,7 +195,7 @@ sub add_provider {
) unless $options{contacts}; ) unless $options{contacts};
## Check if entry already exists in DB first ## Check if entry already exists in DB first
my $provider = AccountManager::ServiceProvider->new( my $provider = AccountManager::Service->new(
db => $db, db => $db,
entityid => $options{sp_entityid} entityid => $options{sp_entityid}
); );
...@@ -206,7 +206,7 @@ sub add_provider { ...@@ -206,7 +206,7 @@ sub add_provider {
$provider->contacts($options{contacts}); $provider->contacts($options{contacts});
$provider->displayname($options{displayname}) if $options{displayname}; $provider->displayname($options{displayname}) if $options{displayname};
} else { } else {
$provider = AccountManager::ServiceProvider->new( $provider = AccountManager::Service->new(
db => $db, db => $db,
entityid => $options{sp_entityid}, entityid => $options{sp_entityid},
contacts => $options{contacts}, contacts => $options{contacts},
...@@ -223,7 +223,7 @@ sub add_provider { ...@@ -223,7 +223,7 @@ sub add_provider {
sub list_providers { sub list_providers {
my %args; my %args;
my $providers = AccountManager::ServiceProvider::Manager->get_serviceproviders(db => $db, %args); my $providers = AccountManager::Service::Manager->get_services(db => $db, %args);
if (! @$providers) { if (! @$providers) {
printf "No service provider in DB\n"; printf "No service provider in DB\n";
......
...@@ -18,7 +18,7 @@ CREATE TABLE `tokens` ( ...@@ -18,7 +18,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 `serviceproviders` ( CREATE TABLE `services` (
`id` bigint(20) NOT NULL AUTO_INCREMENT, `id` bigint(20) NOT NULL AUTO_INCREMENT,
`entityid` varchar(200) NOT NULL, `entityid` varchar(200) NOT NULL,
`displayname` varchar(500) DEFAULT NULL, `displayname` varchar(500) DEFAULT NULL,
......
package AccountManager::ServiceProvider; package AccountManager::Service;
use strict; use strict;
use warnings; use warnings;
...@@ -8,7 +8,7 @@ use base 'AccountManager::DB::Object'; ...@@ -8,7 +8,7 @@ use base 'AccountManager::DB::Object';
use List::MoreUtils qw(any); use List::MoreUtils qw(any);
__PACKAGE__->meta->setup( __PACKAGE__->meta->setup(
table => 'serviceproviders', table => 'services',
columns => [ columns => [
id => { type => 'bigserial', not_null => 1 }, id => { type => 'bigserial', not_null => 1 },
......
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;
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;
...@@ -13,7 +13,7 @@ use List::MoreUtils qw(uniq); ...@@ -13,7 +13,7 @@ use List::MoreUtils qw(uniq);
use AccountManager::Account; use AccountManager::Account;
use AccountManager::Account::Manager; use AccountManager::Account::Manager;
use AccountManager::Token; use AccountManager::Token;
use AccountManager::ServiceProvider; use AccountManager::Service;
use AccountManager::SAMLMetadata; use AccountManager::SAMLMetadata;
use AccountManager::Tools; use AccountManager::Tools;
...@@ -215,7 +215,7 @@ sub req_select_sp { ...@@ -215,7 +215,7 @@ sub req_select_sp {
} }
# Create a persistent service provider object # Create a persistent service provider object
my $provider = AccountManager::ServiceProvider->new( my $provider = AccountManager::Service->new(
db => $self->{db}, db => $self->{db},
entityid => $self->{in}->{sp_entityid} entityid => $self->{in}->{sp_entityid}
); );
...@@ -290,7 +290,7 @@ sub req_generate_token { ...@@ -290,7 +290,7 @@ sub req_generate_token {
return; return;
} }
my $provider = AccountManager::ServiceProvider->new( my $provider = AccountManager::Service->new(
db => $self->{db}, db => $self->{db},
entityid => $self->{in}->{sp_entityid}, entityid => $self->{in}->{sp_entityid},
); );
......
...@@ -6,8 +6,8 @@ nobase_modules_DATA = \ ...@@ -6,8 +6,8 @@ nobase_modules_DATA = \
AccountManager/DB.pm \ AccountManager/DB.pm \
AccountManager/DB/Object.pm \ AccountManager/DB/Object.pm \
AccountManager/SAMLMetadata.pm \ AccountManager/SAMLMetadata.pm \
AccountManager/ServiceProvider.pm \ AccountManager/Service.pm \
AccountManager/ServiceProvider/Manager.pm \ AccountManager/Service/Manager.pm \
AccountManager/Account.pm \ AccountManager/Account.pm \
AccountManager/Account/Manager.pm \ AccountManager/Account/Manager.pm \
AccountManager/Tools.pm \ AccountManager/Tools.pm \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment