forked from vikunja/vikunja
parent
d3a5e62cdc
commit
003cf85d05
|
@ -17,5 +17,24 @@
|
||||||
|
|
||||||
package models
|
package models
|
||||||
|
|
||||||
// TODO
|
import "code.vikunja.io/web"
|
||||||
// Rights based on the task
|
|
||||||
|
func (tc *TaskComment) CanWrite(a web.Auth) (bool, error) {
|
||||||
|
t := Task{ID: tc.ID}
|
||||||
|
return t.CanWrite(a)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (tc *TaskComment) CanDelete(a web.Auth) (bool, error) {
|
||||||
|
t := Task{ID: tc.ID}
|
||||||
|
return t.CanWrite(a)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (tc *TaskComment) CanUpdate(a web.Auth) (bool, error) {
|
||||||
|
t := Task{ID: tc.ID}
|
||||||
|
return t.CanWrite(a)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (tc *TaskComment) CanCreate(a web.Auth) (bool, error) {
|
||||||
|
t := Task{ID: tc.ID}
|
||||||
|
return t.CanWrite(a)
|
||||||
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ type TaskComment struct {
|
||||||
Comment string `xorm:"text not null" json:"comment"`
|
Comment string `xorm:"text not null" json:"comment"`
|
||||||
AuthorID int64 `xorm:"not null" json:"-"`
|
AuthorID int64 `xorm:"not null" json:"-"`
|
||||||
Author *user.User `xorm:"extends" json:"author"`
|
Author *user.User `xorm:"extends" json:"author"`
|
||||||
TaskID int64 `xorm:"not null" json:"-"`
|
TaskID int64 `xorm:"not null" json:"-" param:"task"`
|
||||||
|
|
||||||
Created timeutil.TimeStamp `xorm:"created"`
|
Created timeutil.TimeStamp `xorm:"created"`
|
||||||
Updated timeutil.TimeStamp `xorm:"updated"`
|
Updated timeutil.TimeStamp `xorm:"updated"`
|
||||||
|
|
|
@ -64,7 +64,7 @@ func (t *Task) canDoTask(a web.Auth) (bool, error) {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// A user can do a task if he has write acces to its list
|
// A user can do a task if it has write acces to its list
|
||||||
l := &List{ID: lI.ListID}
|
l := &List{ID: lI.ListID}
|
||||||
return l.CanWrite(a)
|
return l.CanWrite(a)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue