@strapi/plugin-users-permissions 5.0.0-rc.0 → 5.0.0-rc.2

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 (31) hide show
  1. package/dist/_chunks/{index-iaebB1BT.js → index-B1qzCQd5.js} +8 -8
  2. package/dist/_chunks/{index-iaebB1BT.js.map → index-B1qzCQd5.js.map} +1 -1
  3. package/dist/_chunks/{index-DVEZVDjs.js → index-BrHOhLiu.js} +2 -2
  4. package/dist/_chunks/{index-DVEZVDjs.js.map → index-BrHOhLiu.js.map} +1 -1
  5. package/dist/_chunks/{index-DCFIfSfa.mjs → index-CGwt3Ia4.mjs} +3 -3
  6. package/dist/_chunks/{index-DCFIfSfa.mjs.map → index-CGwt3Ia4.mjs.map} +1 -1
  7. package/dist/_chunks/{index-iSLj9xJT.js → index-Cp4WQ7CY.js} +2 -2
  8. package/dist/_chunks/{index-iSLj9xJT.js.map → index-Cp4WQ7CY.js.map} +1 -1
  9. package/dist/_chunks/{index-DRoVF6Y7.js → index-CxY6jE0v.js} +7 -7
  10. package/dist/_chunks/{index-DRoVF6Y7.js.map → index-CxY6jE0v.js.map} +1 -1
  11. package/dist/_chunks/{index-iMO1GC3n.js → index-D-gXJApn.js} +4 -4
  12. package/dist/_chunks/{index-iMO1GC3n.js.map → index-D-gXJApn.js.map} +1 -1
  13. package/dist/_chunks/{index-Cf2sMpyd.mjs → index-DUjTQKud.mjs} +8 -8
  14. package/dist/_chunks/{index-Cf2sMpyd.mjs.map → index-DUjTQKud.mjs.map} +1 -1
  15. package/dist/_chunks/{index-qhy_K2pJ.mjs → index-DkSluM9h.mjs} +2 -2
  16. package/dist/_chunks/{index-qhy_K2pJ.mjs.map → index-DkSluM9h.mjs.map} +1 -1
  17. package/dist/_chunks/{index-zmcUQlrv.mjs → index-Dt46aAk-.mjs} +3 -3
  18. package/dist/_chunks/{index-zmcUQlrv.mjs.map → index-Dt46aAk-.mjs.map} +1 -1
  19. package/dist/_chunks/{index-B9OX-a4A.mjs → index-_XxxzBHB.mjs} +2 -2
  20. package/dist/_chunks/{index-B9OX-a4A.mjs.map → index-_XxxzBHB.mjs.map} +1 -1
  21. package/dist/_chunks/{index-8-k5RCnK-BHUgmsKx.mjs → index-m_rp3iqs-BHUgmsKx.mjs} +1 -1
  22. package/dist/_chunks/{index-8-k5RCnK-BHUgmsKx.mjs.map → index-m_rp3iqs-BHUgmsKx.mjs.map} +1 -1
  23. package/dist/_chunks/{index-8-k5RCnK-qR3QHvSP.js → index-m_rp3iqs-qR3QHvSP.js} +1 -1
  24. package/dist/_chunks/{index-8-k5RCnK-qR3QHvSP.js.map → index-m_rp3iqs-qR3QHvSP.js.map} +1 -1
  25. package/dist/admin/index.js +1 -1
  26. package/dist/admin/index.mjs +1 -1
  27. package/package.json +4 -4
  28. package/server/bootstrap/index.js +13 -9
  29. package/server/services/providers-registry.js +465 -275
  30. package/server/utils/index.d.ts +2 -1
  31. package/server/bootstrap/grant-config.js +0 -140
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
- const index = require("../_chunks/index-iaebB1BT.js");
2
+ const index = require("../_chunks/index-B1qzCQd5.js");
3
3
  module.exports = index.index;
4
4
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { i } from "../_chunks/index-Cf2sMpyd.mjs";
1
+ import { i } from "../_chunks/index-DUjTQKud.mjs";
2
2
  export {
3
3
  i as default
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/plugin-users-permissions",
3
- "version": "5.0.0-rc.0",
3
+ "version": "5.0.0-rc.2",
4
4
  "description": "Protect your API with a full-authentication process based on JWT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -48,7 +48,7 @@
48
48
  "dependencies": {
49
49
  "@strapi/design-system": "2.0.0-beta.6",
50
50
  "@strapi/icons": "2.0.0-beta.6",
51
- "@strapi/utils": "5.0.0-rc.0",
51
+ "@strapi/utils": "5.0.0-rc.2",
52
52
  "bcryptjs": "2.4.3",
53
53
  "formik": "2.4.5",
54
54
  "grant-koa": "5.4.8",
@@ -68,7 +68,7 @@
68
68
  },
69
69
  "devDependencies": {
70
70
  "@strapi/pack-up": "5.0.0",
71
- "@strapi/strapi": "5.0.0-rc.0",
71
+ "@strapi/strapi": "5.0.0-rc.2",
72
72
  "@testing-library/dom": "10.1.0",
73
73
  "@testing-library/react": "15.0.7",
74
74
  "@testing-library/user-event": "14.5.2",
@@ -96,5 +96,5 @@
96
96
  "required": true,
97
97
  "kind": "plugin"
98
98
  },
99
- "gitHead": "ec0af1ddc1aa1c774e42db971848c6b95517d4ad"
99
+ "gitHead": "c3f078328f8506cd543f6635b992d8648cb8c501"
100
100
  }
@@ -9,22 +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
13
  const usersPermissionsActions = require('./users-permissions-actions');
16
14
 
17
15
  const initGrant = async (pluginStore) => {
18
- const apiPrefix = strapi.config.get('api.rest.prefix');
19
- const baseURL = urljoin(strapi.config.server.url, apiPrefix, 'auth');
16
+ const allProviders = getService('providers-registry').getAll();
20
17
 
21
- const grantConfig = getGrantConfig(baseURL);
18
+ const grantConfig = Object.entries(allProviders).reduce((acc, [name, provider]) => {
19
+ const { icon, enabled, grantConfig } = provider;
20
+
21
+ acc[name] = {
22
+ icon,
23
+ enabled,
24
+ ...grantConfig,
25
+ };
26
+ return acc;
27
+ }, {});
22
28
 
23
29
  const prevGrantConfig = (await pluginStore.get({ key: 'grant' })) || {};
24
- // store grant auth config to db
25
- // when plugin_users-permissions_grant is not existed in db
26
- // or we have added/deleted provider here.
27
- if (!prevGrantConfig || !_.isEqual(_.keys(prevGrantConfig), _.keys(grantConfig))) {
30
+
31
+ if (!prevGrantConfig || !_.isEqual(prevGrantConfig, grantConfig)) {
28
32
  // merge with the previous provider config.
29
33
  _.keys(grantConfig).forEach((key) => {
30
34
  if (key in prevGrantConfig) {