-
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
Add occ commands to enable and disable a user + a disabled user can n… #23844
Conversation
By analyzing the blame information on this pull request, we identified @icewind1991, @butonic and @xoen to be potential reviewers |
* @param bool $value | ||
* @return OC_OCS_Result | ||
*/ | ||
private function setEnabled($parameters, $value) { |
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'd like some integration tests on this covering the following scenarios:
- Subadmin should be able to enable or disable an user in their group
- Subadmins should NOT be able to enable or disable an user not in their group
- Subadmins should not be able to disable users that have admin permissions even if they are in their group
- Admins can enable and disable any user
- Regular users will get an exception
- It should not be possible to disable or enable ones own account, neither as admin nor as subadmin
cc @owncloud/qa
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.
\3. is not covered by the code?
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.
It is. Check L370
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. Bloody GitHub, if I click on edit it shows "3." instead of "1."
Yes. 3, is not covered yet.
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.
@SergioBertolinSG do we have this covered now ?
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 it works fine.
Additional integration tests to be implemented:
|
I did not check yet. But does this somehow yield the users shares invalid? |
Edit: Ah… Right… The migration scenario, my bad :) |
@@ -229,7 +235,7 @@ public function login($uid, $password) { | |||
throw new LoginException('Login canceled by app'); | |||
} | |||
} else { | |||
return false; | |||
throw new LoginException('User disabled'); |
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.
Where do we localize the string so the user can be shown a proper message when he tries to login?
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 be done here - thanks for the pointer
0235486
to
e9d6087
Compare
@@ -241,3 +241,10 @@ Feature: webdav-related | |||
| 0 | | |||
| 1 | | |||
| 3 | | |||
|
|||
Scenario: A disabled user cannot use webdav |
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 seems to fail 🙈
9124c18
to
2a94fd2
Compare
😠
|
@nickvergessen @LukasReschke @MorrisJobke any idea why in this pr the composer generated file is causing trouble? |
issues seem to be related to php 5.4 and 5.5 |
same fun in #23708 - master broken? |
Mhm. We don't ship any /lib/composer/composer/autoload_static.php, seems like composer on Travis generates this automatically… Let's see why it does that 😉 |
Mhm…
Caused by composer/composer@fd2f51cea8e5f1ef978cd8f90b87b69dc1778976… Let me see what one can do about that … |
Ok. autoload_static.php is only loaded when PHP >= 5.6 is used. #23935 adjusts the linter accordingly. |
2a94fd2
to
a5d71fa
Compare
@MorrisJobke @LukasReschke @rullzer please review and test once more - basic integration test added - needs further work @SergioBertolinSG THX |
@@ -59,7 +59,7 @@ protected function tearDown() { | |||
} | |||
|
|||
protected function setup() { |
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.
camelCase missing as well
Btw in terms of tracking, would be nice to have a hook for the admin_audit app |
agreed - please open a ticket in core and enterprise so that we can consume it. THX |
2247d33
to
29c3fd1
Compare
Integration tests failing:
(log is too big) |
Oh shit ... I guess I fucked up the rebase ..... |
8514ac9
to
68cb185
Compare
…o longer login - fixes #23838
Catching the login exception and returning false (login failed). Makes the OCS API properly return data instead of printing the exception page.
68cb185
to
661ab1a
Compare
So much bad luck. Now that I was determined to review and test this, LDAP login is broken on this branch and master also... #24409 |
|
@LukasReschke mind taking a look? THX |
@@ -41,6 +44,8 @@ | |||
API::register('get', '/cloud/users/{userid}', [$users, 'getUser'], 'provisioning_api', API::USER_AUTH); | |||
API::register('put', '/cloud/users/{userid}', [$users, 'editUser'], 'provisioning_api', API::USER_AUTH); | |||
API::register('delete', '/cloud/users/{userid}', [$users, 'deleteUser'], 'provisioning_api', API::SUBADMIN_AUTH); | |||
API::register('put', '/cloud/users/{userid}/enable', [$users, 'enableUser'], 'provisioning_api', API::SUBADMIN_AUTH); | |||
API::register('put', '/cloud/users/{userid}/disable', [$users, 'disableUser'], 'provisioning_api', API::SUBADMIN_AUTH); |
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 general to be more RESTful another idea would be to still do a "PUT" on "/cloud/users/{userid}" and set the "enabled" attribute to true or false. (PUT being an "edit" operation)
This also means that the GET operation would return the "enabled" flag as well with the user's properties.
I'm ok with keeping in that way if that's too much to rework.
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 see that GET already returns the flag. So intuitively as an API consumer, I'd be tempted to try and set it the way I described.
However now I see that it says "displayName" in the response but the PUT value is "display" 😞
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.
Well - true restful would be to have only one GET to retrieve a json object holding all information and one PUT where we can push a full json object to store the new state.
But the whole provisioning api is not REST - so nothing to worry about - in the scope for v1.
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.
🙈 agreed
Looks good from my POV 👍 @DeepDiver1975 did you test this with shib ? |
no - I have currently no working shib test environment at hand - I suggest to merge and test this by QA |
Testing with Shib and Autoprovisioning: Disabling/Enabling a user seems to work fine. But when disabling a shibboleth user and trying to log in with him, the following page is shown. Not sure if it is intended or not: No logs are written in owncloud.log Tested using Testshib and autoprovisioning mode Steps tested:
|
I guess there is not much more we can do from a core pov. I guess we need to capture this situation and display a page like: you are disabled. This has to be done in the shibboleth app |
"you are disabled" sounds a bit funny 😄 |
👍 in that case |
@davitol please open an issue in the shibboleth repo - THX |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
…o longer login - fixes #23838
@rullzer @LukasReschke @MorrisJobke