@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.
Files changed (2) hide show
  1. package/README.md +21 -12
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,12 +1,21 @@
1
1
  # Owner Permissions for Strapi 5
2
2
 
3
- Limit user-generated content to its owner on the Strapi REST Content API.
4
- Enable standard actions in **Settings → Users & Permissions → Roles**. On the
5
- same role edit page, expand an eligible collection and click the gear next to
6
- an action. In the **Advanced settings** pane, enable **Only own records** and
7
- save the ownership rules. The owner field identifies the stored relationship
8
- between each record and its owner. Enable the native action permission as well
9
- for users with that role to use the route.
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::plan.plan': {
158
+ 'api::parent.parent': {
150
159
  ownerPath: 'owner',
151
- populate: { image: true, parts: { exercise: true }, logs: true },
160
+ populate: { children: true },
152
161
  },
153
- 'api::log.log': {
154
- ownerPath: 'plan.owner',
155
- populate: { plan: true },
162
+ 'api::child.child': {
163
+ ownerPath: 'parent.owner',
164
+ populate: { parent: true },
156
165
  },
157
166
  },
158
167
  },
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.2.0",
2
+ "version": "0.2.1",
3
3
  "keywords": [
4
4
  "strapi",
5
5
  "strapi-plugin",