Skip to content
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

Allow disable part user settings #20549

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

lunny
Copy link
Member

@lunny lunny commented Jul 30, 2022

This PR split user settings as passwod, deletion, security, applications, gpg keys, organiztions modules. And there is a global configuration to allow/disallow users to visit the modules from UI or requests.

@lunny lunny added type/enhancement An improvement of existing functionality backport/v1.17 labels Jul 30, 2022
@lunny lunny mentioned this pull request Jul 30, 2022
routers/web/web.go Outdated Show resolved Hide resolved
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 30, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #20549 (30db40f) into main (e819da0) will decrease coverage by 0.09%.
The diff coverage is 20.93%.

❗ Current head 30db40f differs from pull request most recent head 5e8875a. Consider uploading reports for the commit 5e8875a to get more accurate results

@@            Coverage Diff             @@
##             main   #20549      +/-   ##
==========================================
- Coverage   46.94%   46.85%   -0.10%     
==========================================
  Files         978      980       +2     
  Lines      135489   135838     +349     
==========================================
+ Hits        63600    63641      +41     
- Misses      64082    64389     +307     
- Partials     7807     7808       +1     
Impacted Files Coverage Δ
modules/convert/mirror.go 0.00% <0.00%> (ø)
routers/api/v1/repo/mirror.go 9.40% <0.00%> (-62.03%) ⬇️
routers/web/user/setting/keys.go 16.80% <0.00%> (-0.56%) ⬇️
services/mirror/mirror.go 11.95% <0.00%> (ø)
modules/setting/database.go 51.90% <25.00%> (-1.32%) ⬇️
modules/setting/user.go 36.36% <36.36%> (ø)
routers/web/repo/setting.go 16.92% <44.44%> (ø)
routers/web/repo/view.go 40.78% <46.15%> (-0.63%) ⬇️
services/mirror/mirror_push.go 44.69% <50.00%> (ø)
models/repo/pushmirror.go 74.28% <71.79%> (-3.72%) ⬇️
... and 17 more

Help us with your feedback. Take ten seconds to tell us how you rate us.

Copy link
Member

@jolheiser jolheiser left a comment

Choose a reason for hiding this comment

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

typo nits

docs/content/doc/advanced/config-cheat-sheet.en-us.md Outdated Show resolved Hide resolved
custom/conf/app.example.ini Outdated Show resolved Hide resolved
@lunny
Copy link
Member Author

lunny commented Aug 1, 2022

@noerw @jolheiser done.

@lunny lunny modified the milestones: 1.17.1, 1.18.0 Aug 4, 2022
@garymoon
Copy link
Contributor

We have just run into a use-case for something similar, but specifically for preventing OAuth'd users from modifying aspects of their profile that are controlled by the provider (password, email address etc). Would an adjustment to this whereby modules could be enabled/disabled depending on the auth type be welcome?

@lunny lunny force-pushed the lunny/disable_user_setting_via_modules branch from 3b00cd1 to 6810325 Compare December 11, 2022 12:57
modules/setting/user.go Outdated Show resolved Hide resolved
@lunny lunny removed this from the 1.19.0 milestone Feb 1, 2023
@lunny lunny added this to the 1.20.0 milestone Feb 1, 2023
@techknowlogick
Copy link
Member

@lunny please resolve conflicts

@silverwind
Copy link
Member

More conflicts appeared.

@kdumontnu kdumontnu mentioned this pull request Mar 29, 2023
6 tasks
@@ -1386,6 +1386,16 @@ steps:

although Github don't support this form.

## User (`user`)

- `USER_SETTING_DISABLED_MODULES`:**** Disabled modules from user settings, could be a copmosite of `password`, `deletion`, `security`, `applications`, `gpg keys`, `organizations` with a comma.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- `USER_SETTING_DISABLED_MODULES`:**** Disabled modules from user settings, could be a copmosite of `password`, `deletion`, `security`, `applications`, `gpg keys`, `organizations` with a comma.
- `USER_SETTING_DISABLED_MODULES`: **\<empty\>**: Disabled modules from user settings, could be a copmosite of `password`, `deletion`, `security`, `applications`, `gpg keys`, `organizations` with a comma.

Choose a reason for hiding this comment

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

Mind the spelling of copmosite

Comment on lines +1392 to +1397
- `password`: User cannot change his password from the website.
- `deletion`: User cannot remove himself from the website.
- `security`: User cannot update his security settings from the website.
- `applications`: User cannot create application himself.
- `gpg_keys`: User cannot manage gpg keys himself.
- `organizations`: User cannot manage his organizations himself.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- `password`: User cannot change his password from the website.
- `deletion`: User cannot remove himself from the website.
- `security`: User cannot update his security settings from the website.
- `applications`: User cannot create application himself.
- `gpg_keys`: User cannot manage gpg keys himself.
- `organizations`: User cannot manage his organizations himself.
- `password`: Users cannot change their password from the website.
- `deletion`: Users cannot remove themselves from the website.
- `security`: Users cannot update their security settings from the website.
- `applications`: Users cannot create application themselves.
- `gpg_keys`: Users cannot manage gpg keys themselves.
- `organizations`: Users cannot manage their organizations themselves.

@delvh delvh removed this from the 1.20.0 milestone Jun 4, 2023
lunny added a commit that referenced this pull request Feb 23, 2024
…29275)

Extract from #20549

This PR added a new option on app.ini `[admin]USER_DISABLED_FEATURES` to
allow the site administrator to disable users visiting deletion user
interface or allow.
This options are also potentially allowed to define more features in
future PRs.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
@jackHay22
Copy link
Contributor

@lunny Is there a reason that this PR isn't finished? Has it been replaced by something else? I'm happy to contribute if there's more to be done.

lafriks pushed a commit that referenced this pull request Mar 2, 2024
lunny added a commit that referenced this pull request Mar 4, 2024
…ce on app.ini (#29447)

Follow #29275
Extract from #20549
Fix #24716

---------

Co-authored-by: delvh <dev.lh@web.de>
@lunny lunny marked this pull request as draft March 4, 2024 08:06
@jackHay22
Copy link
Contributor

@lunny Related: #29615

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.