@strapi/plugin-users-permissions 0.0.0-next.e9bb5ccdc459f4c6b6717a2d5d86359b7a47d47d → 0.0.0-next.eba25ec571b091c6bde1104eb6c753debdf15462
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/.eslintignore +1 -2
- package/.eslintrc +17 -0
- package/LICENSE +18 -3
- package/admin/src/components/BoundRoute/{index.js → index.jsx} +6 -4
- package/admin/src/components/FormModal/Input/{index.js → index.jsx} +37 -33
- package/admin/src/components/FormModal/index.jsx +115 -0
- package/admin/src/components/Permissions/PermissionRow/{CheckboxWrapper.js → CheckboxWrapper.jsx} +4 -3
- package/admin/src/components/Permissions/PermissionRow/{SubCategory.js → SubCategory.jsx} +27 -15
- package/admin/src/components/Permissions/PermissionRow/{index.js → index.jsx} +4 -2
- package/admin/src/components/Permissions/index.jsx +47 -0
- package/admin/src/components/Permissions/reducer.js +1 -1
- package/admin/src/components/Policies/{index.js → index.jsx} +9 -6
- package/admin/src/components/UsersPermissions/{index.js → index.jsx} +22 -11
- package/admin/src/components/UsersPermissions/reducer.js +1 -1
- package/admin/src/{permissions.js → constants.js} +1 -3
- package/admin/src/contexts/UsersPermissionsContext/{index.js → index.jsx} +1 -0
- package/admin/src/index.js +25 -51
- package/admin/src/pages/AdvancedSettings/index.jsx +214 -0
- package/admin/src/pages/AdvancedSettings/utils/layout.js +20 -35
- package/admin/src/pages/AdvancedSettings/utils/schema.js +5 -2
- package/admin/src/pages/EmailTemplates/components/EmailForm.jsx +156 -0
- package/admin/src/pages/EmailTemplates/components/{EmailTable.js → EmailTable.jsx} +27 -22
- package/admin/src/pages/EmailTemplates/index.jsx +148 -0
- package/admin/src/pages/EmailTemplates/utils/schema.js +18 -6
- package/admin/src/pages/Providers/index.jsx +262 -0
- package/admin/src/pages/Providers/utils/forms.js +23 -11
- package/admin/src/pages/Roles/constants.js +7 -0
- package/admin/src/pages/Roles/hooks/usePlugins.js +78 -0
- package/admin/src/pages/Roles/index.jsx +24 -0
- package/admin/src/pages/Roles/pages/CreatePage.jsx +194 -0
- package/admin/src/pages/Roles/pages/EditPage.jsx +215 -0
- package/admin/src/pages/Roles/pages/ListPage/components/TableBody.jsx +119 -0
- package/admin/src/pages/Roles/{ListPage/index.js → pages/ListPage/index.jsx} +108 -83
- package/admin/src/translations/en.json +1 -1
- package/admin/src/translations/zh-Hans.json +80 -80
- package/admin/src/utils/index.js +1 -2
- package/admin/src/utils/prefixPluginTranslations.js +13 -0
- package/dist/_chunks/ar-BguGUqwK.js +44 -0
- package/dist/_chunks/ar-BguGUqwK.js.map +1 -0
- package/dist/_chunks/ar-CK8BRRXB.mjs +44 -0
- package/dist/_chunks/ar-CK8BRRXB.mjs.map +1 -0
- package/dist/_chunks/cs-BVigMk0l.mjs +50 -0
- package/dist/_chunks/cs-BVigMk0l.mjs.map +1 -0
- package/dist/_chunks/cs-BW8-K_GY.js +50 -0
- package/dist/_chunks/cs-BW8-K_GY.js.map +1 -0
- package/dist/_chunks/de-BKUdRFI4.mjs +62 -0
- package/dist/_chunks/de-BKUdRFI4.mjs.map +1 -0
- package/dist/_chunks/de-owXpVluI.js +62 -0
- package/dist/_chunks/de-owXpVluI.js.map +1 -0
- package/dist/_chunks/dk-BQiTK50l.mjs +86 -0
- package/dist/_chunks/dk-BQiTK50l.mjs.map +1 -0
- package/dist/_chunks/dk-LXAnbuBk.js +86 -0
- package/dist/_chunks/dk-LXAnbuBk.js.map +1 -0
- package/dist/_chunks/en-DOHtPf-2.mjs +86 -0
- package/dist/_chunks/en-DOHtPf-2.mjs.map +1 -0
- package/dist/_chunks/en-MHo5mcsU.js +86 -0
- package/dist/_chunks/en-MHo5mcsU.js.map +1 -0
- package/dist/_chunks/es-BwLCLXAQ.js +86 -0
- package/dist/_chunks/es-BwLCLXAQ.js.map +1 -0
- package/dist/_chunks/es-DNgOVMjD.mjs +86 -0
- package/dist/_chunks/es-DNgOVMjD.mjs.map +1 -0
- package/dist/_chunks/fr-DkgRugiU.mjs +50 -0
- package/dist/_chunks/fr-DkgRugiU.mjs.map +1 -0
- package/dist/_chunks/fr-DkhpSjjm.js +50 -0
- package/dist/_chunks/fr-DkhpSjjm.js.map +1 -0
- package/dist/_chunks/id-BTemOeTZ.js +62 -0
- package/dist/_chunks/id-BTemOeTZ.js.map +1 -0
- package/dist/_chunks/id-BdEsvnaF.mjs +62 -0
- package/dist/_chunks/id-BdEsvnaF.mjs.map +1 -0
- package/dist/_chunks/index-B31GwOBY.js +1172 -0
- package/dist/_chunks/index-B31GwOBY.js.map +1 -0
- package/dist/_chunks/index-BnX71_B4-BeiPUoDw.mjs +12005 -0
- package/dist/_chunks/index-BnX71_B4-BeiPUoDw.mjs.map +1 -0
- package/dist/_chunks/index-BnX71_B4-BwTVUy-u.js +12029 -0
- package/dist/_chunks/index-BnX71_B4-BwTVUy-u.js.map +1 -0
- package/dist/_chunks/index-Bzdgm3YY.js +247 -0
- package/dist/_chunks/index-Bzdgm3YY.js.map +1 -0
- package/dist/_chunks/index-CH7DTQRg.js +281 -0
- package/dist/_chunks/index-CH7DTQRg.js.map +1 -0
- package/dist/_chunks/index-DQjBkqk6.mjs +1142 -0
- package/dist/_chunks/index-DQjBkqk6.mjs.map +1 -0
- package/dist/_chunks/index-DS3khL98.js +366 -0
- package/dist/_chunks/index-DS3khL98.js.map +1 -0
- package/dist/_chunks/index-Dby0-3V3.mjs +248 -0
- package/dist/_chunks/index-Dby0-3V3.mjs.map +1 -0
- package/dist/_chunks/index-DkLfQU9x.js +640 -0
- package/dist/_chunks/index-DkLfQU9x.js.map +1 -0
- package/dist/_chunks/index-YiI4HHBF.mjs +262 -0
- package/dist/_chunks/index-YiI4HHBF.mjs.map +1 -0
- package/dist/_chunks/index-og30lh2q.mjs +617 -0
- package/dist/_chunks/index-og30lh2q.mjs.map +1 -0
- package/dist/_chunks/index-rj9z5xOr.mjs +344 -0
- package/dist/_chunks/index-rj9z5xOr.mjs.map +1 -0
- package/dist/_chunks/it-B-rv0E24.mjs +62 -0
- package/dist/_chunks/it-B-rv0E24.mjs.map +1 -0
- package/dist/_chunks/it-D1rH6V6_.js +62 -0
- package/dist/_chunks/it-D1rH6V6_.js.map +1 -0
- package/dist/_chunks/ja-C8K-VBPD.mjs +48 -0
- package/dist/_chunks/ja-C8K-VBPD.mjs.map +1 -0
- package/dist/_chunks/ja-DqShgTMf.js +48 -0
- package/dist/_chunks/ja-DqShgTMf.js.map +1 -0
- package/dist/_chunks/ko-B9DGEPWH.js +86 -0
- package/dist/_chunks/ko-B9DGEPWH.js.map +1 -0
- package/dist/_chunks/ko-Busb0wIY.mjs +86 -0
- package/dist/_chunks/ko-Busb0wIY.mjs.map +1 -0
- package/dist/_chunks/ms-ByvsQjRt.mjs +49 -0
- package/dist/_chunks/ms-ByvsQjRt.mjs.map +1 -0
- package/dist/_chunks/ms-CPBU3LWf.js +49 -0
- package/dist/_chunks/ms-CPBU3LWf.js.map +1 -0
- package/dist/_chunks/nl-5qO8Rpcy.mjs +48 -0
- package/dist/_chunks/nl-5qO8Rpcy.mjs.map +1 -0
- package/dist/_chunks/nl-CwNB6YoO.js +48 -0
- package/dist/_chunks/nl-CwNB6YoO.js.map +1 -0
- package/dist/_chunks/pl-BdIzifBE.mjs +86 -0
- package/dist/_chunks/pl-BdIzifBE.mjs.map +1 -0
- package/dist/_chunks/pl-Do9UD69f.js +86 -0
- package/dist/_chunks/pl-Do9UD69f.js.map +1 -0
- package/dist/_chunks/pt-BIO24ioG.mjs +48 -0
- package/dist/_chunks/pt-BIO24ioG.mjs.map +1 -0
- package/dist/_chunks/pt-BR-D7dZhxuP.js +44 -0
- package/dist/_chunks/pt-BR-D7dZhxuP.js.map +1 -0
- package/dist/_chunks/pt-BR-f0p23AQZ.mjs +44 -0
- package/dist/_chunks/pt-BR-f0p23AQZ.mjs.map +1 -0
- package/dist/_chunks/pt-fdvyOnUp.js +48 -0
- package/dist/_chunks/pt-fdvyOnUp.js.map +1 -0
- package/dist/_chunks/ru-C94rjPGA.js +86 -0
- package/dist/_chunks/ru-C94rjPGA.js.map +1 -0
- package/dist/_chunks/ru-VWy-IB7K.mjs +86 -0
- package/dist/_chunks/ru-VWy-IB7K.mjs.map +1 -0
- package/dist/_chunks/sk-BABEhykl.js +50 -0
- package/dist/_chunks/sk-BABEhykl.js.map +1 -0
- package/dist/_chunks/sk-B_LIcepm.mjs +50 -0
- package/dist/_chunks/sk-B_LIcepm.mjs.map +1 -0
- package/dist/_chunks/sv-ABLKOokl.mjs +86 -0
- package/dist/_chunks/sv-ABLKOokl.mjs.map +1 -0
- package/dist/_chunks/sv-Be43LhA9.js +86 -0
- package/dist/_chunks/sv-Be43LhA9.js.map +1 -0
- package/dist/_chunks/th-DKyP7ueR.mjs +60 -0
- package/dist/_chunks/th-DKyP7ueR.mjs.map +1 -0
- package/dist/_chunks/th-DgVhVLhL.js +60 -0
- package/dist/_chunks/th-DgVhVLhL.js.map +1 -0
- package/dist/_chunks/tr-B_idhkEs.js +85 -0
- package/dist/_chunks/tr-B_idhkEs.js.map +1 -0
- package/dist/_chunks/tr-qa1Q5UjC.mjs +85 -0
- package/dist/_chunks/tr-qa1Q5UjC.mjs.map +1 -0
- package/dist/_chunks/uk-BmRqbeQc.mjs +49 -0
- package/dist/_chunks/uk-BmRqbeQc.mjs.map +1 -0
- package/dist/_chunks/uk-LHOivnhP.js +49 -0
- package/dist/_chunks/uk-LHOivnhP.js.map +1 -0
- package/dist/_chunks/vi-CdVRdKDw.js +50 -0
- package/dist/_chunks/vi-CdVRdKDw.js.map +1 -0
- package/dist/_chunks/vi-HW-EdMea.mjs +50 -0
- package/dist/_chunks/vi-HW-EdMea.mjs.map +1 -0
- package/dist/_chunks/zh-5hKkVPA4.mjs +86 -0
- package/dist/_chunks/zh-5hKkVPA4.mjs.map +1 -0
- package/dist/_chunks/zh-Cuq8gMnF.js +86 -0
- package/dist/_chunks/zh-Cuq8gMnF.js.map +1 -0
- package/dist/_chunks/zh-Hans-BHilK-yc.mjs +86 -0
- package/dist/_chunks/zh-Hans-BHilK-yc.mjs.map +1 -0
- package/dist/_chunks/zh-Hans-GQDMKtY4.js +86 -0
- package/dist/_chunks/zh-Hans-GQDMKtY4.js.map +1 -0
- package/dist/admin/index.js +4 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/admin/index.mjs +5 -0
- package/dist/admin/index.mjs.map +1 -0
- package/documentation/content-api.yaml +1 -1
- package/jest.config.front.js +1 -0
- package/package.json +51 -35
- package/packup.config.ts +22 -0
- package/server/bootstrap/index.js +18 -15
- package/server/bootstrap/users-permissions-actions.js +6 -0
- package/server/config.js +29 -0
- package/server/content-types/user/index.js +0 -1
- package/server/controllers/auth.js +74 -38
- package/server/controllers/content-manager-user.js +28 -30
- package/server/controllers/role.js +17 -4
- package/server/controllers/user.js +18 -8
- package/server/controllers/validation/auth.js +81 -25
- package/server/graphql/types/index.js +1 -0
- package/server/graphql/types/user-input.js +20 -0
- package/server/middlewares/rateLimit.js +41 -21
- package/server/register.js +1 -1
- package/server/services/jwt.js +3 -3
- package/server/services/permission.js +3 -7
- package/server/services/providers-registry.js +469 -261
- package/server/services/providers.js +10 -5
- package/server/services/role.js +15 -13
- package/server/services/user.js +56 -19
- package/server/services/users-permissions.js +15 -13
- package/server/strategies/users-permissions.js +1 -8
- package/server/utils/index.d.ts +2 -1
- package/server/utils/sanitize/sanitizers.js +7 -3
- package/server/utils/sanitize/visitors/remove-user-relation-from-role-entities.js +2 -2
- package/.eslintrc.js +0 -14
- package/admin/src/components/FormModal/index.js +0 -123
- package/admin/src/components/Permissions/index.js +0 -54
- package/admin/src/hooks/index.js +0 -5
- package/admin/src/hooks/useFetchRole/index.js +0 -64
- package/admin/src/hooks/useFetchRole/reducer.js +0 -31
- package/admin/src/hooks/useForm/index.js +0 -67
- package/admin/src/hooks/useForm/reducer.js +0 -40
- package/admin/src/hooks/usePlugins/index.js +0 -67
- package/admin/src/hooks/usePlugins/init.js +0 -5
- package/admin/src/hooks/usePlugins/reducer.js +0 -34
- package/admin/src/hooks/useRolesList/index.js +0 -62
- package/admin/src/hooks/useRolesList/init.js +0 -5
- package/admin/src/hooks/useRolesList/reducer.js +0 -31
- package/admin/src/pages/AdvancedSettings/index.js +0 -243
- package/admin/src/pages/AdvancedSettings/utils/api.js +0 -17
- package/admin/src/pages/EmailTemplates/components/EmailForm.js +0 -175
- package/admin/src/pages/EmailTemplates/index.js +0 -160
- package/admin/src/pages/EmailTemplates/utils/api.js +0 -17
- package/admin/src/pages/Providers/index.js +0 -272
- package/admin/src/pages/Providers/reducer.js +0 -54
- package/admin/src/pages/Providers/utils/api.js +0 -25
- package/admin/src/pages/Providers/utils/createProvidersArray.js +0 -21
- package/admin/src/pages/Roles/CreatePage/index.js +0 -182
- package/admin/src/pages/Roles/CreatePage/utils/schema.js +0 -9
- package/admin/src/pages/Roles/EditPage/index.js +0 -194
- package/admin/src/pages/Roles/EditPage/utils/schema.js +0 -9
- package/admin/src/pages/Roles/ListPage/components/TableBody.js +0 -92
- package/admin/src/pages/Roles/ListPage/utils/api.js +0 -31
- package/admin/src/pages/Roles/ProtectedCreatePage/index.js +0 -12
- package/admin/src/pages/Roles/ProtectedEditPage/index.js +0 -12
- package/admin/src/pages/Roles/ProtectedListPage/index.js +0 -15
- package/admin/src/pages/Roles/index.js +0 -27
- package/admin/src/utils/getRequestURL.js +0 -5
- package/server/bootstrap/grant-config.js +0 -131
- package/strapi-admin.js +0 -3
- package/strapi-server.js +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/plugin-users-permissions",
|
|
3
|
-
"version": "0.0.0-next.
|
|
3
|
+
"version": "0.0.0-next.eba25ec571b091c6bde1104eb6c753debdf15462",
|
|
4
4
|
"description": "Protect your API with a full-authentication process based on JWT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,58 +19,74 @@
|
|
|
19
19
|
"url": "https://strapi.io"
|
|
20
20
|
}
|
|
21
21
|
],
|
|
22
|
+
"exports": {
|
|
23
|
+
"./strapi-admin": {
|
|
24
|
+
"source": "./admin/src/index.js",
|
|
25
|
+
"import": "./dist/admin/index.mjs",
|
|
26
|
+
"require": "./dist/admin/index.js",
|
|
27
|
+
"default": "./dist/admin/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./strapi-server": {
|
|
30
|
+
"source": "./server/index.js",
|
|
31
|
+
"require": "./server/index.js",
|
|
32
|
+
"default": "./server/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./package.json": "./package.json"
|
|
35
|
+
},
|
|
22
36
|
"scripts": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
37
|
+
"build": "pack-up build",
|
|
38
|
+
"clean": "run -T rimraf dist",
|
|
39
|
+
"lint": "run -T eslint .",
|
|
25
40
|
"test:front": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js",
|
|
26
|
-
"test:front:watch": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js --watchAll",
|
|
27
41
|
"test:front:ce": "run -T cross-env IS_EE=false jest --config ./jest.config.front.js",
|
|
42
|
+
"test:front:watch": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js --watchAll",
|
|
28
43
|
"test:front:watch:ce": "run -T cross-env IS_EE=false jest --config ./jest.config.front.js --watchAll",
|
|
29
|
-
"
|
|
44
|
+
"test:unit": "run -T jest",
|
|
45
|
+
"test:unit:watch": "run -T jest --watch",
|
|
46
|
+
"watch": "pack-up watch"
|
|
30
47
|
},
|
|
31
48
|
"dependencies": {
|
|
32
|
-
"@strapi/design-system": "
|
|
33
|
-
"@strapi/
|
|
34
|
-
"@strapi/
|
|
35
|
-
"@strapi/utils": "0.0.0-next.e9bb5ccdc459f4c6b6717a2d5d86359b7a47d47d",
|
|
49
|
+
"@strapi/design-system": "2.0.0-rc.13",
|
|
50
|
+
"@strapi/icons": "2.0.0-rc.13",
|
|
51
|
+
"@strapi/utils": "0.0.0-next.eba25ec571b091c6bde1104eb6c753debdf15462",
|
|
36
52
|
"bcryptjs": "2.4.3",
|
|
37
|
-
"formik": "2.
|
|
53
|
+
"formik": "2.4.5",
|
|
38
54
|
"grant-koa": "5.4.8",
|
|
39
|
-
"immer": "9.0.
|
|
55
|
+
"immer": "9.0.21",
|
|
40
56
|
"jsonwebtoken": "9.0.0",
|
|
41
57
|
"jwk-to-pem": "2.0.5",
|
|
42
|
-
"koa": "
|
|
43
|
-
"koa2-ratelimit": "^1.1.
|
|
58
|
+
"koa": "2.15.2",
|
|
59
|
+
"koa2-ratelimit": "^1.1.3",
|
|
44
60
|
"lodash": "4.17.21",
|
|
45
|
-
"prop-types": "^15.
|
|
61
|
+
"prop-types": "^15.8.1",
|
|
46
62
|
"purest": "4.0.2",
|
|
47
|
-
"react-intl": "6.
|
|
48
|
-
"react-query": "3.
|
|
49
|
-
"react-redux": "8.
|
|
63
|
+
"react-intl": "6.6.2",
|
|
64
|
+
"react-query": "3.39.3",
|
|
65
|
+
"react-redux": "8.1.3",
|
|
50
66
|
"url-join": "4.0.1",
|
|
51
|
-
"yup": "
|
|
67
|
+
"yup": "0.32.9"
|
|
52
68
|
},
|
|
53
69
|
"devDependencies": {
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"@testing-library/
|
|
57
|
-
"@testing-library/
|
|
58
|
-
"
|
|
59
|
-
"msw": "1.
|
|
60
|
-
"react": "
|
|
61
|
-
"react-dom": "
|
|
62
|
-
"react-router-dom": "
|
|
63
|
-
"
|
|
64
|
-
"styled-components": "5.3.3"
|
|
70
|
+
"@strapi/pack-up": "5.0.0",
|
|
71
|
+
"@strapi/strapi": "0.0.0-next.eba25ec571b091c6bde1104eb6c753debdf15462",
|
|
72
|
+
"@testing-library/dom": "10.1.0",
|
|
73
|
+
"@testing-library/react": "15.0.7",
|
|
74
|
+
"@testing-library/user-event": "14.5.2",
|
|
75
|
+
"msw": "1.3.0",
|
|
76
|
+
"react": "18.3.1",
|
|
77
|
+
"react-dom": "18.3.1",
|
|
78
|
+
"react-router-dom": "6.22.3",
|
|
79
|
+
"styled-components": "6.1.8"
|
|
65
80
|
},
|
|
66
81
|
"peerDependencies": {
|
|
67
|
-
"
|
|
68
|
-
"react
|
|
69
|
-
"react-
|
|
70
|
-
"
|
|
82
|
+
"@strapi/strapi": "^5.0.0",
|
|
83
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
84
|
+
"react-dom": "^17.0.0 || ^18.0.0",
|
|
85
|
+
"react-router-dom": "^6.0.0",
|
|
86
|
+
"styled-components": "^6.0.0"
|
|
71
87
|
},
|
|
72
88
|
"engines": {
|
|
73
|
-
"node": ">=
|
|
89
|
+
"node": ">=18.0.0 <=22.x.x",
|
|
74
90
|
"npm": ">=6.0.0"
|
|
75
91
|
},
|
|
76
92
|
"strapi": {
|
|
@@ -80,5 +96,5 @@
|
|
|
80
96
|
"required": true,
|
|
81
97
|
"kind": "plugin"
|
|
82
98
|
},
|
|
83
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "eba25ec571b091c6bde1104eb6c753debdf15462"
|
|
84
100
|
}
|
package/packup.config.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Config, defineConfig } from '@strapi/pack-up';
|
|
2
|
+
import { transformWithEsbuild } from 'vite';
|
|
3
|
+
|
|
4
|
+
const config: Config = defineConfig({
|
|
5
|
+
bundles: [
|
|
6
|
+
{
|
|
7
|
+
source: './admin/src/index.js',
|
|
8
|
+
import: './dist/admin/index.mjs',
|
|
9
|
+
require: './dist/admin/index.js',
|
|
10
|
+
runtime: 'web',
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
dist: './dist',
|
|
14
|
+
/**
|
|
15
|
+
* Because we're exporting a server & client package
|
|
16
|
+
* which have different runtimes we want to ignore
|
|
17
|
+
* what they look like in the package.json
|
|
18
|
+
*/
|
|
19
|
+
exports: {},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export default config;
|
|
@@ -9,23 +9,26 @@
|
|
|
9
9
|
*/
|
|
10
10
|
const crypto = require('crypto');
|
|
11
11
|
const _ = require('lodash');
|
|
12
|
-
const urljoin = require('url-join');
|
|
13
12
|
const { getService } = require('../utils');
|
|
14
|
-
const getGrantConfig = require('./grant-config');
|
|
15
|
-
|
|
16
13
|
const usersPermissionsActions = require('./users-permissions-actions');
|
|
17
14
|
|
|
18
15
|
const initGrant = async (pluginStore) => {
|
|
19
|
-
const
|
|
20
|
-
|
|
16
|
+
const allProviders = getService('providers-registry').getAll();
|
|
17
|
+
|
|
18
|
+
const grantConfig = Object.entries(allProviders).reduce((acc, [name, provider]) => {
|
|
19
|
+
const { icon, enabled, grantConfig } = provider;
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
acc[name] = {
|
|
22
|
+
icon,
|
|
23
|
+
enabled,
|
|
24
|
+
...grantConfig,
|
|
25
|
+
};
|
|
26
|
+
return acc;
|
|
27
|
+
}, {});
|
|
23
28
|
|
|
24
29
|
const prevGrantConfig = (await pluginStore.get({ key: 'grant' })) || {};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// or we have added/deleted provider here.
|
|
28
|
-
if (!prevGrantConfig || !_.isEqual(_.keys(prevGrantConfig), _.keys(grantConfig))) {
|
|
30
|
+
|
|
31
|
+
if (!prevGrantConfig || !_.isEqual(prevGrantConfig, grantConfig)) {
|
|
29
32
|
// merge with the previous provider config.
|
|
30
33
|
_.keys(grantConfig).forEach((key) => {
|
|
31
34
|
if (key in prevGrantConfig) {
|
|
@@ -104,13 +107,13 @@ module.exports = async ({ strapi }) => {
|
|
|
104
107
|
await initEmails(pluginStore);
|
|
105
108
|
await initAdvancedOptions(pluginStore);
|
|
106
109
|
|
|
107
|
-
await strapi
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
await strapi
|
|
111
|
+
.service('admin::permission')
|
|
112
|
+
.actionProvider.registerMany(usersPermissionsActions.actions);
|
|
110
113
|
|
|
111
114
|
await getService('users-permissions').initialize();
|
|
112
115
|
|
|
113
|
-
if (!strapi.config.get('plugin
|
|
116
|
+
if (!strapi.config.get('plugin::users-permissions.jwtSecret')) {
|
|
114
117
|
if (process.env.NODE_ENV !== 'development') {
|
|
115
118
|
throw new Error(
|
|
116
119
|
`Missing jwtSecret. Please, set configuration variable "jwtSecret" for the users-permissions plugin in config/plugins.js (ex: you can generate one using Node with \`crypto.randomBytes(16).toString('base64')\`).
|
|
@@ -120,7 +123,7 @@ For security reasons, prefer storing the secret in an environment variable and r
|
|
|
120
123
|
|
|
121
124
|
const jwtSecret = crypto.randomBytes(16).toString('base64');
|
|
122
125
|
|
|
123
|
-
strapi.config.set('plugin
|
|
126
|
+
strapi.config.set('plugin::users-permissions.jwtSecret', jwtSecret);
|
|
124
127
|
|
|
125
128
|
if (!process.env.JWT_SECRET) {
|
|
126
129
|
const envPath = process.env.ENV_PATH || '.env';
|
|
@@ -16,6 +16,12 @@ module.exports = {
|
|
|
16
16
|
uid: 'roles.read',
|
|
17
17
|
subCategory: 'roles',
|
|
18
18
|
pluginName: 'users-permissions',
|
|
19
|
+
aliases: [
|
|
20
|
+
{
|
|
21
|
+
actionId: 'plugin::content-manager.explorer.read',
|
|
22
|
+
subjects: ['plugin::users-permissions.role'],
|
|
23
|
+
},
|
|
24
|
+
],
|
|
19
25
|
},
|
|
20
26
|
{
|
|
21
27
|
section: 'plugins',
|
package/server/config.js
CHANGED
|
@@ -18,6 +18,35 @@ module.exports = {
|
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
|
+
callback: {
|
|
22
|
+
validate(callback, provider) {
|
|
23
|
+
let uCallback;
|
|
24
|
+
let uProviderCallback;
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
uCallback = new URL(callback);
|
|
28
|
+
uProviderCallback = new URL(provider.callback);
|
|
29
|
+
} catch {
|
|
30
|
+
throw new Error('The callback is not a valid URL');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Make sure the different origin matches
|
|
34
|
+
if (uCallback.origin !== uProviderCallback.origin) {
|
|
35
|
+
throw new Error(
|
|
36
|
+
`Forbidden callback provided: origins don't match. Please verify your config.`
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Make sure the different pathname matches
|
|
41
|
+
if (uCallback.pathname !== uProviderCallback.pathname) {
|
|
42
|
+
throw new Error(
|
|
43
|
+
`Forbidden callback provided: pathname don't match. Please verify your config.`
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// NOTE: We're not checking the search parameters on purpose to allow passing different states
|
|
48
|
+
},
|
|
49
|
+
},
|
|
21
50
|
}),
|
|
22
51
|
validator() {},
|
|
23
52
|
};
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
/* eslint-disable no-useless-escape */
|
|
10
10
|
const crypto = require('crypto');
|
|
11
11
|
const _ = require('lodash');
|
|
12
|
+
const { concat, compact, isArray } = require('lodash/fp');
|
|
12
13
|
const utils = require('@strapi/utils');
|
|
13
14
|
const { getService } = require('../utils');
|
|
14
15
|
const {
|
|
@@ -21,17 +22,16 @@ const {
|
|
|
21
22
|
validateChangePasswordBody,
|
|
22
23
|
} = require('./validation/auth');
|
|
23
24
|
|
|
24
|
-
const {
|
|
25
|
-
const { ApplicationError, ValidationError } = utils.errors;
|
|
25
|
+
const { ApplicationError, ValidationError, ForbiddenError } = utils.errors;
|
|
26
26
|
|
|
27
27
|
const sanitizeUser = (user, ctx) => {
|
|
28
28
|
const { auth } = ctx.state;
|
|
29
29
|
const userSchema = strapi.getModel('plugin::users-permissions.user');
|
|
30
30
|
|
|
31
|
-
return
|
|
31
|
+
return strapi.contentAPI.sanitize.output(user, userSchema, { auth });
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
module.exports = {
|
|
34
|
+
module.exports = ({ strapi }) => ({
|
|
35
35
|
async callback(ctx) {
|
|
36
36
|
const provider = ctx.params.provider || 'local';
|
|
37
37
|
const params = ctx.request.body;
|
|
@@ -51,7 +51,7 @@ module.exports = {
|
|
|
51
51
|
const { identifier } = params;
|
|
52
52
|
|
|
53
53
|
// Check if the user exists.
|
|
54
|
-
const user = await strapi.query('plugin::users-permissions.user').findOne({
|
|
54
|
+
const user = await strapi.db.query('plugin::users-permissions.user').findOne({
|
|
55
55
|
where: {
|
|
56
56
|
provider,
|
|
57
57
|
$or: [{ email: identifier.toLowerCase() }, { username: identifier }],
|
|
@@ -96,6 +96,10 @@ module.exports = {
|
|
|
96
96
|
try {
|
|
97
97
|
const user = await getService('providers').connect(provider, ctx.query);
|
|
98
98
|
|
|
99
|
+
if (user.blocked) {
|
|
100
|
+
throw new ForbiddenError('Your account has been blocked by an administrator');
|
|
101
|
+
}
|
|
102
|
+
|
|
99
103
|
return ctx.send({
|
|
100
104
|
jwt: getService('jwt').issue({ id: user.id }),
|
|
101
105
|
user: await sanitizeUser(user, ctx),
|
|
@@ -110,13 +114,17 @@ module.exports = {
|
|
|
110
114
|
throw new ApplicationError('You must be authenticated to reset your password');
|
|
111
115
|
}
|
|
112
116
|
|
|
113
|
-
const
|
|
117
|
+
const validations = strapi.config.get('plugin::users-permissions.validationRules');
|
|
114
118
|
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
119
|
+
const { currentPassword, password } = await validateChangePasswordBody(
|
|
120
|
+
ctx.request.body,
|
|
121
|
+
validations
|
|
118
122
|
);
|
|
119
123
|
|
|
124
|
+
const user = await strapi.db
|
|
125
|
+
.query('plugin::users-permissions.user')
|
|
126
|
+
.findOne({ where: { id: ctx.state.user.id } });
|
|
127
|
+
|
|
120
128
|
const validPassword = await getService('user').validatePassword(currentPassword, user.password);
|
|
121
129
|
|
|
122
130
|
if (!validPassword) {
|
|
@@ -136,15 +144,18 @@ module.exports = {
|
|
|
136
144
|
},
|
|
137
145
|
|
|
138
146
|
async resetPassword(ctx) {
|
|
147
|
+
const validations = strapi.config.get('plugin::users-permissions.validationRules');
|
|
148
|
+
|
|
139
149
|
const { password, passwordConfirmation, code } = await validateResetPasswordBody(
|
|
140
|
-
ctx.request.body
|
|
150
|
+
ctx.request.body,
|
|
151
|
+
validations
|
|
141
152
|
);
|
|
142
153
|
|
|
143
154
|
if (password !== passwordConfirmation) {
|
|
144
155
|
throw new ValidationError('Passwords do not match');
|
|
145
156
|
}
|
|
146
157
|
|
|
147
|
-
const user = await strapi
|
|
158
|
+
const user = await strapi.db
|
|
148
159
|
.query('plugin::users-permissions.user')
|
|
149
160
|
.findOne({ where: { resetPasswordToken: code } });
|
|
150
161
|
|
|
@@ -193,10 +204,28 @@ module.exports = {
|
|
|
193
204
|
}
|
|
194
205
|
|
|
195
206
|
// Ability to pass OAuth callback dynamically
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
207
|
+
const queryCustomCallback = _.get(ctx, 'query.callback');
|
|
208
|
+
const dynamicSessionCallback = _.get(ctx, 'session.grant.dynamic.callback');
|
|
209
|
+
|
|
210
|
+
const customCallback = queryCustomCallback ?? dynamicSessionCallback;
|
|
211
|
+
|
|
212
|
+
// The custom callback is validated to make sure it's not redirecting to an unwanted actor.
|
|
213
|
+
if (customCallback !== undefined) {
|
|
214
|
+
try {
|
|
215
|
+
// We're extracting the callback validator from the plugin config since it can be user-customized
|
|
216
|
+
const { validate: validateCallback } = strapi
|
|
217
|
+
.plugin('users-permissions')
|
|
218
|
+
.config('callback');
|
|
219
|
+
|
|
220
|
+
await validateCallback(customCallback, grantConfig[provider]);
|
|
221
|
+
|
|
222
|
+
grantConfig[provider].callback = customCallback;
|
|
223
|
+
} catch (e) {
|
|
224
|
+
throw new ValidationError('Invalid callback URL provided', { callback: customCallback });
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// Build a valid redirect URI for the current provider
|
|
200
229
|
grantConfig[provider].redirect_uri = getService('providers').buildRedirectUri(provider);
|
|
201
230
|
|
|
202
231
|
return grant(grantConfig)(ctx, next);
|
|
@@ -211,7 +240,7 @@ module.exports = {
|
|
|
211
240
|
const advancedSettings = await pluginStore.get({ key: 'advanced' });
|
|
212
241
|
|
|
213
242
|
// Find the user by email.
|
|
214
|
-
const user = await strapi
|
|
243
|
+
const user = await strapi.db
|
|
215
244
|
.query('plugin::users-permissions.user')
|
|
216
245
|
.findOne({ where: { email: email.toLowerCase() } });
|
|
217
246
|
|
|
@@ -229,8 +258,8 @@ module.exports = {
|
|
|
229
258
|
resetPasswordSettings.message,
|
|
230
259
|
{
|
|
231
260
|
URL: advancedSettings.email_reset_password,
|
|
232
|
-
SERVER_URL:
|
|
233
|
-
ADMIN_URL:
|
|
261
|
+
SERVER_URL: strapi.config.get('server.absoluteUrl'),
|
|
262
|
+
ADMIN_URL: strapi.config.get('admin.absoluteUrl'),
|
|
234
263
|
USER: userInfo,
|
|
235
264
|
TOKEN: resetPasswordToken,
|
|
236
265
|
}
|
|
@@ -273,26 +302,32 @@ module.exports = {
|
|
|
273
302
|
throw new ApplicationError('Register action is currently disabled');
|
|
274
303
|
}
|
|
275
304
|
|
|
305
|
+
const { register } = strapi.config.get('plugin::users-permissions');
|
|
306
|
+
const alwaysAllowedKeys = ['username', 'password', 'email'];
|
|
307
|
+
|
|
308
|
+
// Note that we intentionally do not filter allowedFields to allow a project to explicitly accept private or other Strapi field on registration
|
|
309
|
+
const allowedKeys = compact(
|
|
310
|
+
concat(alwaysAllowedKeys, isArray(register?.allowedFields) ? register.allowedFields : [])
|
|
311
|
+
);
|
|
312
|
+
|
|
313
|
+
// Check if there are any keys in requestBody that are not in allowedKeys
|
|
314
|
+
const invalidKeys = Object.keys(ctx.request.body).filter((key) => !allowedKeys.includes(key));
|
|
315
|
+
|
|
316
|
+
if (invalidKeys.length > 0) {
|
|
317
|
+
// If there are invalid keys, throw an error
|
|
318
|
+
throw new ValidationError(`Invalid parameters: ${invalidKeys.join(', ')}`);
|
|
319
|
+
}
|
|
320
|
+
|
|
276
321
|
const params = {
|
|
277
|
-
..._.
|
|
278
|
-
'confirmed',
|
|
279
|
-
'blocked',
|
|
280
|
-
'confirmationToken',
|
|
281
|
-
'resetPasswordToken',
|
|
282
|
-
'provider',
|
|
283
|
-
'id',
|
|
284
|
-
'createdAt',
|
|
285
|
-
'updatedAt',
|
|
286
|
-
'createdBy',
|
|
287
|
-
'updatedBy',
|
|
288
|
-
'role',
|
|
289
|
-
]),
|
|
322
|
+
..._.pick(ctx.request.body, allowedKeys),
|
|
290
323
|
provider: 'local',
|
|
291
324
|
};
|
|
292
325
|
|
|
293
|
-
|
|
326
|
+
const validations = strapi.config.get('plugin::users-permissions.validationRules');
|
|
294
327
|
|
|
295
|
-
|
|
328
|
+
await validateRegisterBody(params, validations);
|
|
329
|
+
|
|
330
|
+
const role = await strapi.db
|
|
296
331
|
.query('plugin::users-permissions.role')
|
|
297
332
|
.findOne({ where: { type: settings.default_role } });
|
|
298
333
|
|
|
@@ -311,7 +346,7 @@ module.exports = {
|
|
|
311
346
|
],
|
|
312
347
|
};
|
|
313
348
|
|
|
314
|
-
const conflictingUserCount = await strapi.query('plugin::users-permissions.user').count({
|
|
349
|
+
const conflictingUserCount = await strapi.db.query('plugin::users-permissions.user').count({
|
|
315
350
|
where: { ...identifierFilter, provider },
|
|
316
351
|
});
|
|
317
352
|
|
|
@@ -320,7 +355,7 @@ module.exports = {
|
|
|
320
355
|
}
|
|
321
356
|
|
|
322
357
|
if (settings.unique_email) {
|
|
323
|
-
const conflictingUserCount = await strapi.query('plugin::users-permissions.user').count({
|
|
358
|
+
const conflictingUserCount = await strapi.db.query('plugin::users-permissions.user').count({
|
|
324
359
|
where: { ...identifierFilter },
|
|
325
360
|
});
|
|
326
361
|
|
|
@@ -345,7 +380,8 @@ module.exports = {
|
|
|
345
380
|
try {
|
|
346
381
|
await getService('user').sendConfirmationEmail(sanitizedUser);
|
|
347
382
|
} catch (err) {
|
|
348
|
-
|
|
383
|
+
strapi.log.error(err);
|
|
384
|
+
throw new ApplicationError('Error sending confirmation email');
|
|
349
385
|
}
|
|
350
386
|
|
|
351
387
|
return ctx.send({ user: sanitizedUser });
|
|
@@ -390,7 +426,7 @@ module.exports = {
|
|
|
390
426
|
async sendEmailConfirmation(ctx) {
|
|
391
427
|
const { email } = await validateSendEmailConfirmationBody(ctx.request.body);
|
|
392
428
|
|
|
393
|
-
const user = await strapi.query('plugin::users-permissions.user').findOne({
|
|
429
|
+
const user = await strapi.db.query('plugin::users-permissions.user').findOne({
|
|
394
430
|
where: { email: email.toLowerCase() },
|
|
395
431
|
});
|
|
396
432
|
|
|
@@ -413,4 +449,4 @@ module.exports = {
|
|
|
413
449
|
sent: true,
|
|
414
450
|
});
|
|
415
451
|
},
|
|
416
|
-
};
|
|
452
|
+
});
|
|
@@ -17,24 +17,25 @@ const ACTIONS = {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
const findEntityAndCheckPermissions = async (ability, action, model, id) => {
|
|
20
|
-
const
|
|
21
|
-
where: { id },
|
|
20
|
+
const doc = await strapi.service('plugin::content-manager.document-manager').findOne(id, model, {
|
|
22
21
|
populate: [`${CREATED_BY_ATTRIBUTE}.roles`],
|
|
23
22
|
});
|
|
24
23
|
|
|
25
|
-
if (_.isNil(
|
|
24
|
+
if (_.isNil(doc)) {
|
|
26
25
|
throw new NotFoundError();
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
const pm = strapi
|
|
28
|
+
const pm = strapi
|
|
29
|
+
.service('admin::permission')
|
|
30
|
+
.createPermissionsManager({ ability, action, model });
|
|
30
31
|
|
|
31
|
-
if (pm.ability.cannot(pm.action, pm.toSubject(
|
|
32
|
+
if (pm.ability.cannot(pm.action, pm.toSubject(doc))) {
|
|
32
33
|
throw new ForbiddenError();
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
const
|
|
36
|
+
const docWithoutCreatorRoles = _.omit(doc, `${CREATED_BY_ATTRIBUTE}.roles`);
|
|
36
37
|
|
|
37
|
-
return { pm,
|
|
38
|
+
return { pm, doc: docWithoutCreatorRoles };
|
|
38
39
|
};
|
|
39
40
|
|
|
40
41
|
module.exports = {
|
|
@@ -48,7 +49,7 @@ module.exports = {
|
|
|
48
49
|
|
|
49
50
|
const { email, username } = body;
|
|
50
51
|
|
|
51
|
-
const pm = strapi.admin
|
|
52
|
+
const pm = strapi.service('admin::permission').createPermissionsManager({
|
|
52
53
|
ability: userAbility,
|
|
53
54
|
action: ACTIONS.create,
|
|
54
55
|
model: userModel,
|
|
@@ -66,7 +67,7 @@ module.exports = {
|
|
|
66
67
|
|
|
67
68
|
await validateCreateUserBody(ctx.request.body);
|
|
68
69
|
|
|
69
|
-
const userWithSameUsername = await strapi
|
|
70
|
+
const userWithSameUsername = await strapi.db
|
|
70
71
|
.query('plugin::users-permissions.user')
|
|
71
72
|
.findOne({ where: { username } });
|
|
72
73
|
|
|
@@ -75,7 +76,7 @@ module.exports = {
|
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
if (advanced.unique_email) {
|
|
78
|
-
const userWithSameEmail = await strapi
|
|
79
|
+
const userWithSameEmail = await strapi.db
|
|
79
80
|
.query('plugin::users-permissions.user')
|
|
80
81
|
.findOne({ where: { email: email.toLowerCase() } });
|
|
81
82
|
|
|
@@ -93,18 +94,11 @@ module.exports = {
|
|
|
93
94
|
|
|
94
95
|
user.email = _.toLower(user.email);
|
|
95
96
|
|
|
96
|
-
if (!user.role) {
|
|
97
|
-
const defaultRole = await strapi
|
|
98
|
-
.query('plugin::users-permissions.role')
|
|
99
|
-
.findOne({ where: { type: advanced.default_role } });
|
|
100
|
-
|
|
101
|
-
user.role = defaultRole.id;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
97
|
try {
|
|
105
98
|
const data = await strapi
|
|
106
|
-
.service('plugin::content-manager.
|
|
107
|
-
.create(
|
|
99
|
+
.service('plugin::content-manager.document-manager')
|
|
100
|
+
.create(userModel, { data: user });
|
|
101
|
+
|
|
108
102
|
const sanitizedData = await pm.sanitizeOutput(data, { action: ACTIONS.read });
|
|
109
103
|
|
|
110
104
|
ctx.created(sanitizedData);
|
|
@@ -118,7 +112,7 @@ module.exports = {
|
|
|
118
112
|
*/
|
|
119
113
|
|
|
120
114
|
async update(ctx) {
|
|
121
|
-
const { id } = ctx.params;
|
|
115
|
+
const { id: documentId } = ctx.params;
|
|
122
116
|
const { body } = ctx.request;
|
|
123
117
|
const { user: admin, userAbility } = ctx.state;
|
|
124
118
|
|
|
@@ -128,13 +122,14 @@ module.exports = {
|
|
|
128
122
|
|
|
129
123
|
const { email, username, password } = body;
|
|
130
124
|
|
|
131
|
-
const { pm,
|
|
125
|
+
const { pm, doc } = await findEntityAndCheckPermissions(
|
|
132
126
|
userAbility,
|
|
133
127
|
ACTIONS.edit,
|
|
134
128
|
userModel,
|
|
135
|
-
|
|
129
|
+
documentId
|
|
136
130
|
);
|
|
137
|
-
|
|
131
|
+
|
|
132
|
+
const user = doc;
|
|
138
133
|
|
|
139
134
|
await validateUpdateUserBody(ctx.request.body);
|
|
140
135
|
|
|
@@ -143,23 +138,24 @@ module.exports = {
|
|
|
143
138
|
}
|
|
144
139
|
|
|
145
140
|
if (_.has(body, 'username')) {
|
|
146
|
-
const userWithSameUsername = await strapi
|
|
141
|
+
const userWithSameUsername = await strapi.db
|
|
147
142
|
.query('plugin::users-permissions.user')
|
|
148
143
|
.findOne({ where: { username } });
|
|
149
144
|
|
|
150
|
-
if (userWithSameUsername && _.toString(userWithSameUsername.id) !== _.toString(id)) {
|
|
145
|
+
if (userWithSameUsername && _.toString(userWithSameUsername.id) !== _.toString(user.id)) {
|
|
151
146
|
throw new ApplicationError('Username already taken');
|
|
152
147
|
}
|
|
153
148
|
}
|
|
154
149
|
|
|
155
150
|
if (_.has(body, 'email') && advancedConfigs.unique_email) {
|
|
156
|
-
const userWithSameEmail = await strapi
|
|
151
|
+
const userWithSameEmail = await strapi.db
|
|
157
152
|
.query('plugin::users-permissions.user')
|
|
158
153
|
.findOne({ where: { email: _.toLower(email) } });
|
|
159
154
|
|
|
160
|
-
if (userWithSameEmail && _.toString(userWithSameEmail.id) !== _.toString(id)) {
|
|
155
|
+
if (userWithSameEmail && _.toString(userWithSameEmail.id) !== _.toString(user.id)) {
|
|
161
156
|
throw new ApplicationError('Email already taken');
|
|
162
157
|
}
|
|
158
|
+
|
|
163
159
|
body.email = _.toLower(body.email);
|
|
164
160
|
}
|
|
165
161
|
|
|
@@ -167,8 +163,10 @@ module.exports = {
|
|
|
167
163
|
const updateData = _.omit({ ...sanitizedData, updatedBy: admin.id }, 'createdBy');
|
|
168
164
|
|
|
169
165
|
const data = await strapi
|
|
170
|
-
.service('plugin::content-manager.
|
|
171
|
-
.update(
|
|
166
|
+
.service('plugin::content-manager.document-manager')
|
|
167
|
+
.update(documentId, userModel, {
|
|
168
|
+
data: updateData,
|
|
169
|
+
});
|
|
172
170
|
|
|
173
171
|
ctx.body = await pm.sanitizeOutput(data, { action: ACTIONS.read });
|
|
174
172
|
},
|