From ef81051f7d0a18709ce182bd706c1e4c5fc2a6e9 Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Fri, 30 Jun 2017 22:56:07 +0200 Subject: Use ACLs in tree objects --- acl/acl.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'acl') diff --git a/acl/acl.go b/acl/acl.go index 544edde..d3ab912 100644 --- a/acl/acl.go +++ b/acl/acl.go @@ -31,6 +31,20 @@ func (p Perm) String() string { type QualifiedPerms map[string]Perm +func (a QualifiedPerms) Equals(b QualifiedPerms) bool { + if len(a) != len(b) { + return false + } + + for k, va := range a { + if vb, ok := b[k]; !ok || vb != va { + return false + } + } + + return true +} + type ACL struct { User, Group, Other, Mask QualifiedPerms } @@ -132,3 +146,10 @@ func ParseACL(s string) (ACL, error) { return acl, nil } + +func (a ACL) Equals(b ACL) bool { + return a.User.Equals(b.User) && + a.Group.Equals(b.Group) && + a.Other.Equals(b.Other) && + a.Mask.Equals(b.Mask) +} -- cgit v1.2.3-70-g09d2