diff --git a/bin/account-manager.pl.in b/bin/account-manager.pl.in index 2c2fbeef94a354f9ba5ca9ac2a46328087e99afc..1414838f7c7ac34ddce6b7957460abfa199e5471 100755 --- a/bin/account-manager.pl.in +++ b/bin/account-manager.pl.in @@ -19,8 +19,8 @@ use AccountManager::Token; use AccountManager::Token::Manager; use AccountManager::ServiceProvider; use AccountManager::ServiceProvider::Manager; -use AccountManager::TestAccount; -use AccountManager::TestAccount::Manager; +use AccountManager::Account; +use AccountManager::Account::Manager; use AccountManager::SAMLMetadata; use AccountManager::Tools; @@ -93,7 +93,7 @@ sub add_account { $configuration->{service}->{account_validity_period}; my $password = AccountManager::Tools::generate_password(); - my $account = AccountManager::TestAccount->new( + my $account = AccountManager::Account->new( db => $db, profile => $options{profile}, sp_entityid => $options{sp_entityid}, @@ -127,7 +127,7 @@ sub list_accounts { } my $accounts = - AccountManager::TestAccount::Manager->get_testaccounts(db => $db, %args); + AccountManager::Account::Manager->get_accounts(db => $db, %args); if (! @$accounts) { printf "No matching test account in DB\n"; @@ -143,7 +143,7 @@ sub list_accounts { } printf "%d accounts removed\n", scalar @$accounts; - $accounts = AccountManager::TestAccount::Manager->get_testaccounts( + $accounts = AccountManager::Account::Manager->get_accounts( db => $db ); diff --git a/conf/create-manager-db.sql b/conf/create-manager-db.sql index 635cbf295437c401cc6da7fd883852fcdba7356c..534ad1ebf7f2c06dcac1c37fa63fd75f34b37dd8 100644 --- a/conf/create-manager-db.sql +++ b/conf/create-manager-db.sql @@ -27,7 +27,7 @@ CREATE TABLE `serviceproviders` ( UNIQUE KEY `entityid` (`entityid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ; -CREATE TABLE `testaccounts` ( +CREATE TABLE `accounts` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, `password_hash` varchar(50) NOT NULL, `creation_date` date DEFAULT NULL, diff --git a/lib/AccountManager/TestAccount.pm b/lib/AccountManager/Account.pm similarity index 98% rename from lib/AccountManager/TestAccount.pm rename to lib/AccountManager/Account.pm index f85c6c9d3cd7bdaf953d6745c0e862f339b620d3..65896b67f5bce290332c11db71586580f5a9a4c1 100644 --- a/lib/AccountManager/TestAccount.pm +++ b/lib/AccountManager/Account.pm @@ -1,4 +1,4 @@ -package AccountManager::TestAccount; +package AccountManager::Account; use strict; use warnings; @@ -6,7 +6,7 @@ use warnings; use base 'AccountManager::DB::Object'; __PACKAGE__->meta->setup( - table => 'testaccounts', + table => 'accounts', columns => [ id => { type => 'bigserial', not_null => 1 }, diff --git a/lib/AccountManager/Account/Manager.pm b/lib/AccountManager/Account/Manager.pm new file mode 100644 index 0000000000000000000000000000000000000000..66121147a1a18cb232d0fe754573f7301c163a0e --- /dev/null +++ b/lib/AccountManager/Account/Manager.pm @@ -0,0 +1,15 @@ +package AccountManager::Account::Manager; + +use strict; +use warnings; + +use base qw(Rose::DB::Object::Manager); + +use AccountManager::Account; + +sub object_class { 'AccountManager::Account' } + +__PACKAGE__->make_manager_methods('accounts'); + +1; + diff --git a/lib/AccountManager/TestAccount/Manager.pm b/lib/AccountManager/TestAccount/Manager.pm deleted file mode 100644 index ea035c7b443f73a35e3870414fd564e3115eb99a..0000000000000000000000000000000000000000 --- a/lib/AccountManager/TestAccount/Manager.pm +++ /dev/null @@ -1,15 +0,0 @@ -package AccountManager::TestAccount::Manager; - -use strict; -use warnings; - -use base qw(Rose::DB::Object::Manager); - -use AccountManager::TestAccount; - -sub object_class { 'AccountManager::TestAccount' } - -__PACKAGE__->make_manager_methods('testaccounts'); - -1; - diff --git a/lib/AccountManager/WebRequest.pm b/lib/AccountManager/WebRequest.pm index 1e5fddd6dab8a9614fa348310657b7811b1ca278..0681575550365e975dbc09e59472f79ab9b8374e 100644 --- a/lib/AccountManager/WebRequest.pm +++ b/lib/AccountManager/WebRequest.pm @@ -10,8 +10,8 @@ use Template; use Log::Any::Adapter; use List::MoreUtils qw(uniq); -use AccountManager::TestAccount; -use AccountManager::TestAccount::Manager; +use AccountManager::Account; +use AccountManager::Account::Manager; use AccountManager::Token; use AccountManager::ServiceProvider; use AccountManager::SAMLMetadata; @@ -470,7 +470,7 @@ sub req_validate_token { foreach my $profile (split(/, */, $profiles)) { my $password = AccountManager::Tools::generate_password(); - my $account = AccountManager::TestAccount->new( + my $account = AccountManager::Account->new( db => $self->{db}, profile => $profile, sp_entityid => $entity, @@ -494,7 +494,7 @@ sub req_validate_token { } ## Update simpleSAMLphp configuration to enable test accounts - my $accounts = AccountManager::TestAccount::Manager->get_testaccounts( + my $accounts = AccountManager::Account::Manager->get_accounts( db => $self->{db} ); diff --git a/lib/Makefile.am b/lib/Makefile.am index 7ae6a433efb445cb6151e39ca06125c2f7f1f888..d737bc5d84f6886c7684ecf7f6df4e32b14e76d5 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -8,8 +8,8 @@ nobase_modules_DATA = \ AccountManager/SAMLMetadata.pm \ AccountManager/ServiceProvider.pm \ AccountManager/ServiceProvider/Manager.pm \ - AccountManager/TestAccount.pm \ - AccountManager/TestAccount/Manager.pm \ + AccountManager/Account.pm \ + AccountManager/Account/Manager.pm \ AccountManager/Tools.pm \ AccountManager/WebRequest.pm