fix(filters): allow managing views for saved filters
This commit is contained in:
@ -22,21 +22,45 @@ import (
|
||||
)
|
||||
|
||||
func (p *ProjectView) CanRead(s *xorm.Session, a web.Auth) (bool, int, error) {
|
||||
filterID := getSavedFilterIDFromProjectID(p.ProjectID)
|
||||
if filterID > 0 {
|
||||
sf := &SavedFilter{ID: filterID}
|
||||
return sf.CanRead(s, a)
|
||||
}
|
||||
|
||||
pp := p.getProject()
|
||||
return pp.CanRead(s, a)
|
||||
}
|
||||
|
||||
func (p *ProjectView) CanDelete(s *xorm.Session, a web.Auth) (bool, error) {
|
||||
filterID := getSavedFilterIDFromProjectID(p.ProjectID)
|
||||
if filterID > 0 {
|
||||
sf := &SavedFilter{ID: filterID}
|
||||
return sf.CanDelete(s, a)
|
||||
}
|
||||
|
||||
pp := p.getProject()
|
||||
return pp.IsAdmin(s, a)
|
||||
}
|
||||
|
||||
func (p *ProjectView) CanUpdate(s *xorm.Session, a web.Auth) (bool, error) {
|
||||
filterID := getSavedFilterIDFromProjectID(p.ProjectID)
|
||||
if filterID > 0 {
|
||||
sf := &SavedFilter{ID: filterID}
|
||||
return sf.CanUpdate(s, a)
|
||||
}
|
||||
|
||||
pp := p.getProject()
|
||||
return pp.IsAdmin(s, a)
|
||||
}
|
||||
|
||||
func (p *ProjectView) CanCreate(s *xorm.Session, a web.Auth) (bool, error) {
|
||||
filterID := getSavedFilterIDFromProjectID(p.ProjectID)
|
||||
if filterID > 0 {
|
||||
sf := &SavedFilter{ID: filterID}
|
||||
return sf.CanUpdate(s, a)
|
||||
}
|
||||
|
||||
pp := p.getProject()
|
||||
return pp.IsAdmin(s, a)
|
||||
}
|
||||
|
Reference in New Issue
Block a user