@strapi/plugin-users-permissions 0.0.0-next.f45143c5e2a8a9d85691d0abf79a3f42024a0c71 → 0.0.0-next.ff946d2c25a3e577b47132a357cac2932eb8e635

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.
@@ -23,7 +23,9 @@ const Input = ({
23
23
  }) => {
24
24
  const { formatMessage } = useIntl();
25
25
  const inputValue =
26
- name === 'noName' ? `${strapi.backendURL}/api/connect/${providerToEditName}/callback` : value;
26
+ name === 'noName'
27
+ ? `${window.strapi.backendURL}/api/connect/${providerToEditName}/callback`
28
+ : value;
27
29
 
28
30
  const label = formatMessage(
29
31
  { id: intlLabel.id, defaultMessage: intlLabel.defaultMessage },
@@ -1,5 +1,5 @@
1
1
  import { useCallback, useEffect, useReducer, useRef } from 'react';
2
- import { useRBAC, request, useNotification } from '@strapi/helper-plugin';
2
+ import { useRBAC, useFetchClient, useNotification } from '@strapi/helper-plugin';
3
3
  import { getRequestURL } from '../../utils';
4
4
  import reducer, { initialState } from './reducer';
5
5
 
@@ -9,8 +9,7 @@ const useUserForm = (endPoint, permissions) => {
9
9
  const toggleNotification = useNotification();
10
10
  const isMounted = useRef(true);
11
11
 
12
- const abortController = new AbortController();
13
- const { signal } = abortController;
12
+ const { get } = useFetchClient();
14
13
 
15
14
  useEffect(() => {
16
15
  const getData = async () => {
@@ -19,7 +18,7 @@ const useUserForm = (endPoint, permissions) => {
19
18
  type: 'GET_DATA',
20
19
  });
21
20
 
22
- const data = await request(getRequestURL(endPoint), { method: 'GET', signal });
21
+ const { data } = await get(getRequestURL(endPoint));
23
22
 
24
23
  dispatch({
25
24
  type: 'GET_DATA_SUCCEEDED',
@@ -45,11 +44,9 @@ const useUserForm = (endPoint, permissions) => {
45
44
  }
46
45
 
47
46
  return () => {
48
- abortController.abort();
49
47
  isMounted.current = false;
50
48
  };
51
- // eslint-disable-next-line react-hooks/exhaustive-deps
52
- }, [isLoadingForPermissions, endPoint]);
49
+ }, [isLoadingForPermissions, endPoint, get, toggleNotification]);
53
50
 
54
51
  const dispatchSubmitSucceeded = useCallback((data) => {
55
52
  dispatch({
@@ -1,5 +1,5 @@
1
- import { useEffect, useReducer, useRef } from 'react';
2
- import { request, useNotification } from '@strapi/helper-plugin';
1
+ import { useCallback, useEffect, useReducer, useRef } from 'react';
2
+ import { useFetchClient, useNotification } from '@strapi/helper-plugin';
3
3
  import get from 'lodash/get';
4
4
  import init from './init';
5
5
  import pluginId from '../../pluginId';
@@ -12,28 +12,17 @@ const useRolesList = (shouldFetchData = true) => {
12
12
  const toggleNotification = useNotification();
13
13
 
14
14
  const isMounted = useRef(true);
15
- const abortController = new AbortController();
16
- const { signal } = abortController;
15
+ const fetchClient = useFetchClient();
17
16
 
18
- useEffect(() => {
19
- if (shouldFetchData) {
20
- fetchRolesList();
21
- }
22
-
23
- return () => {
24
- abortController.abort();
25
- isMounted.current = false;
26
- };
27
- // eslint-disable-next-line react-hooks/exhaustive-deps
28
- }, [shouldFetchData]);
29
-
30
- const fetchRolesList = async () => {
17
+ const fetchRolesList = useCallback(async () => {
31
18
  try {
32
19
  dispatch({
33
20
  type: 'GET_DATA',
34
21
  });
35
22
 
36
- const { roles } = await request(`/${pluginId}/roles`, { method: 'GET', signal });
23
+ const {
24
+ data: { roles },
25
+ } = await fetchClient.get(`/${pluginId}/roles`);
37
26
 
38
27
  dispatch({
39
28
  type: 'GET_DATA_SUCCEEDED',
@@ -55,7 +44,17 @@ const useRolesList = (shouldFetchData = true) => {
55
44
  }
56
45
  }
57
46
  }
58
- };
47
+ }, [fetchClient, toggleNotification]);
48
+
49
+ useEffect(() => {
50
+ if (shouldFetchData) {
51
+ fetchRolesList();
52
+ }
53
+
54
+ return () => {
55
+ isMounted.current = false;
56
+ };
57
+ }, [shouldFetchData, fetchRolesList]);
59
58
 
60
59
  return { roles, isLoading, getData: fetchRolesList };
61
60
  };
@@ -120,7 +120,7 @@ const EmailForm = ({ template, onToggle, onSubmit }) => {
120
120
  id: getTrad('PopUpForm.Email.options.message.label'),
121
121
  defaultMessage: 'Message',
122
122
  })}
123
- name="options.message"
123
+ id="options.message"
124
124
  onChange={handleChange}
125
125
  value={values.options.message}
126
126
  error={
@@ -143,7 +143,7 @@ const EditPage = () => {
143
143
  </GridItem>
144
144
  <GridItem col={6}>
145
145
  <Textarea
146
- name="description"
146
+ id="description"
147
147
  value={values.description || ''}
148
148
  onChange={handleChange}
149
149
  label={formatMessage({
@@ -155,7 +155,7 @@ const EditPage = () => {
155
155
  </GridItem>
156
156
  <GridItem col={6}>
157
157
  <Textarea
158
- name="description"
158
+ id="description"
159
159
  value={values.description || ''}
160
160
  onChange={handleChange}
161
161
  label={formatMessage({
@@ -2,55 +2,79 @@
2
2
  "BoundRoute.title": "Связать путь с",
3
3
  "EditForm.inputSelect.description.role": "При регистрации пользователи будут иметь выбранную роль.",
4
4
  "EditForm.inputSelect.label.role": "Роль по умолчанию для новых пользователей",
5
- "EditForm.inputToggle.description.email": "Запретить пользователю создавать несколько учетных записей, используя один и тот же адрес электронной почты с различными провайдерами аутентификации.",
5
+ "EditForm.inputToggle.description.email": "Запретить пользователю создавать несколько учётных записей, используя один и тот же адрес электронной почты, у разных поставщиков аутентификации.",
6
6
  "EditForm.inputToggle.description.email-confirmation": "Если включено (ON), при регистрации пользователи будут получать письмо для подтверждения адреса электронной почты.",
7
- "EditForm.inputToggle.description.email-confirmation-redirection": "Укажите URL-адрес для перенаправления после подтверждения адреса электронной почты.",
8
- "EditForm.inputToggle.description.email-reset-password": "URL-адрес страницы сброса пароля вашего приложения",
9
- "EditForm.inputToggle.description.sign-up": "Когда выключенно (OFF) процесс регистрации запрещен. Никто не может зарегистрироваться, независимо от провайдера.",
10
- "EditForm.inputToggle.label.email": "Одна учетная запись на адрес электронной почты",
7
+ "EditForm.inputToggle.description.email-confirmation-redirection": "Укажите URL-адрес для перенаправления пользователей после подтверждения адреса электронной почты.",
8
+ "EditForm.inputToggle.description.email-reset-password": "URL-адрес страницы для сброса пароля учётной записи пользователя",
9
+ "EditForm.inputToggle.description.sign-up": "Если выключено (OFF), процесс регистрации пользователей запрещен. Никто не может зарегистрироваться, независимо от провайдера.",
10
+ "EditForm.inputToggle.label.email": "Одна учётная запись на один адрес электронной почты",
11
11
  "EditForm.inputToggle.label.email-confirmation": "Включить подтверждение по электронной почте",
12
12
  "EditForm.inputToggle.label.email-confirmation-redirection": "URL-адрес для перенаправления",
13
13
  "EditForm.inputToggle.label.email-reset-password": "Страница сброса пароля",
14
- "EditForm.inputToggle.label.sign-up": "Включить регистрацию",
15
- "Email.template.email_confirmation": "Подтверждение адреса электронной почты",
14
+ "EditForm.inputToggle.label.sign-up": "Включить регистрации",
15
+ "EditForm.inputToggle.placeholder.email-confirmation-redirection": "например: https://yourfrontend.com/email-confirmation-redirection",
16
+ "EditForm.inputToggle.placeholder.email-reset-password": "например: https://yourfrontend.com/reset-password",
17
+ "EditPage.form.roles": "Сведения о роли",
18
+ "Email.template.data.loaded": "Шаблоны автоматических писем для электронной почты были загружены",
19
+ "Email.template.email_confirmation": "Адреса электронной почты с письмом о подтверждении",
20
+ "Email.template.form.edit.label": "Редактировать шаблон",
21
+ "Email.template.table.action.label": "действие",
22
+ "Email.template.table.icon.label": "иконка",
23
+ "Email.template.table.name.label": "название",
24
+ "Form.advancedSettings.data.loaded": "Данные расширенных настроек были загружены",
16
25
  "HeaderNav.link.advancedSettings": "Расширенные настройки",
17
26
  "HeaderNav.link.emailTemplates": "Шаблоны писем",
18
27
  "HeaderNav.link.providers": "Провайдеры",
19
- "Plugin.permissions.plugins.description": "Определить действия доступные для плагина {name}.",
20
- "Plugins.header.description": "В списке выводятся только действия, связанные с маршрутом.",
21
- "Plugins.header.title": "Доступы",
22
- "Policies.header.hint": "Выберите действия приложения или плагина и щелкните значок шестеренки, чтобы отобразить связанный маршрут",
28
+ "Plugin.permissions.plugins.description": "Определите все разрешенные действия для плагина {name}.",
29
+ "Plugins.header.description": "Ниже перечислены только действия, связанные с путём.",
30
+ "Plugins.header.title": "Разрешения",
31
+ "Policies.header.hint": "Выберите действия приложения или плагина и нажмите на значок шестерёнки, чтобы отобразить связанный путь",
23
32
  "Policies.header.title": "Расширенные настройки",
24
- "PopUpForm.Email.email_templates.inputDescription": "Если вы не уверены как использовать переменные, {link}",
33
+ "PopUpForm.Email.email_templates.inputDescription": "Если вы не уверены, как использовать переменные {link}",
25
34
  "PopUpForm.Email.link.documentation": "ознакомьтесь с нашей документацией.",
26
- "PopUpForm.Email.options.from.email.label": "Адрес отправителя",
35
+ "PopUpForm.Email.options.from.email.label": "Электронная почта отправителя",
27
36
  "PopUpForm.Email.options.from.email.placeholder": "kai@doe.com",
28
37
  "PopUpForm.Email.options.from.name.label": "Имя отправителя",
29
38
  "PopUpForm.Email.options.from.name.placeholder": "Kai Doe",
30
39
  "PopUpForm.Email.options.message.label": "Сообщение",
31
40
  "PopUpForm.Email.options.object.label": "Тема",
32
41
  "PopUpForm.Email.options.object.placeholder": "Пожалуйста, подтвердите свой адрес электронной почты для %APP_NAME%",
33
- "PopUpForm.Email.options.response_email.label": "Адрес для ответа",
34
- "PopUpForm.Email.options.response_email.placeholder": "kai@doe.com",
35
- "PopUpForm.Providers.enabled.description": "Если отключено, пользователи не смогут использовать этот провайдер.",
36
- "PopUpForm.Providers.enabled.label": "Включить",
37
- "PopUpForm.Providers.key.label": "Client ID",
42
+ "PopUpForm.Email.options.response_email.label": "Электронная почта для ответов",
43
+ "PopUpForm.Email.options.response_email.placeholder": "paul@example.com",
44
+ "PopUpForm.Providers.enabled.description": "Если этот параметр отключен, пользователи не смогут использовать этого поставщика.",
45
+ "PopUpForm.Providers.enabled.label": "Включено",
46
+ "PopUpForm.Providers.key.label": "ID клиента",
38
47
  "PopUpForm.Providers.key.placeholder": "TEXT",
39
- "PopUpForm.Providers.redirectURL.front-end.label": "URL-адрес перенаправления для вашего приложения",
40
- "PopUpForm.Providers.redirectURL.label": "URL перенаправления, который нужно добавить в {provider} конфигурации приложения",
48
+ "PopUpForm.Providers.redirectURL.front-end.label": "URL-адрес перенаправления на ваше приложение",
49
+ "PopUpForm.Providers.redirectURL.label": "URL-адрес перенаправления, который нужно добавить в {provider} конфигурации приложения",
41
50
  "PopUpForm.Providers.secret.label": "Client Secret",
42
51
  "PopUpForm.Providers.secret.placeholder": "TEXT",
43
- "PopUpForm.Providers.subdomain.label": "Host URI (Subdomain)",
52
+ "PopUpForm.Providers.subdomain.label": "Хост URI (Поддомен)",
44
53
  "PopUpForm.Providers.subdomain.placeholder": "my.subdomain.com",
45
54
  "PopUpForm.header.edit.email-templates": "Редактировать шаблон письма",
46
55
  "PopUpForm.header.edit.providers": "Редактировать провайдера",
56
+ "Providers.data.loaded": "Провайдеры были загружены",
57
+ "Providers.status": "Статус",
58
+ "Roles.empty": "У вас пока нет никаких ролей.",
59
+ "Roles.empty.search": "Ни одна роль не соответствует поисковому запросу.",
47
60
  "Settings.roles.deleted": "Роль удалена",
48
61
  "Settings.roles.edited": "Роль отредактирована",
49
- "Settings.section-label": "Плагин Пользователи и разрешения",
50
- "notification.success.submit": "Настройки обновлены",
51
- "plugin.description.long": "Защитите ваш API с помощью процесса полной аутентификации, основанном на JWT. Этот плагин также включает в себя возможности ACL (Access Control List), которые позволят вам настраивать доступы для групп пользователей.",
52
- "plugin.description.short": "Защитите ваш API с помощью процесса полной аутентификации, основанном на JWT",
53
- "plugin.name": "Роли и доступы",
62
+ "Settings.section-label": "Плагин «Пользователи и Разрешения»",
63
+ "components.Input.error.validation.email": "Неверный адрес электронной почты",
64
+ "components.Input.error.validation.json": "Это не соответствует формату JSON",
65
+ "components.Input.error.validation.max": "Значение слишком велико.",
66
+ "components.Input.error.validation.maxLength": "Значение слишком длинное.",
67
+ "components.Input.error.validation.min": "Значение слишком мало.",
68
+ "components.Input.error.validation.minLength": "Значение слишком короткое.",
69
+ "components.Input.error.validation.minSupMax": "Не может быть выше",
70
+ "components.Input.error.validation.regex": "Значение не соответствует регулярному выражению.",
71
+ "components.Input.error.validation.required": "Это значение является обязательным.",
72
+ "components.Input.error.validation.unique": "Это значение уже используется.",
73
+ "notification.success.submit": "Настройки были обновлены",
74
+ "page.title": "Настройки — Роли",
75
+ "plugin.description.long": "Защитите свой API с помощью полноценного процесса аутентификации, основанного на JWT. Этот плагин также имеет настройки стратегии ACL, которые позволяют вам управлять разрешениями между группами пользователей.",
76
+ "plugin.description.short": "Защитите свой API с помощью полноценного процесса аутентификации, основанного на JWT.",
77
+ "plugin.name": "Пользователи и Разрешения",
54
78
  "popUpWarning.button.cancel": "Отменить",
55
79
  "popUpWarning.button.confirm": "Подтвердить",
56
80
  "popUpWarning.title": "Пожалуйста подтвердите",
@@ -12,8 +12,16 @@ tags:
12
12
  url: 'https://docs.strapi.io/developer-docs/latest/plugins/users-permissions.html'
13
13
 
14
14
  paths:
15
- '/connect/(.*)':
15
+ /connect/{provider}:
16
16
  get:
17
+ parameters:
18
+ - name: provider
19
+ in: path
20
+ required: true
21
+ description: Provider name
22
+ schema:
23
+ type: string
24
+ pattern: '.*'
17
25
  tags:
18
26
  - Users-Permissions - Auth
19
27
  summary: Login with a provider
@@ -148,7 +156,7 @@ paths:
148
156
  type: object
149
157
  properties:
150
158
  ok:
151
- type: enum
159
+ type: string
152
160
  enum: [true]
153
161
  default:
154
162
  description: Error
@@ -273,7 +281,7 @@ paths:
273
281
  email:
274
282
  type: string
275
283
  sent:
276
- type: enum
284
+ type: string
277
285
  enum: [true]
278
286
  default:
279
287
  description: Error
@@ -381,7 +389,7 @@ paths:
381
389
  type: object
382
390
  properties:
383
391
  ok:
384
- type: enum
392
+ type: string
385
393
  enum: [true]
386
394
  default:
387
395
  description: Error
@@ -456,7 +464,7 @@ paths:
456
464
  type: object
457
465
  properties:
458
466
  ok:
459
- type: enum
467
+ type: string
460
468
  enum: [true]
461
469
  default:
462
470
  description: Error
@@ -485,7 +493,7 @@ paths:
485
493
  type: object
486
494
  properties:
487
495
  ok:
488
- type: enum
496
+ type: string
489
497
  enum: [true]
490
498
  default:
491
499
  description: Error
@@ -779,9 +787,11 @@ components:
779
787
  type:
780
788
  type: string
781
789
  createdAt:
782
- type: datetime
790
+ type: string
791
+ format: date-time
783
792
  updatedAt:
784
- type: datetime
793
+ type: string
794
+ format: date-time
785
795
 
786
796
  Users-Permissions-User:
787
797
  type: object
@@ -805,10 +815,12 @@ components:
805
815
  type: boolean
806
816
  example: false
807
817
  createdAt:
808
- type: datetime
818
+ type: string
819
+ format: date-time
809
820
  example: '2022-06-02T08:32:06.258Z'
810
821
  updatedAt:
811
- type: datetime
822
+ type: string
823
+ format: date-time
812
824
  example: '2022-06-02T08:32:06.267Z'
813
825
 
814
826
  Users-Permissions-UserRegistration:
@@ -839,10 +851,6 @@ components:
839
851
  type: boolean
840
852
  policy:
841
853
  type: string
842
-
843
- parameters:
844
- responses:
845
- examples:
846
854
  requestBodies:
847
855
  Users-Permissions-RoleRequest:
848
856
  required: true
@@ -2,4 +2,5 @@
2
2
 
3
3
  module.exports = {
4
4
  preset: '../../../jest-preset.front.js',
5
+ displayName: 'Users & Permissions plugin',
5
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/plugin-users-permissions",
3
- "version": "0.0.0-next.f45143c5e2a8a9d85691d0abf79a3f42024a0c71",
3
+ "version": "0.0.0-next.ff946d2c25a3e577b47132a357cac2932eb8e635",
4
4
  "description": "Protect your API with a full-authentication process based on JWT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,10 +29,10 @@
29
29
  "lint": "run -T eslint ."
30
30
  },
31
31
  "dependencies": {
32
- "@strapi/design-system": "1.6.6",
33
- "@strapi/helper-plugin": "0.0.0-next.f45143c5e2a8a9d85691d0abf79a3f42024a0c71",
34
- "@strapi/icons": "1.6.6",
35
- "@strapi/utils": "0.0.0-next.f45143c5e2a8a9d85691d0abf79a3f42024a0c71",
32
+ "@strapi/design-system": "1.7.7",
33
+ "@strapi/helper-plugin": "0.0.0-next.ff946d2c25a3e577b47132a357cac2932eb8e635",
34
+ "@strapi/icons": "1.7.7",
35
+ "@strapi/utils": "0.0.0-next.ff946d2c25a3e577b47132a357cac2932eb8e635",
36
36
  "bcryptjs": "2.4.3",
37
37
  "formik": "2.2.9",
38
38
  "grant-koa": "5.4.8",
@@ -44,7 +44,7 @@
44
44
  "lodash": "4.17.21",
45
45
  "prop-types": "^15.7.2",
46
46
  "purest": "4.0.2",
47
- "react-intl": "6.3.2",
47
+ "react-intl": "6.4.1",
48
48
  "react-query": "3.24.3",
49
49
  "react-redux": "8.0.5",
50
50
  "url-join": "4.0.1",
@@ -56,11 +56,10 @@
56
56
  "@testing-library/react-hooks": "8.0.1",
57
57
  "@testing-library/user-event": "14.4.3",
58
58
  "history": "^4.9.0",
59
- "msw": "1.0.1",
59
+ "msw": "1.2.1",
60
60
  "react": "^17.0.2",
61
61
  "react-dom": "^17.0.2",
62
62
  "react-router-dom": "5.3.4",
63
- "react-test-renderer": "^17.0.2",
64
63
  "styled-components": "5.3.3"
65
64
  },
66
65
  "peerDependencies": {
@@ -80,5 +79,5 @@
80
79
  "required": true,
81
80
  "kind": "plugin"
82
81
  },
83
- "gitHead": "f45143c5e2a8a9d85691d0abf79a3f42024a0c71"
82
+ "gitHead": "ff946d2c25a3e577b47132a357cac2932eb8e635"
84
83
  }
@@ -18,6 +18,12 @@ module.exports = ({ strapi }) => {
18
18
  const specPath = path.join(__dirname, '../documentation/content-api.yaml');
19
19
  const spec = fs.readFileSync(specPath, 'utf8');
20
20
 
21
- strapi.plugin('documentation').service('documentation').registerDoc(spec);
21
+ strapi
22
+ .plugin('documentation')
23
+ .service('override')
24
+ .registerOverride(spec, {
25
+ pluginOrigin: 'users-permissions',
26
+ excludeFromGeneration: ['users-permissions'],
27
+ });
22
28
  }
23
29
  };
@@ -176,7 +176,7 @@ const getInitialProviders = ({ purest }) => ({
176
176
  const vk = purest({ provider: 'vk' });
177
177
 
178
178
  return vk
179
- .get('users.get')
179
+ .get('users')
180
180
  .auth(accessToken)
181
181
  .qs({ id: query.raw.user_id, v: '5.122' })
182
182
  .request()