Rights performance improvements for lists and namespaces #54

Merged
konrad merged 14 commits from improvement/rights-performance into master 2019-01-21 22:08:05 +00:00
2 changed files with 7 additions and 10 deletions
Showing only changes of commit 35ca2360d1 - Show all commits

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