From e3078048bf8f5a535a27eb855554e0287877c832 Mon Sep 17 00:00:00 2001 From: Guillaume Rousse <guillaume.rousse@renater.fr> Date: Fri, 10 Nov 2017 18:06:01 +0100 Subject: [PATCH] get rid of Data:: part in namespace --- bin/account-manager.pl.in | 32 +++++++++---------- .../{Data => }/AuthenticationToken.pm | 2 +- .../AuthenticationToken/Manager.pm | 15 +++++++++ .../Data/TestAccount/Manager.pm | 15 --------- .../{Data => }/ServiceProvider.pm | 2 +- .../ServiceProvider/Manager.pm | 15 +++++++++ .../{Data => }/TestAccount.pm | 2 +- lib/IdPAccountManager/TestAccount/Manager.pm | 15 +++++++++ lib/IdPAccountManager/WebRequest.pm | 18 +++++------ lib/Makefile.am | 12 +++---- 10 files changed, 79 insertions(+), 49 deletions(-) rename lib/IdPAccountManager/{Data => }/AuthenticationToken.pm (96%) create mode 100644 lib/IdPAccountManager/AuthenticationToken/Manager.pm delete mode 100644 lib/IdPAccountManager/Data/TestAccount/Manager.pm rename lib/IdPAccountManager/{Data => }/ServiceProvider.pm (95%) create mode 100644 lib/IdPAccountManager/ServiceProvider/Manager.pm rename lib/IdPAccountManager/{Data => }/TestAccount.pm (99%) create mode 100644 lib/IdPAccountManager/TestAccount/Manager.pm diff --git a/bin/account-manager.pl.in b/bin/account-manager.pl.in index e89f075..e06a1bf 100755 --- a/bin/account-manager.pl.in +++ b/bin/account-manager.pl.in @@ -13,12 +13,12 @@ use Getopt::Long qw(:config auto_help); use Log::Any::Adapter; use Pod::Usage; -use IdPAccountManager::Data::AuthenticationToken; -use IdPAccountManager::Data::AuthenticationToken::Manager; -use IdPAccountManager::Data::ServiceProvider; -use IdPAccountManager::Data::ServiceProvider::Manager; -use IdPAccountManager::Data::TestAccount; -use IdPAccountManager::Data::TestAccount::Manager; +use IdPAccountManager::AuthenticationToken; +use IdPAccountManager::AuthenticationToken::Manager; +use IdPAccountManager::ServiceProvider; +use IdPAccountManager::ServiceProvider::Manager; +use IdPAccountManager::TestAccount; +use IdPAccountManager::TestAccount::Manager; use IdPAccountManager::Configuration; use IdPAccountManager::SAMLMetadata; use IdPAccountManager::Tools; @@ -88,7 +88,7 @@ sub add_account { -verbose => 0 ) unless $options{sp_entityid}; - my $test_account = IdPAccountManager::Data::TestAccount->new( + my $test_account = IdPAccountManager::TestAccount->new( db => $db, account_profile => $options{account_profile}, sp_entityid => $options{sp_entityid} @@ -122,7 +122,7 @@ sub list_accounts { } my $accounts = - IdPAccountManager::Data::TestAccount::Manager->get_testaccounts(db => $db, %args); + IdPAccountManager::TestAccount::Manager->get_testaccounts(db => $db, %args); if (! @$accounts) { printf "No matching test account in DB\n"; @@ -139,7 +139,7 @@ sub list_accounts { printf "%d accounts removed\n", scalar @$accounts; $accounts = - IdPAccountManager::Data::TestAccount::Manager->get_testaccounts( + IdPAccountManager::TestAccount::Manager->get_testaccounts( db => $db ); @@ -176,7 +176,7 @@ sub parse_metadata { ## List SAML entities printf "Hashref representing the metadata:\n"; - print Data::Dumper->Dump($data); + print Dumper->Dump($data); } sub add_provider { @@ -192,7 +192,7 @@ sub add_provider { ) unless $options{contacts}; ## Check if entry already exists in DB first - my $provider = IdPAccountManager::Data::ServiceProvider->new( + my $provider = IdPAccountManager::ServiceProvider->new( db => $db, entityid => $options{sp_entityid} ); @@ -203,7 +203,7 @@ sub add_provider { $provider->contacts($options{contacts}); $provider->displayname($options{displayname}) if $options{displayname}; } else { - $provider = IdPAccountManager::Data::ServiceProvider->new( + $provider = IdPAccountManager::ServiceProvider->new( db => $db, entityid => $options{sp_entityid}, contacts => $options{contacts}, @@ -222,7 +222,7 @@ sub add_provider { sub list_providers { my %args; - my $providers = IdPAccountManager::Data::ServiceProvider::Manager->get_serviceproviders(db => $db, %args); + my $providers = IdPAccountManager::ServiceProvider::Manager->get_serviceproviders(db => $db, %args); if (! @$providers) { printf "No service provider in DB\n"; @@ -255,7 +255,7 @@ sub list_tokens { } my $tokens = - IdPAccountManager::Data::AuthenticationToken::Manager->get_authenticationtokens(db => $db, %args); + IdPAccountManager::AuthenticationToken::Manager->get_authenticationtokens(db => $db, %args); if (!@$tokens) { printf "No corresponding token found in DB\n"; @@ -309,7 +309,7 @@ sub add_token { -verbose => 0 ) unless $options{sp_entityid}; - my $token = IdPAccountManager::Data::AuthenticationToken->new( + my $token = IdPAccountManager::AuthenticationToken->new( db => $db, email_address => $options{email_address}, sp_entityid => $options{sp_entityid} @@ -322,7 +322,7 @@ sub add_token { if ($token->load(speculative => 1)) { $token->delete() or die "failed to delete authentication token\n"; - $token = IdPAccountManager::Data::AuthenticationToken->new( + $token = IdPAccountManager::AuthenticationToken->new( db => $db, email_address => $options{email_address}, sp_entityid => $options{sp_entityid} diff --git a/lib/IdPAccountManager/Data/AuthenticationToken.pm b/lib/IdPAccountManager/AuthenticationToken.pm similarity index 96% rename from lib/IdPAccountManager/Data/AuthenticationToken.pm rename to lib/IdPAccountManager/AuthenticationToken.pm index a888724..e1995df 100644 --- a/lib/IdPAccountManager/Data/AuthenticationToken.pm +++ b/lib/IdPAccountManager/AuthenticationToken.pm @@ -1,4 +1,4 @@ -package IdPAccountManager::Data::AuthenticationToken; +package IdPAccountManager::AuthenticationToken; use strict; use warnings; diff --git a/lib/IdPAccountManager/AuthenticationToken/Manager.pm b/lib/IdPAccountManager/AuthenticationToken/Manager.pm new file mode 100644 index 0000000..bff3f74 --- /dev/null +++ b/lib/IdPAccountManager/AuthenticationToken/Manager.pm @@ -0,0 +1,15 @@ +package IdPAccountManager::AuthenticationToken::Manager; + +use strict; +use warnings; + +use base qw(Rose::DB::Object::Manager); + +use IdPAccountManager::AuthenticationToken; + +sub object_class { 'IdPAccountManager::AuthenticationToken' } + +__PACKAGE__->make_manager_methods('authenticationtokens'); + +1; + diff --git a/lib/IdPAccountManager/Data/TestAccount/Manager.pm b/lib/IdPAccountManager/Data/TestAccount/Manager.pm deleted file mode 100644 index 4d96788..0000000 --- a/lib/IdPAccountManager/Data/TestAccount/Manager.pm +++ /dev/null @@ -1,15 +0,0 @@ -package IdPAccountManager::Data::TestAccount::Manager; - -use strict; -use warnings; - -use base qw(Rose::DB::Object::Manager); - -use IdPAccountManager::Data::TestAccount; - -sub object_class { 'IdPAccountManager::Data::TestAccount' } - -__PACKAGE__->make_manager_methods('testaccounts'); - -1; - diff --git a/lib/IdPAccountManager/Data/ServiceProvider.pm b/lib/IdPAccountManager/ServiceProvider.pm similarity index 95% rename from lib/IdPAccountManager/Data/ServiceProvider.pm rename to lib/IdPAccountManager/ServiceProvider.pm index 5672d41..44b5300 100644 --- a/lib/IdPAccountManager/Data/ServiceProvider.pm +++ b/lib/IdPAccountManager/ServiceProvider.pm @@ -1,4 +1,4 @@ -package IdPAccountManager::Data::ServiceProvider; +package IdPAccountManager::ServiceProvider; use strict; use warnings; diff --git a/lib/IdPAccountManager/ServiceProvider/Manager.pm b/lib/IdPAccountManager/ServiceProvider/Manager.pm new file mode 100644 index 0000000..d87002c --- /dev/null +++ b/lib/IdPAccountManager/ServiceProvider/Manager.pm @@ -0,0 +1,15 @@ +package IdPAccountManager::ServiceProvider::Manager; + +use strict; +use warnings; + +use base qw(Rose::DB::Object::Manager); + +use IdPAccountManager::ServiceProvider; + +sub object_class { 'IdPAccountManager::ServiceProvider' } + +__PACKAGE__->make_manager_methods('serviceproviders'); + +1; + diff --git a/lib/IdPAccountManager/Data/TestAccount.pm b/lib/IdPAccountManager/TestAccount.pm similarity index 99% rename from lib/IdPAccountManager/Data/TestAccount.pm rename to lib/IdPAccountManager/TestAccount.pm index f58f63c..1003333 100644 --- a/lib/IdPAccountManager/Data/TestAccount.pm +++ b/lib/IdPAccountManager/TestAccount.pm @@ -1,4 +1,4 @@ -package IdPAccountManager::Data::TestAccount; +package IdPAccountManager::TestAccount; use strict; use warnings; diff --git a/lib/IdPAccountManager/TestAccount/Manager.pm b/lib/IdPAccountManager/TestAccount/Manager.pm new file mode 100644 index 0000000..da68c7e --- /dev/null +++ b/lib/IdPAccountManager/TestAccount/Manager.pm @@ -0,0 +1,15 @@ +package IdPAccountManager::TestAccount::Manager; + +use strict; +use warnings; + +use base qw(Rose::DB::Object::Manager); + +use IdPAccountManager::TestAccount; + +sub object_class { 'IdPAccountManager::TestAccount' } + +__PACKAGE__->make_manager_methods('testaccounts'); + +1; + diff --git a/lib/IdPAccountManager/WebRequest.pm b/lib/IdPAccountManager/WebRequest.pm index db5d96b..1b82d34 100755 --- a/lib/IdPAccountManager/WebRequest.pm +++ b/lib/IdPAccountManager/WebRequest.pm @@ -9,9 +9,9 @@ use Template; use Log::Any::Adapter; use List::MoreUtils qw(uniq); -use IdPAccountManager::Data::TestAccount; -use IdPAccountManager::Data::AuthenticationToken; -use IdPAccountManager::Data::ServiceProvider; +use IdPAccountManager::TestAccount; +use IdPAccountManager::AuthenticationToken; +use IdPAccountManager::ServiceProvider; use IdPAccountManager::SAMLMetadata; use IdPAccountManager::Tools; @@ -213,7 +213,7 @@ sub req_select_sp { } # Create a persistent service provider object - my $provider = IdPAccountManager::Data::ServiceProvider->new( + my $provider = IdPAccountManager::ServiceProvider->new( db => $self->{db}, entityid => $self->{in}->{sp_entityid} ); @@ -288,7 +288,7 @@ sub req_generate_token { return undef; } - my $provider = IdPAccountManager::Data::ServiceProvider->new( + my $provider = IdPAccountManager::ServiceProvider->new( db => $self->{db}, entityid => $self->{in}->{sp_entityid}, ); @@ -318,7 +318,7 @@ sub req_generate_token { return undef; } - my $token = IdPAccountManager::Data::AuthenticationToken->new( + my $token = IdPAccountManager::AuthenticationToken->new( db => $self->{db}, email_address => $self->{in}->{email_address}, sp_entityid => $self->{in}->{sp_entityid} @@ -340,7 +340,7 @@ sub req_generate_token { return undef; } - $token = IdPAccountManager::Data::AuthenticationToken->new( + $token = IdPAccountManager::AuthenticationToken->new( db => $self->{db}, email_address => $self->{in}->{email_address}, sp_entityid => $self->{in}->{sp_entityid} @@ -428,7 +428,7 @@ sub req_validate_token { return undef; } - my $token = IdPAccountManager::Data::AuthenticationToken->new( + my $token = IdPAccountManager::AuthenticationToken->new( db => $self->{db}, token => $self->{in}->{authentication_token} ); @@ -465,7 +465,7 @@ sub req_validate_token { my @accounts; foreach my $profile (split(/, */, $self->{configuration}->{account_profiles})) { - my $account = IdPAccountManager::Data::TestAccount->new( + my $account = IdPAccountManager::TestAccount->new( db => $self->{db}, account_profile => $profile, sp_entityid => $self->{in}->{sp_entityid}, diff --git a/lib/Makefile.am b/lib/Makefile.am index 525a6da..5e72617 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,16 +1,16 @@ modulesdir = $(pkgdatadir)/lib nobase_modules_DATA = \ + IdPAccountManager/AuthenticationToken.pm \ + IdPAccountManager/AuthenticationToken/Manager.pm \ IdPAccountManager/Configuration.pm \ - IdPAccountManager/Data/AuthenticationToken.pm \ - IdPAccountManager/Data/AuthenticationToken/Manager.pm \ - IdPAccountManager/Data/ServiceProvider.pm \ - IdPAccountManager/Data/ServiceProvider/Manager.pm \ - IdPAccountManager/Data/TestAccount.pm \ - IdPAccountManager/Data/TestAccount/Manager.pm \ IdPAccountManager/DB.pm \ IdPAccountManager/DB/Object.pm \ IdPAccountManager/SAMLMetadata.pm \ + IdPAccountManager/ServiceProvider.pm \ + IdPAccountManager/ServiceProvider/Manager.pm \ + IdPAccountManager/TestAccount.pm \ + IdPAccountManager/TestAccount/Manager.pm \ IdPAccountManager/Tools.pm \ IdPAccountManager/WebRequest.pm -- GitLab