summaryrefslogtreecommitdiff
path: root/lib/authx/rpc/ability_handler.rb
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-03-06 12:27:03 -0700
committermo khan <mo@mokhan.ca>2025-03-06 12:27:03 -0700
commit68aaecae08062f6a200bc7167e8666c14165630c (patch)
tree830f1ddb5ce40504b33976ec598a91b70d10d083 /lib/authx/rpc/ability_handler.rb
parent534c909963f4d9ad4d4a8ec76d882cdf963f1811 (diff)
feat: remove standalone gRPC server
Diffstat (limited to 'lib/authx/rpc/ability_handler.rb')
-rw-r--r--lib/authx/rpc/ability_handler.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/authx/rpc/ability_handler.rb b/lib/authx/rpc/ability_handler.rb
index bc1444ca..9f9b8fe3 100644
--- a/lib/authx/rpc/ability_handler.rb
+++ b/lib/authx/rpc/ability_handler.rb
@@ -7,9 +7,20 @@ module Authx
puts [request, env].inspect
{
- result: true
+ result: can?(request)
}
end
+
+ private
+
+ def can?(request)
+ policy_for(request).can?(request.permission)
+ end
+
+ def policy_for(request)
+ # TODO:: convert subject in form of GlobalID to Resource Type
+ DeclarativePolicy.policy_for(request.subject, request.resource)
+ end
end
end
end