code fix #941 caution: undertest
This commit is contained in:
parent
b99c4baab2
commit
6d0f3a07d4
10 changed files with 310 additions and 260 deletions
|
@ -288,7 +288,7 @@ func serviceRpc(rpc string, hr handler) {
|
|||
|
||||
access := hasAccess(r, hr.Config, dir, rpc, true)
|
||||
if access == false {
|
||||
renderACCESS_MODE_NONE(w)
|
||||
renderNoAccess(w)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -515,7 +515,7 @@ func renderNotFound(w http.ResponseWriter) {
|
|||
w.Write([]byte("Not Found"))
|
||||
}
|
||||
|
||||
func renderACCESS_MODE_NONE(w http.ResponseWriter) {
|
||||
func renderNoAccess(w http.ResponseWriter) {
|
||||
w.WriteHeader(http.StatusForbidden)
|
||||
w.Write([]byte("Forbidden"))
|
||||
}
|
||||
|
|
|
@ -210,8 +210,11 @@ func Profile(ctx *middleware.Context) {
|
|||
if !ctx.IsSigned {
|
||||
continue
|
||||
}
|
||||
if has, _ := models.HasAccess(ctx.User, &models.Repository{Id: act.RepoId, IsPrivate: true},
|
||||
models.ACCESS_MODE_READ); !has {
|
||||
if has, _ := models.HasAccess(ctx.User,
|
||||
&models.Repository{
|
||||
Id: act.RepoId,
|
||||
IsPrivate: true,
|
||||
}, models.ACCESS_MODE_READ); !has {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue