summaryrefslogtreecommitdiff
path: root/pkg/rpc
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-04-02 11:23:47 -0600
committermo khan <mo@mokhan.ca>2025-04-02 11:23:47 -0600
commit3f54e2fc59f21029813863491b37e39bb6015115 (patch)
tree423d1d427e4d340d8030d3c9d98794084c0d5edb /pkg/rpc
parente8708d505dfbe6c3ecbf41afb9732b73b6f1f156 (diff)
refactor: move policies and entities in policies package
Diffstat (limited to 'pkg/rpc')
-rw-r--r--pkg/rpc/ability_service.go (renamed from pkg/rpc/ability_handler.go)0
-rw-r--r--pkg/rpc/server_test.go12
2 files changed, 11 insertions, 1 deletions
diff --git a/pkg/rpc/ability_handler.go b/pkg/rpc/ability_service.go
index bf299da9..bf299da9 100644
--- a/pkg/rpc/ability_handler.go
+++ b/pkg/rpc/ability_service.go
diff --git a/pkg/rpc/server_test.go b/pkg/rpc/server_test.go
index 266f1434..8f333a5b 100644
--- a/pkg/rpc/server_test.go
+++ b/pkg/rpc/server_test.go
@@ -41,7 +41,7 @@ func TestServer(t *testing.T) {
assert.False(t, reply.Result)
})
- t.Run("returns true", func(t *testing.T) {
+ t.Run("returns true for alice:view:jane_vacation", func(t *testing.T) {
reply, err := client.Allowed(t.Context(), &AllowRequest{
Subject: "alice",
Permission: "view",
@@ -50,4 +50,14 @@ func TestServer(t *testing.T) {
require.NoError(t, err)
assert.True(t, reply.Result)
})
+
+ t.Run("returns gid://User/1:read_projects:gid://Organization/1", func(t *testing.T) {
+ reply, err := client.Allowed(t.Context(), &AllowRequest{
+ Subject: "gid://User/1",
+ Permission: "read_projects",
+ Resource: "gid://Organization/1",
+ })
+ require.NoError(t, err)
+ assert.True(t, reply.Result)
+ })
}