@3xweb/strapi-plugin-owner-permissions 0.1.0 → 0.1.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 CHANGED
@@ -16,7 +16,7 @@ From your Strapi project, install the package from npm:
16
16
  npm install @3xweb/strapi-plugin-owner-permissions
17
17
  ```
18
18
 
19
- Enable the plugin in `config/plugins.js`:
19
+ In a JavaScript project, enable the plugin in `config/plugins.js`:
20
20
 
21
21
  ```js
22
22
  module.exports = {
@@ -24,6 +24,14 @@ module.exports = {
24
24
  };
25
25
  ```
26
26
 
27
+ In a TypeScript project, use `config/plugins.ts`:
28
+
29
+ ```ts
30
+ export default {
31
+ 'owner-permissions': { enabled: true },
32
+ };
33
+ ```
34
+
27
35
  Ownership settings are stored in the database and edited from the Roles page.
28
36
 
29
37
  The native role editor in Users & Permissions 5.62.0 has no injection zone. Add
@@ -36,6 +44,14 @@ const { withOwnerPermissionsRoleEditor } = require('@3xweb/strapi-plugin-owner-p
36
44
  module.exports = withOwnerPermissionsRoleEditor;
37
45
  ```
38
46
 
47
+ For TypeScript, use `src/admin/vite.config.ts` instead:
48
+
49
+ ```ts
50
+ import { withOwnerPermissionsRoleEditor } from '@3xweb/strapi-plugin-owner-permissions/admin-patch';
51
+
52
+ export default withOwnerPermissionsRoleEditor;
53
+ ```
54
+
39
55
  If you already customize the Vite config, pass your final config object to
40
56
  `withOwnerPermissionsRoleEditor`. Use matching Strapi and Users & Permissions versions from **5.49.0 to <6**.
41
57
  The admin integration checks the upstream Roles panel before building and
@@ -78,12 +94,12 @@ many-to-one relation to a Users & Permissions user.
78
94
  that identifies the owner. All restricted actions for that role and
79
95
  collection use the same field.
80
96
 
81
- ![Update with Only own records enabled and owner shown as the owner field](docs/images/owner-permissions-update.jpg)
97
+ ![Update with Only own records enabled and owner shown as the owner field](https://cdn.jsdelivr.net/npm/@3xweb/strapi-plugin-owner-permissions@0.1.0/docs/images/owner-permissions-update.jpg)
82
98
 
83
99
  A different action in the same collection can keep native access. In this
84
100
  example, **Find** is enabled for the role and **Only own records** is off.
85
101
 
86
- ![Find with the native permission enabled and Only own records off](docs/images/owner-permissions-find.jpg)
102
+ ![Find with the native permission enabled and Only own records off](https://cdn.jsdelivr.net/npm/@3xweb/strapi-plugin-owner-permissions@0.1.0/docs/images/owner-permissions-find.jpg)
87
103
 
88
104
  Ownership is configured per role, collection, and core action. Actions with
89
105
  **Only own records** enabled are limited to the caller's records. Other actions
@@ -0,0 +1,4 @@
1
+ import type { UserConfig } from 'vite' with { 'resolution-mode': 'import' };
2
+
3
+ /** Adds the Owner Permissions controls to the native Strapi Roles editor. */
4
+ export function withOwnerPermissionsRoleEditor(config: UserConfig): UserConfig;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.0",
2
+ "version": "0.1.1",
3
3
  "keywords": [
4
4
  "strapi",
5
5
  "strapi-plugin",
@@ -10,11 +10,15 @@
10
10
  "exports": {
11
11
  "./package.json": "./package.json",
12
12
  "./strapi-server": "./strapi-server.js",
13
- "./admin-patch": "./admin-patch/index.cjs"
13
+ "./admin-patch": {
14
+ "types": "./admin-patch/index.d.cts",
15
+ "default": "./admin-patch/index.cjs"
16
+ }
14
17
  },
15
18
  "files": [
16
19
  "strapi-server.js",
17
20
  "admin-patch/index.cjs",
21
+ "admin-patch/index.d.cts",
18
22
  "admin-patch/OwnerRules.cjs",
19
23
  "docs/images"
20
24
  ],
@@ -54,7 +58,8 @@
54
58
  "react-dom": "^18.3.1",
55
59
  "react-intl": "^6.8.9",
56
60
  "react-router-dom": "^6.30.4",
57
- "styled-components": "^6.4.3"
61
+ "styled-components": "^6.4.3",
62
+ "vite": "^5.4.0 || ^6.0.0"
58
63
  },
59
64
  "strapi": {
60
65
  "kind": "plugin",