From 3f54e2fc59f21029813863491b37e39bb6015115 Mon Sep 17 00:00:00 2001 From: mo khan Date: Wed, 2 Apr 2025 11:23:47 -0600 Subject: refactor: move policies and entities in policies package --- pkg/rpc/ability_handler.go | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 pkg/rpc/ability_handler.go (limited to 'pkg/rpc/ability_handler.go') 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 -} -- cgit v1.2.3