Project

General

Profile

Handling private repositories for public projects via reposman.rb

Added by Tide _ over 15 years ago

I have been trying to figure out the best way to add the ability to have a private repository on a public project. This can easily be done if you do not utilize automatic Subversion creation via reposman.rb. However, if you do use auto creation then this is not possible right now. I can hide the repository inside Redmine but the repository itself is still Public and not what I am after. If I make all repositories private I can get the desired results inside Redmine but a member of the project can still go directly to the repository and enter their user and pass and browse. I tested this by hacking Redmine.pm to return an empty result for is_public and reposman.rb to return right = 0770 always. This makes it so even Public projects get a private repository. I need Redmine.pm to do another check to see if the user's Role can browse repositories.

The rest of this post assumes you have "Enable WS for repository management" checked to enable auto creation of repositories.

Add = WS Repository Type = None,Public,Private (Available options for Public repositories - can set at creation and in settings)
Add = WS Repository Type = None,Private (Available options for Private repositories - can set at creation and in settings)

Not real sure on an exact name for the field. However, WS Repository Type will do for post.

The combo box to select the WS Repository Type would be on the project creation page to the right of the Public check box.
If possible the values in combo box would change based on the check state of Public. If public then options would be None,Public,Private. If Private then the options would be None,Public.

I guess while we are at it there may be some need for a public repository for a private project. However, for me this is not needed. For completeness we could just have the same options for both Public and Private (I am indifferent on this point).

Goals:
1. Add option to have reposman.rb skip creating the repository if you select "None" as the WS Repository Type.
2. Add option to have reposman.rb check to set repository permissions based on WS Repository Type instead of is_public.
3. Add option to have Redmine.pm check to see if the repository is private:
- If the user is a member of the project then:
- If private then does the user's Role have the ability to browse the repository?
(Right now it just checks to see if you are a member of the project)

The None option will give you 2 choices currently unavailable with auto creation:
1. No wasted resources for repositories you may not want at all.
2. The ability to add your own link to a repository that is not part of your standard subversion directory.

The result of the added WS Repository Type will let the repository be Public or Private and if Private will let the user browse the repository if they are a member of the project and their Role has the ability to Browse.

I know editing the two files discussed here would be a must. My questions are:
1. What files would be involved in this process?
2. Does this seem like an obtainable feature?
3. Can you think of a better way to do it?
4. Has anyone done something similar?

I have C# programming skills and some PHP and HTML so I am a little bit lost on the exact code and means to achieve my desired result.

I have figured out how to do this without using auto creation but I really want to do all the work now so I can sit back and relax in the future. Any ideas comments or help would be greatly appreciated.


Replies (1)

RE: Handling private repositories for public projects via reposman.rb - Added by Tide _ over 15 years ago

Well due to overwhelming response :) I have decided to learn some Perl.

This is what I came up with. http://www.redmine.org/issues/3079

If anyone sees anything wrong or has anything to add let me know.

So far it seems to be working great and does exactly what I wanted and more!

    (1-1/1)