vikunja-api/models/team_members_rights.go
2018-07-26 09:53:32 +02:00

9 lines
No EOL
265 B
Go

package models
func (tm *TeamMember) CanCreate(user *User) bool {
// A user can add a member to a team if he is admin of that team
exists, _ := x.Where("user_id = ? AND team_id = ? AND admin = ?", user.ID, tm.TeamID, true).
Get(&TeamMember{})
return exists
}