-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Move user creation to a separate service #36145
Conversation
This PR is marked as deffered. The changes are same as #35972. |
f90ab66
to
0e8df13
Compare
Codecov Report
@@ Coverage Diff @@
## master #36145 +/- ##
============================================
+ Coverage 64.68% 64.77% +0.08%
- Complexity 19118 19175 +57
============================================
Files 1269 1281 +12
Lines 74775 75039 +264
Branches 1320 1320
============================================
+ Hits 48369 48603 +234
- Misses 26018 26048 +30
Partials 388 388
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
0e8df13
to
90f8a45
Compare
51bbc2b
to
7e0ff42
Compare
With
@phil-davis @sharidas is there anything that I miss related to #36019 and #36020? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. There are acceptance tests in cliProvisioning suite for the occ
user
and group
commands. They check the success and the command output text... Those are still passing, so the occ
command interface has not been affected.
If (2) then we should add some acceptance tests to cover the new/improved behavior. |
010fbef
to
7ce0a19
Compare
@phil-davis I just worked on #36019 and #36020. In addition, rebased the PR and made it compatible with the new PHPUnit version. @sharidas has more knowledge than me about the rest of the things. |
@phil-davis The change which @karakayasemi had made is with respect to the wording issues that was caused because of the commit 128b83a. Basically now with this change, the UI and cli (including the provisioning api) would be aligned with user creation. |
unit tests fail with
needs some more refactoring... |
7ce0a19
to
78c508d
Compare
78c508d
to
0441002
Compare
0441002
to
5cc92c9
Compare
988427d
to
19c6610
Compare
6e73274
to
37b3e3a
Compare
97eeafc
to
0c923fa
Compare
@jvillafanez I made some changes for aligning the code to your previous review. Also, I found some problems with translations and resolved them. |
core/Controller/LostController.php
Outdated
@@ -252,8 +250,7 @@ public function setPassword($token, $userId, $password, $proceed) { | |||
throw new \Exception(); | |||
} | |||
|
|||
\OC_Hook::emit('\OC\Core\LostPassword\Controller\LostController', 'post_passwordReset', ['uid' => $userId, 'password' => $password]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think this way is better, explained here: #36145 (comment) . I would like to learn your opinion also.
core/Controller/LostController.php
Outdated
@@ -252,8 +250,7 @@ public function setPassword($token, $userId, $password, $proceed) { | |||
throw new \Exception(); | |||
} | |||
|
|||
\OC_Hook::emit('\OC\Core\LostPassword\Controller\LostController', 'post_passwordReset', ['uid' => $userId, 'password' => $password]); | |||
@\OC_User::unsetMagicInCookie(); | |||
$this->userSession->unsetMagicInCookie(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick question: has this been verified that there is no error showing anywhere? Since this touches cookies, I think there could be errors / warnings if any output has been sent to the client prior this point. I don't think this is the case, but maybe we should confirm this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explained in more detail in here: #36145 (comment)
No error log appears in manual tests with the described scenarios in there: #35972 (comment)
throw new UserAlreadyExistsException('A user with that name already exists.'); | ||
} | ||
|
||
if (\array_key_exists('password', $arguments)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory, you could use $arguments['password'] = null
and you'll be trying to set $password
as null. I don't really know if this is handled properly.
If this is consider, we should include some information in the PHPDoc (and probably around here) explaining setting null as password (and / or email) is acceptable, and what are the consequences. Otherwise, I think it's better to use isset
'url' => $this->urlGenerator->linkToRouteAbsolute('core.user.setPasswordForm', ['userId' => $userId, 'token' => $token]) | ||
]; | ||
|
||
$mail = new TemplateResponse('core', 'new_user/email-html', $mailData, 'blank'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's more common to use Template
than TemplateResponse
. Any reason to use TemplateResponse
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the reason I recall for the usage of TemplateResponse
is to pass the value in $mailData
.
} catch (\Exception $exception) { | ||
throw new EmailSendFailedException($this->l10n->t("Email could not be sent.")); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any action to take if no email is set? should we log something?
Maybe we could add a comment if we don't want to take any action to remark doing nothing is intentional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment.
0c923fa
to
99aff11
Compare
99aff11
to
81f561d
Compare
Move user creation to a separate service. Signed-off-by: Sujith H <[email protected]>
81f561d
to
2997476
Compare
2997476
to
b32c813
Compare
b32c813
to
76c356c
Compare
old aka dead -> close |
Move user creation to a separate service.
Signed-off-by: Sujith H [email protected]
Description
Move the user creation to the service class.
Related Issue
Motivation and Context
Add the create user to a service class. It is moved from user_management apps UsersController. This will help us in integrating the change with the user:add command support creating users with username and email address. It will also help for provisioning API.
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist:
Open tasks: