1
0

Added an endpoint to update a team <-> list relation

This commit is contained in:
kolaente
2018-09-19 08:08:41 +02:00
parent 5e8597699d
commit aa40ab8eed
4 changed files with 33 additions and 1 deletions

View File

@ -11,3 +11,9 @@ func (tl *TeamList) CanDelete(user *User) bool {
l, _ := GetListByID(tl.ListID)
return l.IsAdmin(user)
}
// CanUpdate checks if the user can update a team <-> list relation
func (tl *TeamList) CanUpdate(user *User) bool {
l, _ := GetListByID(tl.ListID)
return l.IsAdmin(user)
}

View File

@ -0,0 +1,16 @@
package models
// Update updates a user <-> namespace relation
func (tl *TeamList) Update() (err error) {
// Check if the right is valid
if err := tl.Right.isValid(); err != nil {
return err
}
_, err = x.
Where("list_id = ? AND team_id = ?", tl.ListID, tl.TeamID).
Cols("right").
Update(tl)
return
}