Skip to content

Commit 2282535

Browse files
committed
just the tip
1 parent 1727d70 commit 2282535

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -253,15 +253,16 @@ File.write("user_owns_resource.json", user_owns_resource.to_json)
253253
File.write("user_owns_resource_and_has_permission.json", user_owns_resource_and_has_permission.to_json)
254254
```
255255

256-
These examples demonstrate portability via JSON files, but we can just as easily serve the policy directly to anyone who needs it via some HTTP controller:
257-
258-
```ruby
259-
# E.g. Rails via an `ActionController`
260-
render json: user_owns_resource_and_has_permission.as_json, :ok
261-
262-
# Elsewhere, in the requesting service
263-
user_owns_resource_and_has_permission = PortableExpressions.from_json(response.body.to_s)
264-
```
256+
> [!TIP]
257+
> These examples demonstrate portability via JSON files, but we can just as easily serve the policy directly to anyone who needs it via some HTTP controller:
258+
>
259+
> ```ruby
260+
> # E.g. Rails via an `ActionController`
261+
> render json: user_owns_resource_and_has_permission.as_json, :ok
262+
>
263+
> # Elsewhere, in the requesting service
264+
> user_owns_resource_and_has_permission = PortableExpressions.from_json(response.body.to_s)
265+
> ```
265266
266267
Then, some consumer with access to the user's permissions and context around the requested `resource` and `action` can execute the policy.
267268

0 commit comments

Comments
 (0)