File tree 1 file changed +14
-2
lines changed
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) {
83
83
return
84
84
}
85
85
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
+
86
98
// Check if the current user is allowed to access this path
87
- if ! s .NoAuth && s . PrivateRepos {
99
+ if ! s .NoAuth && privateRepos {
88
100
if len (folderPath ) == 0 || folderPath [0 ] != username {
89
101
httpDefaultError (w , http .StatusUnauthorized )
90
102
return
@@ -102,7 +114,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
102
114
103
115
// Pass the request to the repo.Handler
104
116
opt := repo.Options {
105
- AppendOnly : s . AppendOnly ,
117
+ AppendOnly : appendOnly ,
106
118
Debug : s .Debug ,
107
119
QuotaManager : s .quotaManager , // may be nil
108
120
PanicOnError : s .PanicOnError ,
You can’t perform that action at this time.
0 commit comments