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

Add FORCE_VISIBILITY config value to force new repos to be public or private #24771

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

codefritzel
Copy link

@codefritzel codefritzel commented May 17, 2023

This PR adds the feature to configure repositories as force public like force private. See #24059
The value FORCE_VISIBILITYhas been added. The key type is a string, that is used similar to DEFAULT_PRIVATE.

FORCE_VISIBILITY can take the following values:
public - new repos must be public and existing ones cannot be switched to private
private - new repos must be private similar to previous FORCE_PRIVATE=true
off - new repos can be private or public

For compatibility reasons ForceVisibility = private is set if FORCE_PRIVATE=true is configured. FORCE_PRIVATE was marked as deprecated.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 17, 2023
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 17, 2023
@KN4CK3R
Copy link
Member

KN4CK3R commented May 17, 2023

Why would you want to enforce public repos? I think it would be better to add a (per user/org) setting with a maximum of private repos as some kind of billing feature.

@codefritzel
Copy link
Author

codefritzel commented May 18, 2023

Hi @KN4CK3R,
in my use case there is a requirement to force public. For our purpose, we take an open code / source approach. Everyone who has access to our Gitea instance, apart from the restricted users, should be able to see every repository. The aim is to create transparency between the teams.

I think this option would be interesting for companies. Everyone in the company should see all repositories, as there are no secrets between employees and teams.

There is the possibility to configure force private, so why not force public as well?

@codefritzel codefritzel force-pushed the force_public branch 2 times, most recently from f82478d to a3494f7 Compare May 21, 2023 07:25
@techknowlogick
Copy link
Member

Thanks for this PR! This will break existing configs (true/false paradigm wouldn't work anymore), this however can be solved. Instead of using the force_private config, you could add a new config value of FORCE_VISIBILITY, where you have the off/public/private logic you currently have, and then for backwards compatibility you could have "if force private == true, then set force visibility = private", and set force visibility as deprecated.

@codefritzel
Copy link
Author

codefritzel commented May 26, 2023

Thanks for this PR! This will break existing configs (true/false paradigm wouldn't work anymore), this however can be solved. Instead of using the force_private config, you could add a new config value of FORCE_VISIBILITY, where you have the off/public/private logic you currently have, and then for backwards compatibility you could have "if force private == true, then set force visibility = private", and set force visibility as deprecated.

Hi @techknowlogick,
Thanks a lot for your feedback!

I prefer the parameter name FORCE_VISIBILITY much better than FORCE_PRIVATE. I have not thought of the config break unfortunately...
I assume you mean that FORCE_PRIVATE is defined as deprecated and not FORCE_VISIBILITY?
I will try to modify it like this. See 132bb83

@codefritzel codefritzel changed the title Force public Add FORCE_VISIBILITY config value to force new repos to be public or private May 26, 2023
@techknowlogick
Copy link
Member

I assume you mean that FORCE_PRIVATE is defined as deprecated and not FORCE_VISIBILITY?

yes, that's correct. Thanks for making those changes :)

@codefritzel codefritzel force-pushed the force_public branch 2 times, most recently from ff13a90 to 1497403 Compare May 29, 2023 21:21
@svenzimmermann
Copy link

svenzimmermann commented Jun 4, 2023

"Force Visibilty private" is particularly important for our use case. We need a Git environment for the school, which means that repositories are created here by minors. For reasons of copyright and data protection, it is therefore important that the content of user repositories is not published without being checked by a teacher.
For projects students should work together in organizations and teams. Here repositories set to "internal" are better conform to the requirements.

However for personal repositories "Force Visibilty private" should be permanent and not just during creation.
Is there a chance to introduce an "always private" setting for user repositories?

@codefritzel
Copy link
Author

Hi @svenzimmermann,
this already works now if FORCE_PRIVATE=true or in future with FORCE_VISIBILITY=private is set. In the settings of the repository then only an admin can set a private repo to public. However, already published repos are not automatically set to public with this setting.

@svenzimmermann
Copy link

svenzimmermann commented Jun 4, 2023

@codefritzel: Thanks for the hint, my mistake. I just tested FORCE_PRIVATE=true again.
Works with all new repos. But it should work with all personal repositories only, not organizational ones.
The publication rights in organizational repositories can already be fine tuned by authorized persons. So it doesn't really make sense there.

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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FORCE_PUBLIC: force every Repository to be public
5 participants