Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
die_coolen_jungs
our_own_cloud_project
Commits
b2d021b2
Commit
b2d021b2
authored
11 years ago
by
Florin Peter
Browse files
Options
Downloads
Patches
Plain Diff
added post_createUser hook
parent
61ed347d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/files_encryption/hooks/hooks.php
+18
-12
18 additions, 12 deletions
apps/files_encryption/hooks/hooks.php
apps/files_encryption/lib/helper.php
+20
-0
20 additions, 0 deletions
apps/files_encryption/lib/helper.php
with
38 additions
and
12 deletions
apps/files_encryption/hooks/hooks.php
+
18
−
12
View file @
b2d021b2
...
@@ -47,17 +47,11 @@ class Hooks {
...
@@ -47,17 +47,11 @@ class Hooks {
$view
=
new
\OC_FilesystemView
(
'/'
);
$view
=
new
\OC_FilesystemView
(
'/'
);
$util
=
new
Util
(
$view
,
$params
[
'uid'
]
);
$util
=
new
Util
(
$view
,
$params
[
'uid'
]
);
// Check files_encryption infrastructure is ready for action
if
(
!
$util
->
ready
()
)
{
\OC_Log
::
write
(
'Encryption library'
,
'User account "'
.
$params
[
'uid'
]
.
'" is not ready for encryption; configuration started'
,
\OC_Log
::
DEBUG
);
if
(
!
$util
->
setupServerSide
(
$params
[
'password'
]
))
{
return
false
;
}
}
// setup user, if user not ready force relogin
if
(
Helper
::
setupUser
(
$util
,
$params
[
'password'
])
===
false
)
{
return
false
;
}
\OC_FileProxy
::
$enabled
=
false
;
\OC_FileProxy
::
$enabled
=
false
;
...
@@ -120,8 +114,20 @@ class Hooks {
...
@@ -120,8 +114,20 @@ class Hooks {
return
true
;
return
true
;
}
}
/**
/**
* @brief setup encryption backend upon user created
* @note This method should never be called for users using client side encryption
*/
public
static
function
postCreateUser
(
$params
)
{
$view
=
new
\OC_FilesystemView
(
'/'
);
$util
=
new
Util
(
$view
,
$params
[
'uid'
]
);
Helper
::
setupUser
(
$util
,
$params
[
'password'
]);
}
/**
* @brief Change a user's encryption passphrase
* @brief Change a user's encryption passphrase
* @param array $params keys: uid, password
* @param array $params keys: uid, password
*/
*/
...
...
This diff is collapsed.
Click to expand it.
apps/files_encryption/lib/helper.php
+
20
−
0
View file @
b2d021b2
...
@@ -48,6 +48,7 @@ class Helper {
...
@@ -48,6 +48,7 @@ class Helper {
\OCP\Util
::
connectHook
(
'OC_User'
,
'post_login'
,
'OCA\Encryption\Hooks'
,
'login'
);
\OCP\Util
::
connectHook
(
'OC_User'
,
'post_login'
,
'OCA\Encryption\Hooks'
,
'login'
);
\OCP\Util
::
connectHook
(
'OC_User'
,
'pre_setPassword'
,
'OCA\Encryption\Hooks'
,
'setPassphrase'
);
\OCP\Util
::
connectHook
(
'OC_User'
,
'pre_setPassword'
,
'OCA\Encryption\Hooks'
,
'setPassphrase'
);
\OCP\Util
::
connectHook
(
'OC_User'
,
'post_createUser'
,
'OCA\Encryption\Hooks'
,
'postCreateUser'
);
}
}
/**
/**
...
@@ -68,5 +69,24 @@ class Helper {
...
@@ -68,5 +69,24 @@ class Helper {
\OCP\Util
::
connectHook
(
'OC_Filesystem'
,
'post_rename'
,
'OCA\Encryption\Hooks'
,
'postRename'
);
\OCP\Util
::
connectHook
(
'OC_Filesystem'
,
'post_rename'
,
'OCA\Encryption\Hooks'
,
'postRename'
);
}
}
/**
* @brief setup user for files_encryption
*
* @param Util $util
* @param string $password
* @return bool
*/
public
static
function
setupUser
(
$util
,
$password
)
{
// Check files_encryption infrastructure is ready for action
if
(
!
$util
->
ready
()
)
{
\OC_Log
::
write
(
'Encryption library'
,
'User account "'
.
$util
->
getUserId
()
.
'" is not ready for encryption; configuration started'
,
\OC_Log
::
DEBUG
);
if
(
!
$util
->
setupServerSide
(
$password
))
{
return
false
;
}
}
return
true
;
}
}
}
\ No newline at end of file
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