feat(webhooks): prevent link shares from managing webhooks
This commit is contained in:
parent
57de44694c
commit
eb1b9247ad
@ -27,16 +27,23 @@ func (w *Webhook) CanRead(s *xorm.Session, a web.Auth) (bool, int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (w *Webhook) CanDelete(s *xorm.Session, a web.Auth) (bool, error) {
|
func (w *Webhook) CanDelete(s *xorm.Session, a web.Auth) (bool, error) {
|
||||||
p := &Project{ID: w.ProjectID}
|
return w.canDoWebhook(s, a)
|
||||||
return p.CanUpdate(s, a)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Webhook) CanUpdate(s *xorm.Session, a web.Auth) (bool, error) {
|
func (w *Webhook) CanUpdate(s *xorm.Session, a web.Auth) (bool, error) {
|
||||||
p := &Project{ID: w.ProjectID}
|
return w.canDoWebhook(s, a)
|
||||||
return p.CanUpdate(s, a)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Webhook) CanCreate(s *xorm.Session, a web.Auth) (bool, error) {
|
func (w *Webhook) CanCreate(s *xorm.Session, a web.Auth) (bool, error) {
|
||||||
|
return w.canDoWebhook(s, a)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *Webhook) canDoWebhook(s *xorm.Session, a web.Auth) (bool, error) {
|
||||||
|
_, isShareAuth := a.(*LinkSharing)
|
||||||
|
if isShareAuth {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
p := &Project{ID: w.ProjectID}
|
p := &Project{ID: w.ProjectID}
|
||||||
return p.CanUpdate(s, a)
|
return p.CanUpdate(s, a)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user