aboutsummaryrefslogtreecommitdiff
path: root/acl
diff options
context:
space:
mode:
authorLaria Carolin Chabowski <laria@laria.me>2017-06-30 22:56:07 +0200
committerLaria Carolin Chabowski <laria@laria.me>2017-06-30 22:56:07 +0200
commitef81051f7d0a18709ce182bd706c1e4c5fc2a6e9 (patch)
tree80e106b23f88165a490df2053666ed7d629db040 /acl
parent2a0620b4fc7e33066998d6fe709625c009a9fe28 (diff)
downloadpetrific-ef81051f7d0a18709ce182bd706c1e4c5fc2a6e9.tar.gz
petrific-ef81051f7d0a18709ce182bd706c1e4c5fc2a6e9.tar.bz2
petrific-ef81051f7d0a18709ce182bd706c1e4c5fc2a6e9.zip
Use ACLs in tree objects
Diffstat (limited to 'acl')
-rw-r--r--acl/acl.go21
1 files changed, 21 insertions, 0 deletions
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)
+}