summaryrefslogtreecommitdiff
path: root/pkg/rpc/ability_handler.go
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/ability_handler.go
parente8708d505dfbe6c3ecbf41afb9732b73b6f1f156 (diff)
refactor: move policies and entities in policies package
Diffstat (limited to 'pkg/rpc/ability_handler.go')
-rw-r--r--pkg/rpc/ability_handler.go26
1 files changed, 0 insertions, 26 deletions
diff --git a/pkg/rpc/ability_handler.go b/pkg/rpc/ability_handler.go
deleted file mode 100644
index bf299da..0000000
--- a/pkg/rpc/ability_handler.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package rpc
-
-import (
- context "context"
-
- "github.com/cedar-policy/cedar-go"
- "gitlab.com/mokhax/spike/pkg/policies"
-)
-
-type AbilityService struct {
- UnimplementedAbilityServer
-}
-
-func NewAbilityService() *AbilityService {
- return &AbilityService{}
-}
-
-func (h *AbilityService) Allowed(ctx context.Context, req *AllowRequest) (*AllowReply, error) {
- ok := policies.Allowed(cedar.Request{
- Principal: cedar.NewEntityUID("User", cedar.String(req.Subject)),
- Action: cedar.NewEntityUID("Action", cedar.String(req.Permission)),
- Resource: cedar.NewEntityUID("Album", cedar.String(req.Resource)),
- Context: cedar.NewRecord(cedar.RecordMap{}),
- })
- return &AllowReply{Result: ok}, nil
-}