Rights performance improvements for lists and namespaces #54
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue