1
0

implemented update method via param binder

This commit is contained in:
konrad
2018-07-21 15:17:02 +02:00
committed by kolaente
parent 9e75e9b73b
commit 9979b7e321
12 changed files with 25 additions and 36 deletions

View File

@ -7,10 +7,10 @@ func (t *Team) CanCreate(user *User) bool {
}
// CanUpdate checks if the user can update a team
func (t *Team) CanUpdate(user *User, id int64) bool {
func (t *Team) CanUpdate(user *User) bool {
// Check if the current user is in the team and has admin rights in it
exists, _ := x.Where("team_id = ?", id).
exists, _ := x.Where("team_id = ?", t.ID).
And("user_id = ?", user.ID).
And("is_admin = ?", true).
Get(&TeamMember{})