@strapi/plugin-users-permissions 0.0.0-4fc90398602f

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 (168) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +1 -0
  3. package/admin/src/components/BoundRoute/getMethodColor.js +41 -0
  4. package/admin/src/components/BoundRoute/index.js +72 -0
  5. package/admin/src/components/FormModal/Input/index.js +121 -0
  6. package/admin/src/components/FormModal/index.js +121 -0
  7. package/admin/src/components/Permissions/PermissionRow/CheckboxWrapper.js +30 -0
  8. package/admin/src/components/Permissions/PermissionRow/SubCategory.js +114 -0
  9. package/admin/src/components/Permissions/PermissionRow/index.js +53 -0
  10. package/admin/src/components/Permissions/index.js +56 -0
  11. package/admin/src/components/Permissions/init.js +9 -0
  12. package/admin/src/components/Permissions/reducer.js +27 -0
  13. package/admin/src/components/Policies/index.js +60 -0
  14. package/admin/src/components/UsersPermissions/index.js +94 -0
  15. package/admin/src/components/UsersPermissions/init.js +10 -0
  16. package/admin/src/components/UsersPermissions/reducer.js +60 -0
  17. package/admin/src/contexts/UsersPermissionsContext/index.js +17 -0
  18. package/admin/src/hooks/index.js +5 -0
  19. package/admin/src/hooks/useFetchRole/index.js +64 -0
  20. package/admin/src/hooks/useFetchRole/reducer.js +31 -0
  21. package/admin/src/hooks/useForm/index.js +70 -0
  22. package/admin/src/hooks/useForm/reducer.js +40 -0
  23. package/admin/src/hooks/usePlugins/index.js +65 -0
  24. package/admin/src/hooks/usePlugins/init.js +5 -0
  25. package/admin/src/hooks/usePlugins/reducer.js +34 -0
  26. package/admin/src/hooks/useRolesList/index.js +63 -0
  27. package/admin/src/hooks/useRolesList/init.js +5 -0
  28. package/admin/src/hooks/useRolesList/reducer.js +31 -0
  29. package/admin/src/index.js +123 -0
  30. package/admin/src/pages/AdvancedSettings/index.js +238 -0
  31. package/admin/src/pages/AdvancedSettings/utils/api.js +13 -0
  32. package/admin/src/pages/AdvancedSettings/utils/layout.js +96 -0
  33. package/admin/src/pages/AdvancedSettings/utils/schema.js +19 -0
  34. package/admin/src/pages/EmailTemplates/components/EmailForm.js +173 -0
  35. package/admin/src/pages/EmailTemplates/components/EmailTable.js +121 -0
  36. package/admin/src/pages/EmailTemplates/index.js +162 -0
  37. package/admin/src/pages/EmailTemplates/utils/api.js +13 -0
  38. package/admin/src/pages/EmailTemplates/utils/schema.js +22 -0
  39. package/admin/src/pages/Providers/index.js +274 -0
  40. package/admin/src/pages/Providers/reducer.js +54 -0
  41. package/admin/src/pages/Providers/utils/api.js +21 -0
  42. package/admin/src/pages/Providers/utils/createProvidersArray.js +21 -0
  43. package/admin/src/pages/Providers/utils/forms.js +244 -0
  44. package/admin/src/pages/Roles/CreatePage/index.js +177 -0
  45. package/admin/src/pages/Roles/CreatePage/utils/schema.js +9 -0
  46. package/admin/src/pages/Roles/EditPage/index.js +190 -0
  47. package/admin/src/pages/Roles/EditPage/utils/schema.js +9 -0
  48. package/admin/src/pages/Roles/ListPage/components/TableBody.js +96 -0
  49. package/admin/src/pages/Roles/ListPage/index.js +216 -0
  50. package/admin/src/pages/Roles/ListPage/utils/api.js +28 -0
  51. package/admin/src/pages/Roles/ProtectedCreatePage/index.js +12 -0
  52. package/admin/src/pages/Roles/ProtectedEditPage/index.js +12 -0
  53. package/admin/src/pages/Roles/ProtectedListPage/index.js +15 -0
  54. package/admin/src/pages/Roles/index.js +27 -0
  55. package/admin/src/permissions.js +31 -0
  56. package/admin/src/pluginId.js +5 -0
  57. package/admin/src/translations/ar.json +40 -0
  58. package/admin/src/translations/cs.json +46 -0
  59. package/admin/src/translations/de.json +58 -0
  60. package/admin/src/translations/dk.json +83 -0
  61. package/admin/src/translations/en.json +83 -0
  62. package/admin/src/translations/es.json +83 -0
  63. package/admin/src/translations/fr.json +46 -0
  64. package/admin/src/translations/id.json +58 -0
  65. package/admin/src/translations/it.json +58 -0
  66. package/admin/src/translations/ja.json +44 -0
  67. package/admin/src/translations/ko.json +83 -0
  68. package/admin/src/translations/ms.json +45 -0
  69. package/admin/src/translations/nl.json +44 -0
  70. package/admin/src/translations/pl.json +83 -0
  71. package/admin/src/translations/pt-BR.json +40 -0
  72. package/admin/src/translations/pt.json +44 -0
  73. package/admin/src/translations/ru.json +58 -0
  74. package/admin/src/translations/sk.json +46 -0
  75. package/admin/src/translations/sv.json +58 -0
  76. package/admin/src/translations/th.json +56 -0
  77. package/admin/src/translations/tr.json +44 -0
  78. package/admin/src/translations/uk.json +45 -0
  79. package/admin/src/translations/vi.json +46 -0
  80. package/admin/src/translations/zh-Hans.json +62 -0
  81. package/admin/src/translations/zh.json +44 -0
  82. package/admin/src/utils/axiosInstance.js +36 -0
  83. package/admin/src/utils/cleanPermissions.js +25 -0
  84. package/admin/src/utils/formatPluginName.js +26 -0
  85. package/admin/src/utils/formatPolicies.js +8 -0
  86. package/admin/src/utils/getRequestURL.js +5 -0
  87. package/admin/src/utils/getTrad.js +5 -0
  88. package/admin/src/utils/index.js +5 -0
  89. package/documentation/content-api.yaml +848 -0
  90. package/jest.config.front.js +10 -0
  91. package/package.json +60 -0
  92. package/server/bootstrap/grant-config.js +123 -0
  93. package/server/bootstrap/index.js +133 -0
  94. package/server/bootstrap/users-permissions-actions.js +80 -0
  95. package/server/config.js +23 -0
  96. package/server/content-types/index.js +11 -0
  97. package/server/content-types/permission/index.js +34 -0
  98. package/server/content-types/role/index.js +51 -0
  99. package/server/content-types/user/index.js +72 -0
  100. package/server/content-types/user/schema-config.js +15 -0
  101. package/server/controllers/auth.js +398 -0
  102. package/server/controllers/content-manager-user.js +175 -0
  103. package/server/controllers/index.js +17 -0
  104. package/server/controllers/permissions.js +26 -0
  105. package/server/controllers/role.js +77 -0
  106. package/server/controllers/settings.js +85 -0
  107. package/server/controllers/user.js +198 -0
  108. package/server/controllers/validation/auth.js +57 -0
  109. package/server/controllers/validation/email-template.js +50 -0
  110. package/server/controllers/validation/user.js +26 -0
  111. package/server/graphql/index.js +44 -0
  112. package/server/graphql/mutations/auth/change-password.js +38 -0
  113. package/server/graphql/mutations/auth/email-confirmation.js +39 -0
  114. package/server/graphql/mutations/auth/forgot-password.js +35 -0
  115. package/server/graphql/mutations/auth/login.js +35 -0
  116. package/server/graphql/mutations/auth/register.js +36 -0
  117. package/server/graphql/mutations/auth/reset-password.js +38 -0
  118. package/server/graphql/mutations/crud/role/create-role.js +34 -0
  119. package/server/graphql/mutations/crud/role/delete-role.js +25 -0
  120. package/server/graphql/mutations/crud/role/update-role.js +35 -0
  121. package/server/graphql/mutations/crud/user/create-user.js +45 -0
  122. package/server/graphql/mutations/crud/user/delete-user.js +39 -0
  123. package/server/graphql/mutations/crud/user/update-user.js +46 -0
  124. package/server/graphql/mutations/index.js +43 -0
  125. package/server/graphql/queries/index.js +13 -0
  126. package/server/graphql/queries/me.js +17 -0
  127. package/server/graphql/resolvers-configs.js +42 -0
  128. package/server/graphql/types/create-role-payload.js +11 -0
  129. package/server/graphql/types/delete-role-payload.js +11 -0
  130. package/server/graphql/types/index.js +21 -0
  131. package/server/graphql/types/login-input.js +13 -0
  132. package/server/graphql/types/login-payload.js +12 -0
  133. package/server/graphql/types/me-role.js +14 -0
  134. package/server/graphql/types/me.js +16 -0
  135. package/server/graphql/types/password-payload.js +11 -0
  136. package/server/graphql/types/register-input.js +13 -0
  137. package/server/graphql/types/update-role-payload.js +11 -0
  138. package/server/graphql/utils.js +27 -0
  139. package/server/index.js +21 -0
  140. package/server/middlewares/index.js +7 -0
  141. package/server/middlewares/rateLimit.js +27 -0
  142. package/server/register.js +23 -0
  143. package/server/routes/admin/index.js +10 -0
  144. package/server/routes/admin/permissions.js +20 -0
  145. package/server/routes/admin/role.js +79 -0
  146. package/server/routes/admin/settings.js +95 -0
  147. package/server/routes/content-api/auth.js +82 -0
  148. package/server/routes/content-api/index.js +11 -0
  149. package/server/routes/content-api/permissions.js +9 -0
  150. package/server/routes/content-api/role.js +29 -0
  151. package/server/routes/content-api/user.js +60 -0
  152. package/server/routes/index.js +6 -0
  153. package/server/services/index.js +17 -0
  154. package/server/services/jwt.js +55 -0
  155. package/server/services/providers-registry.js +292 -0
  156. package/server/services/providers.js +115 -0
  157. package/server/services/role.js +177 -0
  158. package/server/services/user.js +140 -0
  159. package/server/services/users-permissions.js +236 -0
  160. package/server/strategies/users-permissions.js +102 -0
  161. package/server/utils/index.d.ts +16 -0
  162. package/server/utils/index.js +12 -0
  163. package/server/utils/sanitize/index.js +9 -0
  164. package/server/utils/sanitize/sanitizers.js +19 -0
  165. package/server/utils/sanitize/visitors/index.js +5 -0
  166. package/server/utils/sanitize/visitors/remove-user-relation-from-role-entities.js +11 -0
  167. package/strapi-admin.js +3 -0
  168. package/strapi-server.js +3 -0
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ const baseConfig = require('../../../jest.base-config.front');
4
+ const pkg = require('./package.json');
5
+
6
+ module.exports = {
7
+ ...baseConfig,
8
+ displayName: (pkg.strapi && pkg.strapi.name) || pkg.name,
9
+ roots: [__dirname],
10
+ };
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "@strapi/plugin-users-permissions",
3
+ "version": "0.0.0-4fc90398602f",
4
+ "description": "Protect your API with a full-authentication process based on JWT",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git://github.com/strapi/strapi.git"
8
+ },
9
+ "license": "SEE LICENSE IN LICENSE",
10
+ "author": {
11
+ "name": "Strapi Solutions SAS",
12
+ "email": "hi@strapi.io",
13
+ "url": "https://strapi.io"
14
+ },
15
+ "maintainers": [
16
+ {
17
+ "name": "Strapi Solutions SAS",
18
+ "email": "hi@strapi.io",
19
+ "url": "https://strapi.io"
20
+ }
21
+ ],
22
+ "scripts": {
23
+ "test:unit": "jest --verbose",
24
+ "test:front": "cross-env IS_EE=true jest --config ./jest.config.front.js",
25
+ "test:front:watch": "cross-env IS_EE=true jest --config ./jest.config.front.js --watchAll",
26
+ "test:front:ce": "cross-env IS_EE=false jest --config ./jest.config.front.js",
27
+ "test:front:watch:ce": "cross-env IS_EE=false jest --config ./jest.config.front.js --watchAll"
28
+ },
29
+ "dependencies": {
30
+ "@strapi/helper-plugin": "0.0.0-4fc90398602f",
31
+ "@strapi/utils": "0.0.0-4fc90398602f",
32
+ "bcryptjs": "2.4.3",
33
+ "grant-koa": "5.4.8",
34
+ "jsonwebtoken": "^8.1.0",
35
+ "koa": "^2.13.4",
36
+ "koa2-ratelimit": "^1.1.1",
37
+ "lodash": "4.17.21",
38
+ "purest": "4.0.2",
39
+ "react": "^17.0.2",
40
+ "react-dom": "^17.0.2",
41
+ "react-intl": "5.20.2",
42
+ "react-redux": "7.2.8",
43
+ "react-router": "^5.2.0",
44
+ "react-router-dom": "5.2.0",
45
+ "request": "^2.83.0",
46
+ "url-join": "4.0.1"
47
+ },
48
+ "engines": {
49
+ "node": ">=14.19.1 <=16.x.x",
50
+ "npm": ">=6.0.0"
51
+ },
52
+ "strapi": {
53
+ "displayName": "Roles & Permissions",
54
+ "name": "users-permissions",
55
+ "description": "Protect your API with a full authentication process based on JWT. This plugin comes also with an ACL strategy that allows you to manage the permissions between the groups of users.",
56
+ "required": true,
57
+ "kind": "plugin"
58
+ },
59
+ "gitHead": "4fc90398602f4a07f8ae8f04968c48d669992707"
60
+ }
@@ -0,0 +1,123 @@
1
+ 'use strict';
2
+
3
+ module.exports = (baseURL) => ({
4
+ email: {
5
+ enabled: true,
6
+ icon: 'envelope',
7
+ },
8
+ discord: {
9
+ enabled: false,
10
+ icon: 'discord',
11
+ key: '',
12
+ secret: '',
13
+ callback: `${baseURL}/discord/callback`,
14
+ scope: ['identify', 'email'],
15
+ },
16
+ facebook: {
17
+ enabled: false,
18
+ icon: 'facebook-square',
19
+ key: '',
20
+ secret: '',
21
+ callback: `${baseURL}/facebook/callback`,
22
+ scope: ['email'],
23
+ },
24
+ google: {
25
+ enabled: false,
26
+ icon: 'google',
27
+ key: '',
28
+ secret: '',
29
+ callback: `${baseURL}/google/callback`,
30
+ scope: ['email'],
31
+ },
32
+ github: {
33
+ enabled: false,
34
+ icon: 'github',
35
+ key: '',
36
+ secret: '',
37
+ callback: `${baseURL}/github/callback`,
38
+ scope: ['user', 'user:email'],
39
+ },
40
+ microsoft: {
41
+ enabled: false,
42
+ icon: 'windows',
43
+ key: '',
44
+ secret: '',
45
+ callback: `${baseURL}/microsoft/callback`,
46
+ scope: ['user.read'],
47
+ },
48
+ twitter: {
49
+ enabled: false,
50
+ icon: 'twitter',
51
+ key: '',
52
+ secret: '',
53
+ callback: `${baseURL}/twitter/callback`,
54
+ },
55
+ instagram: {
56
+ enabled: false,
57
+ icon: 'instagram',
58
+ key: '',
59
+ secret: '',
60
+ callback: `${baseURL}/instagram/callback`,
61
+ scope: ['user_profile'],
62
+ },
63
+ vk: {
64
+ enabled: false,
65
+ icon: 'vk',
66
+ key: '',
67
+ secret: '',
68
+ callback: `${baseURL}/vk/callback`,
69
+ scope: ['email'],
70
+ },
71
+ twitch: {
72
+ enabled: false,
73
+ icon: 'twitch',
74
+ key: '',
75
+ secret: '',
76
+ callback: `${baseURL}/twitch/callback`,
77
+ scope: ['user:read:email'],
78
+ },
79
+ linkedin: {
80
+ enabled: false,
81
+ icon: 'linkedin',
82
+ key: '',
83
+ secret: '',
84
+ callback: `${baseURL}/linkedin/callback`,
85
+ scope: ['r_liteprofile', 'r_emailaddress'],
86
+ },
87
+ cognito: {
88
+ enabled: false,
89
+ icon: 'aws',
90
+ key: '',
91
+ secret: '',
92
+ subdomain: 'my.subdomain.com',
93
+ callback: `${baseURL}/cognito/callback`,
94
+ scope: ['email', 'openid', 'profile'],
95
+ },
96
+ reddit: {
97
+ enabled: false,
98
+ icon: 'reddit',
99
+ key: '',
100
+ secret: '',
101
+ state: true,
102
+ callback: `${baseURL}/reddit/callback`,
103
+ scope: ['identity'],
104
+ },
105
+ auth0: {
106
+ enabled: false,
107
+ icon: '',
108
+ key: '',
109
+ secret: '',
110
+ subdomain: 'my-tenant.eu',
111
+ callback: `${baseURL}/auth0/callback`,
112
+ scope: ['openid', 'email', 'profile'],
113
+ },
114
+ cas: {
115
+ enabled: false,
116
+ icon: 'book',
117
+ key: '',
118
+ secret: '',
119
+ callback: `${baseURL}/cas/callback`,
120
+ scope: ['openid email'], // scopes should be space delimited
121
+ subdomain: 'my.subdomain.com/cas',
122
+ },
123
+ });
@@ -0,0 +1,133 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * An asynchronous bootstrap function that runs before
5
+ * your application gets started.
6
+ *
7
+ * This gives you an opportunity to set up your data model,
8
+ * run jobs, or perform some special logic.
9
+ */
10
+ const crypto = require('crypto');
11
+ const _ = require('lodash');
12
+ const urljoin = require('url-join');
13
+ const { getService } = require('../utils');
14
+ const getGrantConfig = require('./grant-config');
15
+
16
+ const usersPermissionsActions = require('./users-permissions-actions');
17
+
18
+ const initGrant = async (pluginStore) => {
19
+ const apiPrefix = strapi.config.get('api.rest.prefix');
20
+ const baseURL = urljoin(strapi.config.server.url, apiPrefix, 'auth');
21
+
22
+ const grantConfig = getGrantConfig(baseURL);
23
+
24
+ const prevGrantConfig = (await pluginStore.get({ key: 'grant' })) || {};
25
+ // store grant auth config to db
26
+ // when plugin_users-permissions_grant is not existed in db
27
+ // or we have added/deleted provider here.
28
+ if (!prevGrantConfig || !_.isEqual(_.keys(prevGrantConfig), _.keys(grantConfig))) {
29
+ // merge with the previous provider config.
30
+ _.keys(grantConfig).forEach((key) => {
31
+ if (key in prevGrantConfig) {
32
+ grantConfig[key] = _.merge(grantConfig[key], prevGrantConfig[key]);
33
+ }
34
+ });
35
+ await pluginStore.set({ key: 'grant', value: grantConfig });
36
+ }
37
+ };
38
+
39
+ const initEmails = async (pluginStore) => {
40
+ if (!(await pluginStore.get({ key: 'email' }))) {
41
+ const value = {
42
+ reset_password: {
43
+ display: 'Email.template.reset_password',
44
+ icon: 'sync',
45
+ options: {
46
+ from: {
47
+ name: 'Administration Panel',
48
+ email: 'no-reply@strapi.io',
49
+ },
50
+ response_email: '',
51
+ object: 'Reset password',
52
+ message: `<p>We heard that you lost your password. Sorry about that!</p>
53
+
54
+ <p>But don’t worry! You can use the following link to reset your password:</p>
55
+ <p><%= URL %>?code=<%= TOKEN %></p>
56
+
57
+ <p>Thanks.</p>`,
58
+ },
59
+ },
60
+ email_confirmation: {
61
+ display: 'Email.template.email_confirmation',
62
+ icon: 'check-square',
63
+ options: {
64
+ from: {
65
+ name: 'Administration Panel',
66
+ email: 'no-reply@strapi.io',
67
+ },
68
+ response_email: '',
69
+ object: 'Account confirmation',
70
+ message: `<p>Thank you for registering!</p>
71
+
72
+ <p>You have to confirm your email address. Please click on the link below.</p>
73
+
74
+ <p><%= URL %>?confirmation=<%= CODE %></p>
75
+
76
+ <p>Thanks.</p>`,
77
+ },
78
+ },
79
+ };
80
+
81
+ await pluginStore.set({ key: 'email', value });
82
+ }
83
+ };
84
+
85
+ const initAdvancedOptions = async (pluginStore) => {
86
+ if (!(await pluginStore.get({ key: 'advanced' }))) {
87
+ const value = {
88
+ unique_email: true,
89
+ allow_register: true,
90
+ email_confirmation: false,
91
+ email_reset_password: null,
92
+ email_confirmation_redirection: null,
93
+ default_role: 'authenticated',
94
+ };
95
+
96
+ await pluginStore.set({ key: 'advanced', value });
97
+ }
98
+ };
99
+
100
+ module.exports = async ({ strapi }) => {
101
+ const pluginStore = strapi.store({ type: 'plugin', name: 'users-permissions' });
102
+
103
+ await initGrant(pluginStore);
104
+ await initEmails(pluginStore);
105
+ await initAdvancedOptions(pluginStore);
106
+
107
+ await strapi.admin.services.permission.actionProvider.registerMany(
108
+ usersPermissionsActions.actions
109
+ );
110
+
111
+ await getService('users-permissions').initialize();
112
+
113
+ if (!strapi.config.get('plugin.users-permissions.jwtSecret')) {
114
+ if (process.env.NODE_ENV !== 'development') {
115
+ throw new Error(
116
+ `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')\`).
117
+ For security reasons, prefer storing the secret in an environment variable and read it in config/plugins.js. See https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/configurations/optional/environment.html#configuration-using-environment-variables.`
118
+ );
119
+ }
120
+
121
+ const jwtSecret = crypto.randomBytes(16).toString('base64');
122
+
123
+ strapi.config.set('plugin.users-permissions.jwtSecret', jwtSecret);
124
+
125
+ if (!process.env.JWT_SECRET) {
126
+ const envPath = process.env.ENV_PATH || '.env';
127
+ strapi.fs.appendFile(envPath, `JWT_SECRET=${jwtSecret}\n`);
128
+ strapi.log.info(
129
+ `The Users & Permissions plugin automatically generated a jwt secret and stored it in ${envPath} under the name JWT_SECRET.`
130
+ );
131
+ }
132
+ }
133
+ };
@@ -0,0 +1,80 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ actions: [
5
+ {
6
+ // Roles
7
+ section: 'plugins',
8
+ displayName: 'Create',
9
+ uid: 'roles.create',
10
+ subCategory: 'roles',
11
+ pluginName: 'users-permissions',
12
+ },
13
+ {
14
+ section: 'plugins',
15
+ displayName: 'Read',
16
+ uid: 'roles.read',
17
+ subCategory: 'roles',
18
+ pluginName: 'users-permissions',
19
+ },
20
+ {
21
+ section: 'plugins',
22
+ displayName: 'Update',
23
+ uid: 'roles.update',
24
+ subCategory: 'roles',
25
+ pluginName: 'users-permissions',
26
+ },
27
+ {
28
+ section: 'plugins',
29
+ displayName: 'Delete',
30
+ uid: 'roles.delete',
31
+ subCategory: 'roles',
32
+ pluginName: 'users-permissions',
33
+ },
34
+ {
35
+ // providers
36
+ section: 'plugins',
37
+ displayName: 'Read',
38
+ uid: 'providers.read',
39
+ subCategory: 'providers',
40
+ pluginName: 'users-permissions',
41
+ },
42
+ {
43
+ section: 'plugins',
44
+ displayName: 'Edit',
45
+ uid: 'providers.update',
46
+ subCategory: 'providers',
47
+ pluginName: 'users-permissions',
48
+ },
49
+ {
50
+ // emailTemplates
51
+ section: 'plugins',
52
+ displayName: 'Read',
53
+ uid: 'email-templates.read',
54
+ subCategory: 'emailTemplates',
55
+ pluginName: 'users-permissions',
56
+ },
57
+ {
58
+ section: 'plugins',
59
+ displayName: 'Edit',
60
+ uid: 'email-templates.update',
61
+ subCategory: 'emailTemplates',
62
+ pluginName: 'users-permissions',
63
+ },
64
+ {
65
+ // advancedSettings
66
+ section: 'plugins',
67
+ displayName: 'Read',
68
+ uid: 'advanced-settings.read',
69
+ subCategory: 'advancedSettings',
70
+ pluginName: 'users-permissions',
71
+ },
72
+ {
73
+ section: 'plugins',
74
+ displayName: 'Edit',
75
+ uid: 'advanced-settings.update',
76
+ subCategory: 'advancedSettings',
77
+ pluginName: 'users-permissions',
78
+ },
79
+ ],
80
+ };
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ default: ({ env }) => ({
5
+ jwtSecret: env('JWT_SECRET'),
6
+ jwt: {
7
+ expiresIn: '30d',
8
+ },
9
+ ratelimit: {
10
+ interval: 60000,
11
+ max: 10,
12
+ },
13
+ layout: {
14
+ user: {
15
+ actions: {
16
+ create: 'contentManagerUser.create', // Use the User plugin's controller.
17
+ update: 'contentManagerUser.update',
18
+ },
19
+ },
20
+ },
21
+ }),
22
+ validator() {},
23
+ };
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ const permission = require('./permission');
4
+ const role = require('./role');
5
+ const user = require('./user');
6
+
7
+ module.exports = {
8
+ permission: { schema: permission },
9
+ role: { schema: role },
10
+ user: { schema: user },
11
+ };
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ collectionName: 'up_permissions',
5
+ info: {
6
+ name: 'permission',
7
+ description: '',
8
+ singularName: 'permission',
9
+ pluralName: 'permissions',
10
+ displayName: 'Permission',
11
+ },
12
+ pluginOptions: {
13
+ 'content-manager': {
14
+ visible: false,
15
+ },
16
+ 'content-type-builder': {
17
+ visible: false,
18
+ },
19
+ },
20
+ attributes: {
21
+ action: {
22
+ type: 'string',
23
+ required: true,
24
+ configurable: false,
25
+ },
26
+ role: {
27
+ type: 'relation',
28
+ relation: 'manyToOne',
29
+ target: 'plugin::users-permissions.role',
30
+ inversedBy: 'permissions',
31
+ configurable: false,
32
+ },
33
+ },
34
+ };
@@ -0,0 +1,51 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ collectionName: 'up_roles',
5
+ info: {
6
+ name: 'role',
7
+ description: '',
8
+ singularName: 'role',
9
+ pluralName: 'roles',
10
+ displayName: 'Role',
11
+ },
12
+ pluginOptions: {
13
+ 'content-manager': {
14
+ visible: false,
15
+ },
16
+ 'content-type-builder': {
17
+ visible: false,
18
+ },
19
+ },
20
+ attributes: {
21
+ name: {
22
+ type: 'string',
23
+ minLength: 3,
24
+ required: true,
25
+ configurable: false,
26
+ },
27
+ description: {
28
+ type: 'string',
29
+ configurable: false,
30
+ },
31
+ type: {
32
+ type: 'string',
33
+ unique: true,
34
+ configurable: false,
35
+ },
36
+ permissions: {
37
+ type: 'relation',
38
+ relation: 'oneToMany',
39
+ target: 'plugin::users-permissions.permission',
40
+ mappedBy: 'role',
41
+ configurable: false,
42
+ },
43
+ users: {
44
+ type: 'relation',
45
+ relation: 'oneToMany',
46
+ target: 'plugin::users-permissions.user',
47
+ mappedBy: 'role',
48
+ configurable: false,
49
+ },
50
+ },
51
+ };
@@ -0,0 +1,72 @@
1
+ 'use strict';
2
+
3
+ const schemaConfig = require('./schema-config');
4
+
5
+ module.exports = {
6
+ collectionName: 'up_users',
7
+ info: {
8
+ name: 'user',
9
+ description: '',
10
+ singularName: 'user',
11
+ pluralName: 'users',
12
+ displayName: 'User',
13
+ },
14
+ options: {
15
+ draftAndPublish: false,
16
+ timestamps: true,
17
+ },
18
+ attributes: {
19
+ username: {
20
+ type: 'string',
21
+ minLength: 3,
22
+ unique: true,
23
+ configurable: false,
24
+ required: true,
25
+ },
26
+ email: {
27
+ type: 'email',
28
+ minLength: 6,
29
+ configurable: false,
30
+ required: true,
31
+ },
32
+ provider: {
33
+ type: 'string',
34
+ configurable: false,
35
+ },
36
+ password: {
37
+ type: 'password',
38
+ minLength: 6,
39
+ configurable: false,
40
+ private: true,
41
+ },
42
+ resetPasswordToken: {
43
+ type: 'string',
44
+ configurable: false,
45
+ private: true,
46
+ },
47
+ confirmationToken: {
48
+ type: 'string',
49
+ configurable: false,
50
+ private: true,
51
+ },
52
+ confirmed: {
53
+ type: 'boolean',
54
+ default: false,
55
+ configurable: false,
56
+ },
57
+ blocked: {
58
+ type: 'boolean',
59
+ default: false,
60
+ configurable: false,
61
+ },
62
+ role: {
63
+ type: 'relation',
64
+ relation: 'manyToOne',
65
+ target: 'plugin::users-permissions.role',
66
+ inversedBy: 'users',
67
+ configurable: false,
68
+ },
69
+ },
70
+
71
+ config: schemaConfig, // TODO: to move to content-manager options
72
+ };
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ attributes: {
5
+ resetPasswordToken: {
6
+ hidden: true,
7
+ },
8
+ confirmationToken: {
9
+ hidden: true,
10
+ },
11
+ provider: {
12
+ hidden: true,
13
+ },
14
+ },
15
+ };