mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 11:51:02 +00:00
fixed bugs with global commit feed not sending events
This commit is contained in:
parent
7a970aaff0
commit
5d00c3f6ce
3 changed files with 6 additions and 1 deletions
|
@ -101,11 +101,13 @@ func (db *permManager) Find(u *model.User, r *model.Repo) *model.Perm {
|
||||||
switch {
|
switch {
|
||||||
case u == nil && r.Private:
|
case u == nil && r.Private:
|
||||||
return &model.Perm{
|
return &model.Perm{
|
||||||
|
Guest: true,
|
||||||
Read: false,
|
Read: false,
|
||||||
Write: false,
|
Write: false,
|
||||||
Admin: false}
|
Admin: false}
|
||||||
case u == nil && !r.Private:
|
case u == nil && !r.Private:
|
||||||
return &model.Perm{
|
return &model.Perm{
|
||||||
|
Guest: true,
|
||||||
Read: true,
|
Read: true,
|
||||||
Write: false,
|
Write: false,
|
||||||
Admin: false}
|
Admin: false}
|
||||||
|
@ -124,10 +126,12 @@ func (db *permManager) Find(u *model.User, r *model.Repo) *model.Perm {
|
||||||
perm.Read = true
|
perm.Read = true
|
||||||
perm.Write = true
|
perm.Write = true
|
||||||
perm.Admin = true
|
perm.Admin = true
|
||||||
|
perm.Guest = true
|
||||||
|
|
||||||
// if the repo is public, grant read access only.
|
// if the repo is public, grant read access only.
|
||||||
case r.Private == false:
|
case r.Private == false:
|
||||||
perm.Read = true
|
perm.Read = true
|
||||||
|
perm.Guest = true
|
||||||
}
|
}
|
||||||
|
|
||||||
return perm
|
return perm
|
||||||
|
|
|
@ -78,7 +78,7 @@ func (h *WsHandler) WsUser(w http.ResponseWriter, r *http.Request) error {
|
||||||
|
|
||||||
// user must have read access to the repository
|
// user must have read access to the repository
|
||||||
// in order to pass this message along
|
// in order to pass this message along
|
||||||
if role := h.perms.Find(user, work.Repo); role.Read {
|
if role := h.perms.Find(user, work.Repo); !role.Read {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ type Perm struct {
|
||||||
Read bool `meddler:"perm_read" json:"read"`
|
Read bool `meddler:"perm_read" json:"read"`
|
||||||
Write bool `meddler:"perm_write" json:"write"`
|
Write bool `meddler:"perm_write" json:"write"`
|
||||||
Admin bool `meddler:"perm_admin" json:"admin"`
|
Admin bool `meddler:"perm_admin" json:"admin"`
|
||||||
|
Guest bool `meddler:"-" json:"guest"`
|
||||||
Created int64 `meddler:"perm_created" json:"-"`
|
Created int64 `meddler:"perm_created" json:"-"`
|
||||||
Updated int64 `meddler:"perm_updated" json:"-"`
|
Updated int64 `meddler:"perm_updated" json:"-"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue