Simplify list rights check #50

Merged
konrad merged 3 commits from feature/simplify-list-rights-check into master 2019-01-14 21:49:50 +00:00
Showing only changes of commit f6f713ee35 - Show all commits

View File

@ -33,7 +33,16 @@ func (t *ListTask) CanUpdate(a web.Auth) bool {
// CanCreate determines if a user has the right to create a list task
func (t *ListTask) CanCreate(a web.Auth) bool {
return t.canDoListTask(a)
doer := getUserForRights(a)
// A user can do a task if he has write acces to its list
l := &List{ID: t.ListID}
err := l.GetSimpleByID()
if err != nil {
log.Log.Error("Error occurred during CanDelete for ListTask: %s", err)
return false
}
return l.CanWrite(doer)
}
// CanRead determines if a user can read a task