Skip to content

Commit d2ae02a

Browse files
authored
Update for Rules v2: remove "Device Sync Permissions" (#2581)
## Pull Request Info ### Jira - https://jira.mongodb.org/browse/DOCSP-26779 ### Staged Changes - https://docs-mongodbcom-staging.corp.mongodb.com/realm/docsworker-xlarge/permissions-v2/ ### Reminder Checklist If your PR modifies the docs, you might need to also update some corresponding pages. Check if completed or N/A. - [x] Create Jira ticket for corresponding docs-app-services update(s), if any - [x] Checked/updated Admin API - [x] Checked/updated CLI reference ### Review Guidelines [REVIEWING.md](https://github.com/mongodb/docs-realm/blob/master/REVIEWING.md)
1 parent e61e391 commit d2ae02a

File tree

2 files changed

+49
-58
lines changed

2 files changed

+49
-58
lines changed

source/sdk/flutter/sync/write-to-synced-realm.txt

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,20 @@ Device Sync is configured with the following queryable fields:
2929
- ``miles``
3030
- ``ownerId``
3131

32-
Device Sync has permissions configured to let users read and write only their own
33-
data:
32+
The App Services App has permissions configured to let users read and write only
33+
their own data:
3434

3535
.. code-block:: json
3636

3737
{
38-
"rules": {},
39-
"defaultRoles": [
40-
{
41-
"name": "owner-read-write",
42-
"applyWhen": {},
43-
"read": {
44-
"ownerId": "%%user.id"
45-
},
46-
"write": {
47-
"ownerId": "%%user.id"
48-
}
49-
}
50-
]
38+
"name": "owner-read-write",
39+
"apply_when": {},
40+
"document_filters": {
41+
"read": { "ownerId": "%%user.id" },
42+
"write": { "ownerId": "%%user.id" }
43+
},
44+
"read": true,
45+
"write": true
5146
}
5247

5348
The examples on this page use the following schema:
@@ -72,12 +67,14 @@ of the following:
7267
the write reverts with a non-fatal compensating write error (ErrorCompensatingWrite).
7368
- To learn more about compensating write errors and how to avoid them,
7469
refer to the :ref:`Compensating Writes <flutter-compensating-writes>` section.
75-
- **The Device Sync permissions** in your App Services App.
76-
- If your try to write data that doesn't match the Device Sync permissions expression,
77-
the write reverts with a non-fatal permission denied error (ErrorPermissionDenied).
78-
- To learn more about configuring Device Sync permissions for your app,
79-
refer to :ref:`sync-rules` and the :ref:`flexible-sync-permissions-guide`
80-
in the App Services documentation.
70+
- **The permissions** in your App Services App.
71+
- If your try to write data that doesn't match the permissions expression,
72+
the write reverts with a non-fatal permission denied error. In the client,
73+
this shows as an error (ErrorCompensatingWrite). On the server, you can see more
74+
details about how the write was denied was by a write filter in the role.
75+
- To learn more about configuring permissions for your app, see
76+
:ref:`sync-rules` and the :ref:`flexible-sync-permissions-guide` in the
77+
App Services documentation.
8178

8279
To learn more about permission denied errors, compensating write errors
8380
and other Device Sync error types, refer to :ref:`sync-errors` in the App Services documentation.

source/sdk/swift/sync/write-to-synced-realm.txt

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,14 @@ of the following:
2323
- **The sync subscription query.**
2424
- If your write operation doesn't match the query in the subscription,
2525
the write reverts with a non-fatal compensating write error (ErrorCompensatingWrite).
26-
- **The Device Sync permissions** in your App Services App.
27-
- If your try to write data that doesn't match the Device Sync permissions expression,
28-
the write reverts with a non-fatal permission denied error.
29-
In the client, this shows as an (ErrorCompensatingWrite). On the server,
30-
you can see more details about how the write was denied was by a
31-
write filter in the role.
32-
- To learn more about configuring Device Sync permissions for your app,
33-
refer to :ref:`sync-rules` and the :ref:`flexible-sync-permissions-guide`
34-
in the App Services documentation.
26+
- **The permissions** in your App Services App.
27+
- If your try to write data that doesn't match the permissions expression,
28+
the write reverts with a non-fatal permission denied error. In the client,
29+
this shows as an error (ErrorCompensatingWrite). On the server, you can see more
30+
details about how the write was denied was by a write filter in the role.
31+
- To learn more about configuring permissions for your app, see
32+
:ref:`sync-rules` and the :ref:`flexible-sync-permissions-guide` in the
33+
App Services documentation.
3534

3635
.. warning:: Multiprocess Sync is Not Supported
3736

@@ -42,40 +41,35 @@ of the following:
4241
Determining What Data Syncs
4342
---------------------------
4443

45-
The data that you can write to a synced realm is the intersection of your
46-
Device Sync configuration - your queryable fields and permissions - and the
47-
Flexible Sync subscription query that you use when you open the realm.
44+
The data that you can write to a synced realm is the intersection of your Device
45+
Sync configuration, your permissions, and the Flexible Sync subscription query
46+
that you use when you open the realm.
4847

4948
The examples on this page use the following configurations and models:
5049

51-
Device Sync Configuration
52-
~~~~~~~~~~~~~~~~~~~~~~~~~
50+
App Services Configuration
51+
~~~~~~~~~~~~~~~~~~~~~~~~~~
5352

5453
Device Sync is configured with the following queryable fields:
5554

56-
- ``_id`` (this is a queryable field in every Device Sync configuration)
55+
- ``_id`` (always included)
56+
- ``miles``
5757
- ``ownerId``
58-
- ``complexity``
5958

60-
Device Sync has permissions configured to let users read and write only their own
59+
The App Services App has permissions configured to let users read and write only their own
6160
data:
6261

6362
.. code-block:: json
6463

6564
{
66-
"rules": {},
67-
"defaultRoles": [
68-
{
69-
"name": "owner-read-write",
70-
"applyWhen": {},
71-
"read": {
72-
"ownerId": "%%user.id"
73-
},
74-
"write": {
75-
"ownerId": "%%user.id"
76-
}
77-
}
78-
]
65+
"name": "owner-read-write",
66+
"apply_when": {},
67+
"document_filters": {
68+
"read": { "ownerId": "%%user.id" },
69+
"write": { "ownerId": "%%user.id" }
70+
},
71+
"read": true,
72+
"write": true
7973
}
8074

8175
Client Data Model and Configuration
@@ -96,8 +90,8 @@ is less than or equal to ``4``:
9690
What Data Syncs?
9791
~~~~~~~~~~~~~~~~
9892

99-
The subscription query combined with the Device Sync permissions mean
100-
that the synced realm only syncs objects where:
93+
The subscription query combined with the permissions mean that the synced realm
94+
only syncs objects where:
10195

10296
- The ``ownerId`` matches the ``user.id`` of the logged-in user (from the permissions)
10397
- The ``complexity`` property's value is less than or equal to ``4`` (from the subscription query)
@@ -124,11 +118,11 @@ Writes to Flexible Sync realms may broadly fall into one of two categories:
124118
Successful Writes
125119
~~~~~~~~~~~~~~~~~
126120

127-
When the write matches both the :ref:`Device Sync permissions <sync-rules>`
128-
and the :ref:`Flexible Sync subscription query
129-
<swift-manage-flexible-sync-subscriptions>` in the client, the Realm Swift SDK
130-
can successfully write the object to the synced realm. This object syncs
131-
with the App Services backend when the device has a network connection.
121+
When the write matches both the :ref:`permissions <permissions>` and the
122+
:ref:`Flexible Sync subscription query
123+
<swift-manage-flexible-sync-subscriptions>` in the client, the Realm Swift SDK
124+
can successfully write the object to the synced realm. This object syncs with
125+
the App Services backend when the device has a network connection.
132126

133127
.. literalinclude:: /examples/generated/code/start/SyncedRealmCRUD.snippet.successful-write.swift
134128
:language: swift

0 commit comments

Comments
 (0)