1
0

Implemented Get one team method

This commit is contained in:
konrad
2018-07-16 08:43:47 +02:00
committed by kolaente
parent 8a06db5351
commit 7dc4cd2173
3 changed files with 30 additions and 3 deletions

View File

@ -31,4 +31,12 @@ func (t *Team) IsAdmin(user *User) bool {
And("is_admin = ?", true).
Get(&TeamMember{})
return exists
}
}
func (t *Team) CanRead(user *User) bool {
// Check if the user is in the team
exists, _ := x.Where("team_id = ?", t.ID).
And("user_id = ?", user.ID).
Get(&TeamMember{})
return exists
}