@3xweb/strapi-plugin-owner-permissions 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
# Owner Permissions for Strapi 5
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
Owner Permissions limits access to user-generated content on the Strapi REST
|
|
4
|
+
Content API. The plugin can identify the owner in two ways:
|
|
5
|
+
|
|
6
|
+
- **Direct ownership** (`ownerPath: 'owner'`). A record links directly to
|
|
7
|
+
the user who owns it.
|
|
8
|
+
- **Ownership through a parent** (`ownerPath: 'parent.owner'`). A child
|
|
9
|
+
record links to a parent record. The plugin follows that link and uses
|
|
10
|
+
the parent's owner to decide who can access the child.
|
|
11
|
+
|
|
12
|
+
Configure the ownership path in the backend for each collection. Then open
|
|
13
|
+
**Settings → Users & Permissions → Roles** and enable the native permission
|
|
14
|
+
for the action. On the same page, click the gear next to that action, enable
|
|
15
|
+
**Only own records** in **Advanced settings**, and save the ownership rules.
|
|
16
|
+
The backend also defines which related details the API may return with
|
|
17
|
+
`populate`, such as a parent's list of child records. See
|
|
18
|
+
[Opt-in collection profiles](#opt-in-collection-profiles) for a complete example.
|
|
10
19
|
|
|
11
20
|
## Installation
|
|
12
21
|
|
|
@@ -146,13 +155,13 @@ profile under `config.collections`:
|
|
|
146
155
|
enabled: true,
|
|
147
156
|
config: {
|
|
148
157
|
collections: {
|
|
149
|
-
'api::
|
|
158
|
+
'api::parent.parent': {
|
|
150
159
|
ownerPath: 'owner',
|
|
151
|
-
populate: {
|
|
160
|
+
populate: { children: true },
|
|
152
161
|
},
|
|
153
|
-
'api::
|
|
154
|
-
ownerPath: '
|
|
155
|
-
populate: {
|
|
162
|
+
'api::child.child': {
|
|
163
|
+
ownerPath: 'parent.owner',
|
|
164
|
+
populate: { parent: true },
|
|
156
165
|
},
|
|
157
166
|
},
|
|
158
167
|
},
|
package/package.json
CHANGED