From 5cadf9c93394059b0fdeb7eb70f6254838509fb5 Mon Sep 17 00:00:00 2001 From: mleku Date: Wed, 3 Sep 2025 18:10:57 +0100 Subject: [PATCH] add acl interface --- go.mod | 2 +- pkg/acl/go.mod | 13 +++++++++++++ pkg/acl/go.sum | 0 pkg/crypto/go.mod | 1 + pkg/database/go.mod | 1 + pkg/encoders/go.mod | 1 + pkg/interfaces/acl/acl.go | 25 +++++++++++++++++++++++++ pkg/interfaces/go.mod | 1 + pkg/protocol/go.mod | 1 + pkg/utils/go.mod | 1 + 10 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 pkg/acl/go.mod create mode 100644 pkg/acl/go.sum create mode 100644 pkg/interfaces/acl/acl.go diff --git a/go.mod b/go.mod index e1dfd65..3a03628 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,6 @@ require ( github.com/pkg/profile v1.7.0 go-simpler.org/env v0.12.0 lol.mleku.dev v1.0.2 - lukechampine.com/frand v1.5.1 protocol.orly v0.0.0-00010101000000-000000000000 utils.orly v0.0.0-00010101000000-000000000000 ) @@ -48,6 +47,7 @@ require ( ) replace ( + acl.orly => ./pkg/acl crypto.orly => ./pkg/crypto database.orly => ./pkg/database encoders.orly => ./pkg/encoders diff --git a/pkg/acl/go.mod b/pkg/acl/go.mod new file mode 100644 index 0000000..817cd43 --- /dev/null +++ b/pkg/acl/go.mod @@ -0,0 +1,13 @@ +module acl.orly + +go 1.25.0 + +replace ( + crypto.orly => ../crypto + encoders.orly => ../encoders + interfaces.orly => ../interfaces + next.orly.dev => ../../ + protocol.orly => ../protocol + utils.orly => ../utils + acl.orly => ../acl +) diff --git a/pkg/acl/go.sum b/pkg/acl/go.sum new file mode 100644 index 0000000..e69de29 diff --git a/pkg/crypto/go.mod b/pkg/crypto/go.mod index 70b5eed..9151718 100644 --- a/pkg/crypto/go.mod +++ b/pkg/crypto/go.mod @@ -30,4 +30,5 @@ replace ( next.orly.dev => ../../ protocol.orly => ../protocol utils.orly => ../utils + acl.orly => ../acl ) diff --git a/pkg/database/go.mod b/pkg/database/go.mod index a0a55ea..7793ea5 100644 --- a/pkg/database/go.mod +++ b/pkg/database/go.mod @@ -3,6 +3,7 @@ module database.orly go 1.25.0 replace ( + acl.orly => ../acl crypto.orly => ../crypto encoders.orly => ../encoders interfaces.orly => ../interfaces diff --git a/pkg/encoders/go.mod b/pkg/encoders/go.mod index bcc2254..d0990d5 100644 --- a/pkg/encoders/go.mod +++ b/pkg/encoders/go.mod @@ -24,6 +24,7 @@ require ( ) replace ( + acl.orly => ../acl crypto.orly => ../crypto encoders.orly => ../encoders interfaces.orly => ../interfaces diff --git a/pkg/interfaces/acl/acl.go b/pkg/interfaces/acl/acl.go new file mode 100644 index 0000000..690e872 --- /dev/null +++ b/pkg/interfaces/acl/acl.go @@ -0,0 +1,25 @@ +// Package acl is an interface for implementing arbitrary access control lists. +package acl + +const ( + // Read means read only + Read = "read" + // Write means read and write + Write = "write" + // Admin means read, write, import/export and arbitrary delete + Admin = "admin" + // Owner means read, write, import/export, arbitrary delete and wipe + Owner = "owner" + // Group applies to communities and other groups; the content afterwards a + // set of comma separated : pairs designating permissions to groups. + Group = "group:" +) + +type I interface { + // GetAccessLevel returns the access level string for a given pubkey. + GetAccessLevel(pub []byte) (level string) + // GetACLInfo returns the name and a description of the ACL, which should + // explain briefly how it works, and then a long text of documentation of + // the ACL's rules and configuration (in asciidoc or markdown). + GetACLInfo() (name, description, documentation string) +} diff --git a/pkg/interfaces/go.mod b/pkg/interfaces/go.mod index 59676fd..5d08b05 100644 --- a/pkg/interfaces/go.mod +++ b/pkg/interfaces/go.mod @@ -3,6 +3,7 @@ module interfaces.orly go 1.25.0 replace ( + acl.orly => ../acl crypto.orly => ../crypto database.orly => ../database encoders.orly => ../encoders diff --git a/pkg/protocol/go.mod b/pkg/protocol/go.mod index cea7f9a..75e37ed 100644 --- a/pkg/protocol/go.mod +++ b/pkg/protocol/go.mod @@ -23,6 +23,7 @@ require ( ) replace ( + acl.orly => ../acl crypto.orly => ../crypto encoders.orly => ../encoders interfaces.orly => ../interfaces diff --git a/pkg/utils/go.mod b/pkg/utils/go.mod index 19b06e2..836c33e 100644 --- a/pkg/utils/go.mod +++ b/pkg/utils/go.mod @@ -29,6 +29,7 @@ require ( ) replace ( + acl.orly => ../acl crypto.orly => ../crypto encoders.orly => ../encoders interfaces.orly => ../interfaces