1
0

Use the auth methods to get IDs to avoid unneeded casts

This commit is contained in:
kolaente
2019-06-28 10:21:48 +02:00
parent fc3c5f2187
commit f1d21ea52b
25 changed files with 65 additions and 146 deletions

View File

@ -22,24 +22,20 @@ import (
// CanCreate checks if the user can create a team <-> list relation
func (tl *TeamList) CanCreate(a web.Auth) (bool, error) {
u := getUserForRights(a)
l := List{ID: tl.ListID}
return l.IsAdmin(u)
return tl.canDoTeamList(a)
}
// CanDelete checks if the user can delete a team <-> list relation
func (tl *TeamList) CanDelete(a web.Auth) (bool, error) {
user := getUserForRights(a)
l := List{ID: tl.ListID}
return l.IsAdmin(user)
return tl.canDoTeamList(a)
}
// CanUpdate checks if the user can update a team <-> list relation
func (tl *TeamList) CanUpdate(a web.Auth) (bool, error) {
user := getUserForRights(a)
l := List{ID: tl.ListID}
return l.IsAdmin(user)
return tl.canDoTeamList(a)
}
func (tl *TeamList) canDoTeamList(a web.Auth) (bool, error) {
l := List{ID: tl.ListID}
return l.IsAdmin(a)
}