Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Maarch
digitalSafe
Commits
3a81a953
Commit
3a81a953
authored
Oct 16, 2020
by
Cyril Vazquez
Browse files
Merge branch 'fix/14879_hash_deposit_verification' into 'develop'
Fix/14879 hash deposit verification See merge request
!15
parents
c6534c86
52b07278
Changes
2
Hide whitespace changes
Inline
Side-by-side
bundle/digitalSafe/Controller/digitalSafe.php
View file @
3a81a953
...
...
@@ -87,29 +87,6 @@ class digitalSafe
$account
=
$this
->
accountController
->
get
(
$accountToken
->
accountId
);
$replyMessage
->
accountName
=
$account
->
accountName
;
foreach
(
$archive
->
digitalResources
as
$resource
)
{
if
((
isset
(
$resource
->
hash
)
&&
!
is_null
(
$resource
->
hash
))
&&
(
isset
(
$resource
->
hashAlgorithm
)
&&
!
is_null
(
$resource
->
hashAlgorithm
))
)
{
try
{
$this
->
checkHash
(
$resource
->
handler
,
$resource
->
hash
,
$resource
->
hashAlgorithm
);
}
catch
(
\
Exception
$e
)
{
throw
$this
->
getThrowable
(
$e
->
getMessage
(),
400
,
$replyMessage
);
}
$this
->
getHash
(
$resource
);
continue
;
}
if
(
!
isset
(
$resource
->
hash
)
&&
!
isset
(
$resource
->
hashAlgorithm
))
{
$this
->
getHash
(
$resource
);
continue
;
}
throw
$this
->
getThrowable
(
"Hash or hash algorithm missing"
,
401
,
$replyMessage
);
}
try
{
$archive
=
\
laabs
::
castMessage
(
$archive
,
'recordsManagement/archive'
);
$archiveId
=
$this
->
archiveController
->
receive
(
$archive
,
false
);
...
...
@@ -679,32 +656,6 @@ class digitalSafe
}
}
/**
* Calculate hash if necessary
*
* @param object $resource
*/
protected
function
getHash
(
$resource
)
{
$hashAlgorithm
=
\
laabs
::
configuration
(
'recordsManagement'
)[
'hashAlgorithm'
];
if
(
$resource
->
hashAlgorithm
==
$hashAlgorithm
)
{
return
;
}
$resource
->
hashAlgorithm
=
$hashAlgorithm
;
if
(
is_string
(
$resource
->
handler
))
{
$resource
->
hash
=
strtolower
(
hash
(
$hashAlgorithm
,
base64_decode
(
$resource
->
handler
)));
}
else
{
$tmpfile
=
\
laabs
::
getTmpDir
()
.
DIRECTORY_SEPARATOR
.
rand
();
file_put_contents
(
$tmpfile
,
base64_decode
(
stream_get_contents
(
$resource
->
handler
)));
rewind
(
$resource
->
handler
);
$resource
->
hash
=
strtolower
(
hash_file
(
$hashAlgorithm
,
$tmpfile
));
unlink
(
$tmpfile
);
}
}
/**
* log event in lifecycle journal
*
...
...
data/conf/configuration.ini.default
View file @
3a81a953
...
...
@@ -5,7 +5,7 @@
@include menu.ini
; Default max result in search screens
maxResults =
2
00
maxResults =
5
00
; Public archive mode
publicArchives = false
...
...
@@ -185,7 +185,7 @@ blacklistUserStories = "[
; 'lifeTime' Token validity in seconds (defaults 3600)
csrfWhiteList = "['user/login', 'user/password', 'user/prompt', 'user/logout']"
csrfConfig = '{
"cookieName" : "C
SRF
",
"cookieName" : "C
srf
",
"tokenLength" : 32
}'
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment