You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/spicedb/concepts/consistency.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,7 @@ Consistency is provided via the [Consistency message][msg] on supported API call
48
48
49
49
#### Minimize Latency
50
50
51
-
`minimize_latency` will attempt to minimize the latency of the API call by selecting data that is most likely exist in the cache.
51
+
`minimize_latency` will attempt to minimize the latency of the API call by selecting data that is most likely to exist in the cache.
52
52
53
53
<Callouttype="warning">
54
54
If used exclusively, this can lead to a window of time where the [New Enemy Problem] can occur.
@@ -130,13 +130,13 @@ SpiceDB returns ZedTokens from the APIs that perform permission checks or modify
130
130
131
131
### Storing ZedTokens
132
132
133
-
There are scenarios where it makes sense to store ZedTokens in an applications primary database.
133
+
There are scenarios where it makes sense to store ZedTokens in an application's primary database.
134
134
The goal of this workflow is to ensure the application can query SpiceDB with consistency that is causally tied to the content of the protected resource.
135
135
136
136
Stored ZedTokens should be updated under these events:
137
137
138
138
- The resource is created or deleted
139
-
- The contents of the resource changes
139
+
- The contents of the resource change
140
140
- Adding or removing access to the resource (e.g. writing a relationship)
141
141
142
142
When these events happen, a new ZedToken is either returned or it should be requested by performing a check with full consistency.
Copy file name to clipboardExpand all lines: pages/spicedb/concepts/datastore-migrations.mdx
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,9 @@ For all software that maintains data, there can be updates to code that rely on
31
31
The process of updating data to use new versions of software is called _migrating_.
32
32
33
33
SpiceDB users will see migrations crop up in two places: when they update versions of SpiceDB and when they write backwards incompatible changes to their schema.
34
-
This document's focus is on the former.
34
+
This document's focus is on the former; the latter is documented [here].
Copy file name to clipboardExpand all lines: pages/spicedb/getting-started/coming-from/cancancan.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ A quick recap on the components and their purpose:
33
33
34
34
CanCanCan is a *library* (gem) designed to help model authorization in Ruby on Rails projects.
35
35
The fundamental idea behind most authorization libraries is that access control can be modeled by reusing as much as possible from within your existing web framework.
36
-
For cancancan, developers defines their models from within an `Ability` class.
36
+
For cancancan, developers define their models from within an `Ability` class.
37
37
Engine logic is implemented within the library such that developers can simply load the `Ability` class within their `Controller` classes to enforce their models.
38
38
Data outside of the request context is left open ended, but most often is fetched from the primary database using ActiveRecord.
Copy file name to clipboardExpand all lines: pages/spicedb/getting-started/coming-from/opa.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,5 +65,5 @@ Adopting SpiceDB can be a powerful tool for enabling a shift towards centralizin
65
65
66
66
## When to use OPA instead of SpiceDB
67
67
68
-
OPA excels where in scenarios where it can be easily embedded or ran alongside an existing workload.
68
+
OPA excels in scenarios where it can be easily embedded or ran alongside an existing workload.
69
69
Because it is a fairly open-ended how one deals with data in OPA deployments, it shines best as a solution when access control decisions don't require much data.
With a schema designed, we can now move on using our client to apply that schema to the Permission System.
120
+
With a schema designed, we can now move on to using our client to apply that schema to the Permission System.
121
121
122
122
<Callouttype="info">
123
123
Similar to applying schema changes for relational databases, all changes to a schema must be backwards compatible.
@@ -314,7 +314,7 @@ public class App {
314
314
315
315
## Storing Relationships
316
316
317
-
After a permission system has its schema applied, it is ready to have its relationships be created, touched, or deleted.
317
+
After a permission system has its schema applied, it is ready to have its relationships created, touched, or deleted.
318
318
Relationships are live instances of relations between objects.
319
319
Because the relationships stored in the system can change at runtime, this is a powerful primitive for dynamically granting or revoking access to the resources you've modeled.
320
320
When applications modify or create rows in their database, they will also typically create or update relationships.
@@ -639,17 +639,17 @@ public class App {
639
639
## Checking Permissions
640
640
641
641
Permissions Systems that have stored relationships are capable of performing permission checks.
642
-
Checks do not only test for the existence of direct relationships, but will also compute and traverse transitive relationships.
643
-
For example, in our example schema, writers have both write and read, so there's no need to create a read relationship for a subject that is already a writer.
642
+
Checks not only test for the existence of direct relationships, but also compute and traverse transitive relationships.
643
+
For example, in our example schema, writers have both write and read permissions, so there's no need to create a read relationship for a subject that is already a writer.
644
644
645
645
<Callouttype="info">
646
646
In addition to checking _permissions_, it is also possible to perform checks on _relations_ to determine membership.
647
647
648
-
However, this goes against best practice: permissions can be redefined in backwards compatible ways by changing schema, so it's ideal to rely on permissions as the contract between SpiceDB and applications querying SpiceDB.
648
+
However, this goes against best practice: permissions can be redefined in backwards compatible ways by changing the schema, so it's ideal to rely on permissions as the contract between SpiceDB and applications querying SpiceDB.
649
649
</Callout>
650
650
651
651
<Callouttype="warning">
652
-
In order to get read-after-write consistency, you must provide a [ZedToken] from the WriteRelationships response or request [full consistency].
652
+
When doing a permission check, in order to get read-after-write consistency, you must provide a [ZedToken] from the WriteRelationships response or request [full consistency].
Copy file name to clipboardExpand all lines: pages/spicedb/modeling/attributes.mdx
+2-3Lines changed: 2 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,10 +22,9 @@ Feature flag authorization can be enabled with boolean attributes.
22
22
[Wildcards](/spicedb/concepts/schema#wildcards) are a way to implement boolean attributes.
23
23
Wildcards modify a type so that a relationship can be written to all objects of a resource type but not individual objects.
24
24
25
-
In the example below, the schema enforces the following authorization logic: a user can only view a document if the user is related to the document as viewer and editing is enabled for the document.
26
-
To enable document editing in the example below, you need to establish a wildcard relationship that connects all users to the document using the ```edit_enabled``` wildcard relation.
27
-
A user will have ```edit``` permission on the document if they are related to the document as an ```editor``` and they relate to the document through ```edit_enabled```.
25
+
In the example below, the schema enforces the following authorization logic: a user will have ```edit``` permission on the document if they are related to the document as an ```editor``` and they relate to the document through ```edit_enabled```.
28
26
Both are required because ```editor``` and ```edit_enabled``` are [intersected](/spicedb/concepts/schema#-intersection) at the ```edit``` permission definition.
27
+
To enable document editing, you need to establish a relationship that connects all users to the document using the ```edit_enabled``` relation: `document:somedocument#edit_enabled@user:*`.
Copy file name to clipboardExpand all lines: pages/spicedb/modeling/developing-a-schema.mdx
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,7 +70,7 @@ relation reader: user | anotherobjecttype
70
70
71
71
## Validating our schema
72
72
73
-
To validate that our schema is correct, both [zed] and [Playground]supports the writing of _test relationships_ as data writing tests against our schema.
73
+
To validate that our schema is correct, both [zed] and [Playground]support the writing of _test relationships_ as data writing tests against our schema.
74
74
Once we've [created test relationships][understanding-rels], we can define tests in three ways:
75
75
76
76
-**Check Watches**: live checks performed as we edit the schema
Validation can be run by clicking the `Validate` button in the Playground or using the `zed validate` command.
111
+
Validations can be run by clicking the `Validate` button in the Playground or by using the `zed validate` command.
112
112
113
113
### Expected Relations
114
114
@@ -190,9 +190,9 @@ As a naive solution, we could create a `reader` relationship for every user when
190
190
191
191
Instead, we'd ideally like a user with role `writer` to be **implicitly** allowed to a read a document, such that we only ever need to write _one_ relationship representing the user's **actual** relation/role to the document.
192
192
193
-
The solution to this problem is the second concept available within the Schema Language: **permissions**
193
+
The solution to this problem is the second concept available within the Schema Language: **permissions**.
194
194
195
-
A `permission` in schema defines a permission _computed_ from one or more other relations or permissions.
195
+
A `permission` in a schema defines a permission _computed_ from one or more other relations or permissions.
196
196
197
197
Let's take our schema again from above:
198
198
@@ -281,9 +281,9 @@ Note that the contents of the angled brackets for `differentuser` and `specificu
281
281
### Preparing to inherit permissions
282
282
283
283
As we've seen above, we can use `permission` to define _implicit_ permissions, such as a `view` permission consisting of users either the `reader` or `writer` role.
284
-
Implicit permissions on a specific object type, however, are often insufficient: Sometimes permissions need to be **inherited** between object types.
284
+
Implicit permissions on a specific object type, however, are often insufficient: sometimes permissions need to be **inherited** between object types.
285
285
286
-
As an example: Imagine that we add the concept of an `organization` to our permissions system, where any user that is an administrator of an organization automatically gains the ability to `view` any `document` within that organization; how would we define such a permissions schema?
286
+
As an example: imagine that we add the concept of an `organization` to our permissions system, where any user that is an administrator of an organization automatically gains the ability to `view` any `document` within that organization; how would we define such a permissions schema?
287
287
288
288
### Defining the organization type
289
289
@@ -347,7 +347,7 @@ Here we've chosen to call this relation `docorg`, but it could be called anythin
347
347
348
348
### Adding the relationship
349
349
350
-
Now that we've defined the `relation` to hold our new relationship, we can add a test relationship in our test relationships:
350
+
Now that we've defined the `relation` to hold our new relationship, we can add a test relationship:
Copy file name to clipboardExpand all lines: pages/spicedb/modeling/representing-users.mdx
+2-4Lines changed: 2 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,6 @@ import { Callout } from 'nextra/components'
4
4
5
5
Within a Permissions System, a [CheckPermission] call is always made between an object representing the *resource* and an object representing a *subject*: The API call returns whether the *subject* has the specified permission on the *resource*.
6
6
7
-
The choice of how to represent subjects can have large downstream effects on the design of a permissions system.
0 commit comments