mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-24 08:02:18 +02:00
fixed bugs with global commit feed not sending events
This commit is contained in:
parent
7a970aaff0
commit
5d00c3f6ce
@ -101,11 +101,13 @@ func (db *permManager) Find(u *model.User, r *model.Repo) *model.Perm {
|
||||
switch {
|
||||
case u == nil && r.Private:
|
||||
return &model.Perm{
|
||||
Guest: true,
|
||||
Read: false,
|
||||
Write: false,
|
||||
Admin: false}
|
||||
case u == nil && !r.Private:
|
||||
return &model.Perm{
|
||||
Guest: true,
|
||||
Read: true,
|
||||
Write: false,
|
||||
Admin: false}
|
||||
@ -124,10 +126,12 @@ func (db *permManager) Find(u *model.User, r *model.Repo) *model.Perm {
|
||||
perm.Read = true
|
||||
perm.Write = true
|
||||
perm.Admin = true
|
||||
perm.Guest = true
|
||||
|
||||
// if the repo is public, grant read access only.
|
||||
case r.Private == false:
|
||||
perm.Read = true
|
||||
perm.Guest = true
|
||||
}
|
||||
|
||||
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
|
||||
// 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
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ type Perm struct {
|
||||
Read bool `meddler:"perm_read" json:"read"`
|
||||
Write bool `meddler:"perm_write" json:"write"`
|
||||
Admin bool `meddler:"perm_admin" json:"admin"`
|
||||
Guest bool `meddler:"-" json:"guest"`
|
||||
Created int64 `meddler:"perm_created" json:"-"`
|
||||
Updated int64 `meddler:"perm_updated" json:"-"`
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user