1
0

fmt + lint + docs

This commit is contained in:
konrad
2018-07-21 15:28:09 +02:00
committed by kolaente
parent 9979b7e321
commit 0487889963
5 changed files with 21 additions and 9 deletions

View File

@ -1,5 +1,6 @@
package models
// ReadAll implements the method to read all teams of a namespace
func (tn *TeamNamespace) ReadAll(user *User) (interface{}, error) {
// Check if the user can read the namespace
n, err := GetNamespaceByID(tn.NamespaceID)
@ -7,7 +8,7 @@ func (tn *TeamNamespace) ReadAll(user *User) (interface{}, error) {
return nil, err
}
if !n.CanRead(user) {
return nil, ErrNeedToHaveNamespaceReadAccess{NamespaceID:tn.NamespaceID, UserID:user.ID}
return nil, ErrNeedToHaveNamespaceReadAccess{NamespaceID: tn.NamespaceID, UserID: user.ID}
}
// Get the teams
@ -20,4 +21,4 @@ func (tn *TeamNamespace) ReadAll(user *User) (interface{}, error) {
Find(&all)
return all, err
}
}

View File

@ -10,4 +10,4 @@ func (tn *TeamNamespace) CanCreate(user *User) bool {
func (tn *TeamNamespace) CanDelete(user *User) bool {
n, _ := GetNamespaceByID(tn.NamespaceID)
return n.IsAdmin(user)
}
}