-
Notifications
You must be signed in to change notification settings - Fork 15
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
fix:enable only for specific groups #237
Conversation
Kudos, SonarCloud Quality Gate passed! |
There still is a combination which could be confusing and specifically:
You - as admin- basically end up in this configuration when first selecting In this configuration I would expect subadmins of Maybe this is expected as the two options should be considered as mutually exclusive? |
I think we have to test also with #236. For now, let's merge both patches and retest that scenario. |
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 that section is part of the validation, and the return value should be below
The touched section seems to be part of the validation process in case the app is enabled for specific groups. Computation to decide whether impersonation should happen is below. Admins should be able to impersonate always, regardless of the "app enabled groups" setting. impersonate/controller/settingscontroller.php Lines 248 to 250 in 5642c9e
Maybe something like below (needs refinement):
That should cover the server-side validation, but we might still need changes in order to show the impersonation icon or not. |
But is this not what https://github.com/owncloud/impersonate/blob/master/controller/settingscontroller.php#L206-L238 exactly does? If Also, I guess having:
outside of https://github.com/owncloud/impersonate/blob/master/controller/settingscontroller.php#L206-L238 would not work as there we are already outside the condition "enable app for certain groups" so i.e. |
To be more clear, currently
So to my eyes we are currently missing the call for when only the "Enable only for specific groups" app option is set. |
The question is, what does having the "Enable only for specific groups" option imply? What isn't clear is whether the "target must also be a member of any of those groups" condition makes sense or not. To clarify a bit, based on the example provided (#237 (comment)), the impersonator must be member of the "test group" and subadmin of "test group 2", and the target user must be member of both "test group" and "test group 2". |
I would probably not consider that case as having both options enabled does not make sense to me.
Not sure this is still true but https://github.com/owncloud/impersonate/blob/master/controller/settingscontroller.php#L221-L222 seems to indicate this is needed. |
I guess we need the javascript piece to show the "logged in as" warning message on the top of the screen. The js code might not load if the app isn't enabled for the target user, that would explain why it's needed. I'd vote for a "won't fix" and / or ensuring that the "Enable only for specific groups" option can't be used for the app. |
Yes, I agree. So close this and remove the "Enable only for specific groups" option in a separate PR? |
Fixes: https://github.com/owncloud/enterprise/issues/6277
When only selecting the app option
Enable only for specific groups
, impersonation fails with anCan not impersonate
error. Currently, the logic to impersonate the user is missing when only this app option is set. This PR just adds a call to theimpersonateUser()
method once all conditions are verified.