-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Opt-in for generation userid, requiring email addresses #15964
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
Conversation
3ce09b5 to
ea40345
Compare
| $isAdmin = $this->groupManager->isAdmin($user->getUID()); | ||
| $subAdminManager = $this->groupManager->getSubAdmin(); | ||
|
|
||
| if(empty($userid) && (bool)$this->config->getAppValue('settings', 'newUser.generateUserID', false)) { |
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.
Casting? Shouldn't we rather check against the exact value? '1'?
Or is it not a bad practice :)
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.
Eh … yeah, whyever I was doing it this way. I guess I was carried away by my urge to have boolean meaning be treated boolean. Even the cast useless here. I'll change it :)
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.
@blizzz well, you're the php expert here ;)
So if you say it's fine, it's fine for me! 🚀
skjnldsv
left a comment
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.
Code and tests are good. A small nitpick that is maybe not an issue! :)
5c7163a to
a0695ed
Compare
|
May I have a second reviewer, please? |
skjnldsv
left a comment
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.
Do I count? 😄
|
@juliushaertl @georgehrke @schiessle @vincchan |
|
Meh, conflicts … who dared to merge other stuff first 😝 OK, gonna rebase.
If this is one of your other personalities speaking, then, I think, yes, why not? 🙃 🤡 |
Signed-off-by: Arthur Schiwon <[email protected]>
Signed-off-by: Arthur Schiwon <[email protected]>
Signed-off-by: Arthur Schiwon <[email protected]>
a0695ed to
faeb4a6
Compare
Signed-off-by: Arthur Schiwon <[email protected]>
faeb4a6 to
05b3288
Compare
georgehrke
left a comment
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.
Tiny nitpick, otherwise good to go 👍
| $isAdmin = $this->groupManager->isAdmin($user->getUID()); | ||
| $subAdminManager = $this->groupManager->getSubAdmin(); | ||
|
|
||
| if(empty($userid) && $this->config->getAppValue('settings', 'newUser.generateUserID', '0') === '1') { |
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.
Nitpick: we usually use 'yes' and 'no' (see the enabled configkey for example)
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.
we also don't use getAppValue('settings' anywhere, it's usually getAppValue('core'
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.
Indeed! Ok, will adjust, thank you!
| $generatePasswordResetToken = true; | ||
| } | ||
|
|
||
| if ($email === '' && $this->config->getAppValue('settings', 'newUser.requireEmail', '0') === '1') { |
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.
see above
Signed-off-by: Arthur Schiwon <[email protected]>
762876b to
29449f8
Compare
| } | ||
|
|
||
| return new DataResponse(); | ||
| return new DataResponse(['UserID' => $userid]); |
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.
should we use id, so the key is the same as from getUserData?
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.
AH yes maybe we should!
@blizzz ?
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.
makes sense
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 PR adds following two switches for creating new users:
The motivation is to allow untechnical (sub)admins to allow to create users on an external backend. The user id does not play a role, but the email has to be enforced.
Therefore, there are no graphical switches. Bu the flags can be set via occ and they also do work with the local backend. For testing:
This flag sets the email field to required when creating a new user. The provsioning API errors with 110 if it is not provided.
This disables the new username field on the users page. The user will be appended to the list after creation with a random 10-character long ascii string. In case an unexisting userid could not be generated, the provisioning API will error with 111 after 10 attempts.