mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-10-02 08:22:01 +00:00
fixed issue with Role not being returned when getting repo
This commit is contained in:
parent
bb218a6268
commit
962aa8e968
1 changed files with 7 additions and 7 deletions
|
@ -22,14 +22,13 @@ import (
|
||||||
//
|
//
|
||||||
func GetRepo(c web.C, w http.ResponseWriter, r *http.Request) {
|
func GetRepo(c web.C, w http.ResponseWriter, r *http.Request) {
|
||||||
var (
|
var (
|
||||||
admin = r.FormValue("admin")
|
role = ToRole(c)
|
||||||
role = ToRole(c)
|
repo = ToRepo(c)
|
||||||
repo = ToRepo(c)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// if the user is not requesting (or cannot access)
|
// if the user is not requesting (or cannot access)
|
||||||
// admin data then we just return the repo as-is
|
// admin data then we just return the repo as-is
|
||||||
if len(admin) == 0 || role.Admin == false {
|
if role.Admin == false {
|
||||||
json.NewEncoder(w).Encode(repo)
|
json.NewEncoder(w).Encode(repo)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -37,9 +36,10 @@ func GetRepo(c web.C, w http.ResponseWriter, r *http.Request) {
|
||||||
// else we should return restricted fields
|
// else we should return restricted fields
|
||||||
json.NewEncoder(w).Encode(struct {
|
json.NewEncoder(w).Encode(struct {
|
||||||
*model.Repo
|
*model.Repo
|
||||||
PublicKey string `json:"public_key"`
|
PublicKey string `json:"public_key"`
|
||||||
Params string `json:"params"`
|
Params string `json:"params"`
|
||||||
}{repo, repo.PublicKey, repo.Params})
|
Perm *model.Perm `json:"role"`
|
||||||
|
}{repo, repo.PublicKey, repo.Params, role})
|
||||||
}
|
}
|
||||||
|
|
||||||
// DelRepo accepts a request to inactivate the named
|
// DelRepo accepts a request to inactivate the named
|
||||||
|
|
Loading…
Reference in a new issue