Skip to content

Conversation

@CarlSchwan
Copy link
Member

@CarlSchwan CarlSchwan commented Jul 27, 2021

fix #11687

Current status

  • settings can be marked as "allow-delegation" in the app info.xml file

  • Once marked as allow-delegation they are available in a new setting category in the admin category. In it an admin can select some groups and give them access to the specified setting

  • Once a normal user get access, they can see the new setting in their setting navigation bar and access it

  • Controller using the new annotation in their action @AuthorizedAdminSetting(OCA/<app>/Settings/AdminSettings.php) can be used by the user (who has the authorization for the admin)

  • sorting of settings in UI

  • English name Admin Right Permissions/Admin Right Priviledges/Access Control?

Copy link
Member

@juliusknorr juliusknorr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just skimmed it quickly, seems good from the general approach

@juliusknorr
Copy link
Member

When the app is disabled, the authorization should disappears too, not so sure how I want to do that yet unfortunately

Any specific reason you went for a app that just exposes the delegation settings? I think that could probably also just be part of settings and we can have a configuration option then to turn it off.

@CarlSchwan
Copy link
Member Author

So my next big problem to solve is how to handle the setAppValue and the http://localhost/ocs/v2.php/apps/provisioning_api/api/v1/config/apps/core/<key> API. Currently the bigger problem is that an appvalue is not mapped to any setting, so if a user has authorization for a setting page, we can't know which appValue they are authorized to edit.

I believe adding a simple mapping ['key1" => AdminSetting::class, "key2" => ShareAdminSetting::class] somewhere and use that to check if the user has could work but that sounds like a big change, unfortunately. Does anyone have a better idea? :)

@CarlSchwan CarlSchwan changed the title WIP: Implement Admin Delegation Implement Admin Delegation Aug 2, 2021
@CarlSchwan CarlSchwan added the 3. to review Waiting for reviews label Aug 2, 2021
@PVince81
Copy link
Member

PVince81 commented Aug 2, 2021

when setting up from scratch I get this on the CLI:

PHP Fatal error:  Cannot declare class OCA\AdminRightSubgranting\Migration\Version23000Date20210721100600, because the name is already in use in /srv/www/htdocs/server/core/Migrations/Version23000Date20210721100600.php on line 32

@PVince81
Copy link
Member

PVince81 commented Aug 2, 2021

@CarlSchwan do I understand correctly that this allows only a whole page of settings or a section, not specific setting strings ?

@juliusknorr
Copy link
Member

So my next big problem to solve is how to handle the setAppValue and the http://localhost/ocs/v2.php/apps/provisioning_api/api/v1/config/apps/core/<key> API. Currently the bigger problem is that an appvalue is not mapped to any setting, so if a user has authorization for a setting page, we can't know which appValue they are authorized to edit.

I believe adding a simple mapping ['key1" => AdminSetting::class, "key2" => ShareAdminSetting::class] somewhere and use that to check if the user has could work but that sounds like a big change, unfortunately. Does anyone have a better idea? :)

I don't have a good idea right away, but that is somewhat related to the idea from #18465 where with a declarative definition of app config values we could indicate delegation of certain config keys. So maybe some kind of mapping could be an intermediate step to allow delegation of settings for now where it is required.

@skjnldsv skjnldsv added this to the Nextcloud 23 milestone Aug 3, 2021
@CarlSchwan
Copy link
Member Author

@CarlSchwan do I understand correctly that this allows only a whole page of settings or a section, not specific setting strings ?

@PVince81 Yes it allows a while page of settings and will display a section if at least one of the setting inside of it is authorized. For the specific setting strings, it's needed for the ISettings class to declare which setting string they can edit so that it's possible to modify these settings.

I don't have a good idea right away, but that is somewhat related to the idea from #18465 where with a declarative definition of app config values we could indicate delegation of certain config keys. So maybe some kind of mapping could be an intermediate step to allow delegation of settings for now where it is required.

@juliushaertl The linked issue looks interesting. If we decide that this is something we want, it would probably be better to do it before finishing this feature otherwise we will have two mappings :(

@CarlSchwan CarlSchwan force-pushed the work/carl/admin-delegation branch 2 times, most recently from d28edda to 72cd7b8 Compare August 9, 2021 09:50
@CarlSchwan CarlSchwan force-pushed the work/carl/admin-delegation branch from 72cd7b8 to b8b8a42 Compare August 20, 2021 11:22
@skjnldsv skjnldsv requested a review from a team August 23, 2021 07:45
@skjnldsv
Copy link
Member

Added a few comments that are no blockers imho.
Let's fix the CI first.

@skjnldsv skjnldsv removed the 3. to review Waiting for reviews label Aug 23, 2021
@CarlSchwan CarlSchwan force-pushed the work/carl/admin-delegation branch from 8109199 to 4961d27 Compare September 28, 2021 12:16
@CarlSchwan
Copy link
Member Author

/compile amend /

@nextcloud-command nextcloud-command force-pushed the work/carl/admin-delegation branch from 4961d27 to 8232b95 Compare September 29, 2021 09:09
@CarlSchwan CarlSchwan force-pushed the work/carl/admin-delegation branch from 0f24778 to d6a1df2 Compare September 29, 2021 10:52
Copy link
Member

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 code looks good

@CarlSchwan CarlSchwan force-pushed the work/carl/admin-delegation branch 4 times, most recently from d081de4 to 712f3da Compare September 29, 2021 19:32
This makes it possible for selected groups to access some settings
pages.

Signed-off-by: Carl Schwan <[email protected]>
@CarlSchwan CarlSchwan force-pushed the work/carl/admin-delegation branch from 712f3da to 6958d80 Compare September 29, 2021 19:43
@CarlSchwan CarlSchwan merged commit 04f1882 into master Sep 29, 2021
@CarlSchwan CarlSchwan deleted the work/carl/admin-delegation branch September 29, 2021 20:48
@ChristophWurst ChristophWurst added the pending documentation This pull request needs an associated documentation update label Sep 30, 2021
@skjnldsv skjnldsv added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Oct 6, 2021
@ChristophWurst ChristophWurst removed the pending documentation This pull request needs an associated documentation update label Dec 7, 2021
@danxuliu
Copy link
Member

@CarlSchwan There is a change that was going to be reverted, but in the end it was not:
https://github.com/nextcloud/server/pull/28189/files#diff-50b846648bbc8a7ca74bae8cf096ee0297423bc236f56ba05c5f8a727519f615L109-R130
Was that just an oversight or is there a reason?

Due to that change if an app specifies a class that does not exist in the <admin-section> field of info.xml the settings will not load. Of course in that case the app should be fixed :-) but until that happens it would be better if the rest of the settings still work and the error is simply logged.

CarlSchwan added a commit that referenced this pull request May 30, 2022
@CarlSchwan
Copy link
Member Author

@CarlSchwan There is a change that was going to be reverted, but in the end it was not: https://github.com/nextcloud/server/pull/28189/files#diff-50b846648bbc8a7ca74bae8cf096ee0297423bc236f56ba05c5f8a727519f615L109-R130 Was that just an oversight or is there a reason?

Due to that change if an app specifies a class that does not exist in the <admin-section> field of info.xml the settings will not load. Of course in that case the app should be fixed :-) but until that happens it would be better if the rest of the settings still work and the error is simply logged.

totally an oversight, I created #32655

CarlSchwan added a commit that referenced this pull request May 30, 2022
@danxuliu
Copy link
Member

@CarlSchwan There is a change that was going to be reverted, but in the end it was not: https://github.com/nextcloud/server/pull/28189/files#diff-50b846648bbc8a7ca74bae8cf096ee0297423bc236f56ba05c5f8a727519f615L109-R130 Was that just an oversight or is there a reason?
Due to that change if an app specifies a class that does not exist in the <admin-section> field of info.xml the settings will not load. Of course in that case the app should be fixed :-) but until that happens it would be better if the rest of the settings still work and the error is simply logged.

totally an oversight, I created #32655

Perfect, thanks!

backportbot-nextcloud bot pushed a commit that referenced this pull request May 30, 2022
backportbot-nextcloud bot pushed a commit that referenced this pull request May 30, 2022
Jerome-Herbinet pushed a commit to Jerome-Herbinet/server that referenced this pull request Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: granular permissions for users

10 participants