Added an endpoint to update a team <-> list relation
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
16
models/team_list_update.go
Normal file
16
models/team_list_update.go
Normal 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
|
||||
}
|
Reference in New Issue
Block a user