Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eduGAIN Access Check - Account manager
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
edugain
eduGAIN Access Check - Account manager
Commits
b65a48b3
Commit
b65a48b3
authored
7 years ago
by
Guillaume ROUSSE
Browse files
Options
Downloads
Patches
Plain Diff
use a dedicated function for each action
parent
8ee1cff7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/account-manager-client.pl
+42
-14
42 additions, 14 deletions
bin/account-manager-client.pl
with
42 additions
and
14 deletions
bin/account-manager-client.pl
+
42
−
14
View file @
b65a48b3
...
...
@@ -11,6 +11,8 @@ use strict;
use
warnings
;
use
utf8
;
use
lib
qw(lib conf)
;
use
feature
"
switch
";
no
warnings
'
experimental::smartmatch
';
use
Getopt::
Long
qw(:config auto_help)
;
use
Pod::
Usage
;
...
...
@@ -58,8 +60,25 @@ IdPAccountManager::DB->register_db(
my
$db
=
IdPAccountManager::
DB
->
new
();
if
(
$action
eq
'
add_test_account
')
{
for
(
$action
)
{
when
('
add_test_account
')
{
add_test_account
()
}
when
('
list_test_accounts
')
{
list_test_accounts
()
}
when
('
add_service_provider
')
{
add_service_provider
()
}
when
('
list_service_providers
')
{
list_service_providers
()
}
when
('
add_authentication_token
')
{
add_authentication_token
()
}
when
('
get_authentication_token
')
{
get_authentication_token
()
}
when
('
list_authentication_tokens
')
{
list_authentication_tokens
()
}
when
('
parse_federation_metadata
')
{
parse_federation_metadata
()
}
when
('
send_notice
')
{
send_notice
()
}
default
{
pod2usage
(
-
message
=>
"
invalid action '
$action
', aborting
\n
",
-
verbose
=>
0
);
}
}
sub
add_test_account
{
pod2usage
(
-
message
=>
"
missing account_profile option, aborting
\n
",
-
verbose
=>
0
...
...
@@ -87,8 +106,9 @@ if ($action eq 'add_test_account') {
printf
"
Account created:
\n\t
userid: user%d
\n\t
password: %s
\n
",
$test_account
->
id
(),
$test_account
->
user_password
();
}
elsif
(
$action
eq
'
list_test_accounts
')
{
}
sub
list_test_accounts
{
my
%args
;
if
(
$options
{'
sp_entityid
'})
{
push
@
{
$args
{'
query
'}
},
'
sp_entityid
'
=>
$options
{'
sp_entityid
'};
...
...
@@ -129,7 +149,9 @@ if ($action eq 'add_test_account') {
printf
"
Update simpleSamlPhp configuration file...
\n
";
}
}
elsif
(
$action
eq
'
parse_federation_metadata
')
{
}
sub
parse_federation_metadata
{
my
$federation_metadata
=
IdPAccountManager::
SAMLMetadata
->
new
();
die
"
unable to load federation metadata
\n
"
...
...
@@ -155,7 +177,9 @@ if ($action eq 'add_test_account') {
$federation_metadata
->
{'
federation_metadata_as_hashref
'},
0
,
\
*STDOUT
);
}
elsif
(
$action
eq
'
add_service_provider
')
{
}
sub
add_service_provider
{
pod2usage
(
-
message
=>
"
missing sp_entityid option, aborting
\n
",
...
...
@@ -197,8 +221,9 @@ if ($action eq 'add_test_account') {
printf
"
Service Provider created
\n
";
}
elsif
(
$action
eq
'
list_service_providers
')
{
}
sub
list_service_providers
{
my
%args
;
my
$providers
=
IdPAccountManager::Data::ServiceProvider::
Manager
->
get_serviceproviders
(
db
=>
$db
,
%args
);
...
...
@@ -211,7 +236,9 @@ if ($action eq 'add_test_account') {
$provider
->
print
();
}
}
elsif
(
$action
eq
'
list_authentication_tokens
')
{
}
sub
list_authentication_tokens
{
my
%args
;
if
(
$options
{'
sp_entityid
'})
{
...
...
@@ -244,7 +271,9 @@ if ($action eq 'add_test_account') {
}
}
elsif
(
$action
eq
'
get_authentication_token
')
{
}
sub
get_authentication_token
{
my
%args
;
if
(
$options
{'
token
'})
{
...
...
@@ -265,7 +294,9 @@ if ($action eq 'add_test_account') {
$authentication_token
->
print
();
}
elsif
(
$action
eq
'
add_authentication_token
')
{
}
sub
add_authentication_token
{
pod2usage
(
-
message
=>
"
missing email_address option, aborting
\n
",
...
...
@@ -305,7 +336,9 @@ if ($action eq 'add_test_account') {
$authentication_token
->
print
();
}
elsif
(
$action
eq
'
send_notice
')
{
}
sub
send_notice
{
pod2usage
(
-
message
=>
"
missing email_address option, aborting
\n
",
...
...
@@ -332,11 +365,6 @@ if ($action eq 'add_test_account') {
printf
"
Mail notice sent to
$options
{'email_address'}
\n
";
}
else
{
pod2usage
(
-
message
=>
"
invalid action '
$action
', aborting
\n
",
-
verbose
=>
0
);
}
__END__
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment