File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -83,8 +83,20 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
8383 return
8484 }
8585
86+ // Allow per-user overrides
87+ appendOnly := s .AppendOnly
88+ privateRepos := s .PrivateRepos
89+ if uc , ok := s .Config .Users [username ]; ok {
90+ if uc .AppendOnly != nil {
91+ appendOnly = * uc .AppendOnly
92+ }
93+ if uc .PrivateRepos != nil {
94+ privateRepos = * uc .PrivateRepos
95+ }
96+ }
97+
8698 // Check if the current user is allowed to access this path
87- if ! s .NoAuth && s . PrivateRepos {
99+ if ! s .NoAuth && privateRepos {
88100 if len (folderPath ) == 0 || folderPath [0 ] != username {
89101 httpDefaultError (w , http .StatusUnauthorized )
90102 return
@@ -102,7 +114,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
102114
103115 // Pass the request to the repo.Handler
104116 opt := repo.Options {
105- AppendOnly : s . AppendOnly ,
117+ AppendOnly : appendOnly ,
106118 Debug : s .Debug ,
107119 QuotaManager : s .quotaManager , // may be nil
108120 PanicOnError : s .PanicOnError ,
You can’t perform that action at this time.
0 commit comments