Add configuration to restrict allowed user visibility modes #16271

Merged
6543 merged 15 commits from settings-lowest-allowed-user-visiblity into main 2021-06-27 18:47:36 +00:00
6543 commented 2021-06-27 11:53:17 +00:00 (Migrated from github.com)

Now that #16069 is merged, some sites may wish to enforce that users are all public, limited or private, and/or disallow users from becoming private.

This PR adds functionality and settings to constrain a user's ability to change their visibility.

Now that #16069 is merged, some sites may wish to enforce that users are all public, limited or private, and/or disallow users from becoming private. This PR adds functionality and settings to constrain a user's ability to change their visibility.
zeripath reviewed 2021-06-27 12:40:37 +00:00
@ -14,9 +14,11 @@ import (
)
// Service settings
Contributor

As VisibleType is an integer with complete coverage just use an bool array.

As VisibleType is an integer with complete coverage just use an bool array.
zeripath reviewed 2021-06-27 14:26:53 +00:00
@ -74,0 +90,4 @@
// ToVisibleTypeSlice convert a AllowedVisibility into a VisibleType slice
func (a AllowedVisibility) ToVisibleTypeSlice() (result []structs.VisibleType) {
for i, v := range a {
Contributor

Why not change this to:

} {
  AllowedUserVisibilityModesSlice: []bool{true, true, true},
}
Why not change this to: ```suggestion } { AllowedUserVisibilityModesSlice: []bool{true, true, true}, } ```
zeripath reviewed 2021-06-27 14:27:18 +00:00
@ -74,0 +90,4 @@
// ToVisibleTypeSlice convert a AllowedVisibility into a VisibleType slice
func (a AllowedVisibility) ToVisibleTypeSlice() (result []structs.VisibleType) {
for i, v := range a {
Contributor

Then you could drop all of those changes in the tests

Then you could drop all of those changes in the tests
zeripath approved these changes 2021-06-27 14:42:04 +00:00
noerw (Migrated from github.com) approved these changes 2021-06-27 17:05:41 +00:00
This repo is archived. You cannot comment on pull requests.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: lunny/gitea#16271
No description provided.