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
90bfeea0
Commit
90bfeea0
authored
7 years ago
by
Guillaume ROUSSE
Browse files
Options
Downloads
Patches
Plain Diff
let Rose::DB::Object handle dates
parent
ce46c02d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
conf/create-manager-db.sql
+3
-3
3 additions, 3 deletions
conf/create-manager-db.sql
lib/IdPAccountManager/AuthenticationToken.pm
+4
-4
4 additions, 4 deletions
lib/IdPAccountManager/AuthenticationToken.pm
lib/IdPAccountManager/TestAccount.pm
+8
-7
8 additions, 7 deletions
lib/IdPAccountManager/TestAccount.pm
with
15 additions
and
14 deletions
conf/create-manager-db.sql
+
3
−
3
View file @
90bfeea0
...
...
@@ -11,7 +11,7 @@ CREATE TABLE `authenticationtokens` (
`token`
varchar
(
50
)
NOT
NULL
,
`email_address`
varchar
(
200
)
NOT
NULL
,
`sp_entityid`
varchar
(
200
)
NOT
NULL
,
`creation_date`
int
(
11
)
DEFAULT
NULL
,
`creation_date`
date
DEFAULT
NULL
,
PRIMARY
KEY
(
`id`
),
UNIQUE
KEY
`token_2`
(
`token`
),
KEY
`token`
(
`token`
),
...
...
@@ -30,8 +30,8 @@ CREATE TABLE `serviceproviders` (
CREATE
TABLE
`testaccounts`
(
`id`
bigint
(
20
)
NOT
NULL
AUTO_INCREMENT
,
`password_hash`
varchar
(
50
)
NOT
NULL
,
`creation_date`
int
(
11
)
DEFAULT
NULL
,
`expiration_date`
int
(
11
)
DEFAULT
NULL
,
`creation_date`
date
DEFAULT
NULL
,
`expiration_date`
date
DEFAULT
NULL
,
`profile`
varchar
(
100
)
NOT
NULL
,
`scope`
varchar
(
100
)
NOT
NULL
,
`sp_entityid`
varchar
(
250
)
NOT
NULL
,
...
...
This diff is collapsed.
Click to expand it.
lib/IdPAccountManager/AuthenticationToken.pm
+
4
−
4
View file @
90bfeea0
...
...
@@ -6,7 +6,7 @@ use warnings;
use
base
'
IdPAccountManager::DB::Object
';
use
Digest::
MD5
;
use
POSIX
qw(strft
ime
)
;
use
DateT
ime
;
__PACKAGE__
->
meta
->
setup
(
table
=>
'
authenticationtokens
',
...
...
@@ -16,7 +16,7 @@ __PACKAGE__->meta->setup(
token
=>
{
type
=>
'
varchar
',
length
=>
50
,
not_null
=>
1
},
email_address
=>
{
type
=>
'
varchar
',
length
=>
200
,
not_null
=>
1
},
sp_entityid
=>
{
type
=>
'
varchar
',
length
=>
200
,
not_null
=>
1
},
creation_date
=>
{
type
=>
'
integer
'
},
creation_date
=>
{
type
=>
'
date
'
},
],
primary_key_columns
=>
[
'
id
'
],
...
...
@@ -35,7 +35,7 @@ sub print {
"
AuthenticationToken ID=%s; token=%s; email_address=%s; sp_entityid=%s; creation_date=%s
\n
",
$self
->
id
(),
$self
->
token
(),
$self
->
email_address
(),
$self
->
sp_entityid
(),
POSIX::
strftime
('
%Y:%m:%d
',
localtime
(
$self
->
creation_date
()
)
);
$self
->
creation_date
()
->
strftime
('
%Y:%m:%d
'
);
}
sub
save
{
...
...
@@ -43,7 +43,7 @@ sub save {
# If no ID is defined, it is a new account
if
(
!
defined
$self
->
id
())
{
$self
->
creation_date
(
time
);
$self
->
creation_date
(
DateTime
->
today
()
);
$self
->
token
(
_generate_token
(
$self
->
email_address
()));
}
...
...
This diff is collapsed.
Click to expand it.
lib/IdPAccountManager/TestAccount.pm
+
8
−
7
View file @
90bfeea0
...
...
@@ -5,7 +5,7 @@ use warnings;
use
base
'
IdPAccountManager::DB::Object
';
use
POSIX
qw(strft
ime
)
;
use
DateT
ime
;
__PACKAGE__
->
meta
->
setup
(
table
=>
'
testaccounts
',
...
...
@@ -13,8 +13,8 @@ __PACKAGE__->meta->setup(
columns
=>
[
id
=>
{
type
=>
'
bigserial
',
not_null
=>
1
},
password_hash
=>
{
type
=>
'
varchar
',
length
=>
50
,
not_null
=>
1
},
creation_date
=>
{
type
=>
'
integer
'
},
expiration_date
=>
{
type
=>
'
integer
'
},
creation_date
=>
{
type
=>
'
date
'
},
expiration_date
=>
{
type
=>
'
date
'
},
profile
=>
{
type
=>
'
varchar
',
length
=>
100
,
not_null
=>
1
},
scope
=>
{
type
=>
'
varchar
',
length
=>
100
,
not_null
=>
1
},
sp_entityid
=>
{
type
=>
'
varchar
',
length
=>
250
,
not_null
=>
1
},
...
...
@@ -121,8 +121,8 @@ sub print {
$self
->
sp_entityid
(),
$self
->
profile
(),
$self
->
scope
(),
POSIX::
strftime
('
%Y:%m:%d
',
localtime
(
$self
->
creation_date
()
)
),
POSIX::
strftime
('
%Y:%m:%d
',
localtime
(
$self
->
expiration_date
()
)
);
$self
->
creation_date
()
->
strftime
('
%Y:%m:%d
'
),
$self
->
expiration_date
()
->
strftime
('
%Y:%m:%d
'
);
}
sub
password
{
...
...
@@ -140,9 +140,10 @@ sub save {
IdPAccountManager::Tools::
generate_password
();
$self
->
password_hash
(
IdPAccountManager::Tools::
sha256_hash
(
$self
->
{
password
}));
$self
->
creation_date
(
time
);
$self
->
creation_date
(
DateTime
->
today
()
);
$self
->
expiration_date
(
time
+
(
$args
{
accounts_validity_period
}
*
3600
*
24
));
DateTime
->
today
()
->
add
(
days
=>
$args
{
accounts_validity_period
})
);
}
$self
->
SUPER::
save
();
...
...
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