small optimizations
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
kolaente 2019-01-18 11:26:12 +01:00
parent 68f4724be3
commit 35ca2360d1
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 7 additions and 10 deletions

View File

@ -40,17 +40,16 @@ func (l *List) CanRead(a web.Auth) bool {
return l.isOwner(user) || l.checkRight(user, ListRightRead, ListRightWrite, ListRightAdmin)
}
// CanUpdate checks if the user can update a list
func (l *List) CanUpdate(a web.Auth) bool {
return l.CanWrite(a)
}
// CanDelete checks if the user can delete a list
func (l *List) CanDelete(a web.Auth) bool {
return l.IsAdmin(a)
}
// CanUpdate checks if the user can update a list
func (l *List) CanUpdate(a web.Auth) bool {
doer := getUserForRights(a)
return l.CanWrite(doer)
}
// CanCreate checks if the user can update a list
func (l *List) CanCreate(a web.Auth) bool {
// A user can create a list if he has write access to the namespace

View File

@ -36,14 +36,12 @@ func (n *Namespace) CanRead(a web.Auth) bool {
// CanUpdate checks if the user can update the namespace
func (n *Namespace) CanUpdate(a web.Auth) bool {
u := getUserForRights(a)
return n.isOwner(u) || n.checkRight(u, NamespaceRightAdmin)
return n.IsAdmin(a)
}
// CanDelete checks if the user can delete a namespace
func (n *Namespace) CanDelete(a web.Auth) bool {
u := getUserForRights(a)
return n.isOwner(u) || n.checkRight(u, NamespaceRightAdmin)
return n.IsAdmin(a)
}
// CanCreate checks if the user can create a new namespace