@strapi/plugin-users-permissions 4.11.3 → 4.11.5

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.
@@ -1,4 +1,4 @@
1
- import React, { useMemo } from 'react';
1
+ import React from 'react';
2
2
 
3
3
  import {
4
4
  Box,
@@ -51,11 +51,10 @@ const AdvancedSettingsPage = () => {
51
51
  const queryClient = useQueryClient();
52
52
  useFocusWhenNavigate();
53
53
 
54
- const updatePermissions = useMemo(() => ({ update: PERMISSIONS.updateAdvancedSettings }), []);
55
54
  const {
56
55
  isLoading: isLoadingForPermissions,
57
56
  allowedActions: { canUpdate },
58
- } = useRBAC(updatePermissions);
57
+ } = useRBAC({ update: PERMISSIONS.updateAdvancedSettings });
59
58
 
60
59
  const { status: isLoadingData, data } = useQuery('advanced', () => fetchData(), {
61
60
  onSuccess() {
@@ -143,7 +142,7 @@ const AdvancedSettingsPage = () => {
143
142
  validationSchema={schema}
144
143
  enableReinitialize
145
144
  >
146
- {({ errors, values, handleChange, isSubmitting }) => {
145
+ {({ errors, values, handleChange, isSubmitting, dirty }) => {
147
146
  return (
148
147
  <Form>
149
148
  <HeaderLayout
@@ -155,7 +154,7 @@ const AdvancedSettingsPage = () => {
155
154
  <Button
156
155
  loading={isSubmitting}
157
156
  type="submit"
158
- disabled={!canUpdate}
157
+ disabled={canUpdate ? !dirty : !canUpdate}
159
158
  startIcon={<Check />}
160
159
  size="S"
161
160
  >
@@ -1,4 +1,4 @@
1
- import React, { useMemo, useRef, useState } from 'react';
1
+ import React, { useRef, useState } from 'react';
2
2
 
3
3
  import { ContentLayout, HeaderLayout, Main, useNotifyAT } from '@strapi/design-system';
4
4
  import {
@@ -40,14 +40,10 @@ const EmailTemplatesPage = () => {
40
40
  const [isModalOpen, setIsModalOpen] = useState(false);
41
41
  const [templateToEdit, setTemplateToEdit] = useState(null);
42
42
 
43
- const updatePermissions = useMemo(() => {
44
- return { update: PERMISSIONS.updateEmailTemplates };
45
- }, []);
46
-
47
43
  const {
48
44
  isLoading: isLoadingForPermissions,
49
45
  allowedActions: { canUpdate },
50
- } = useRBAC(updatePermissions);
46
+ } = useRBAC({ update: PERMISSIONS.updateEmailTemplates });
51
47
 
52
48
  const { status: isLoadingData, data } = useQuery('email-templates', () => fetchData(), {
53
49
  onSuccess() {
@@ -55,14 +55,10 @@ export const ProvidersPage = () => {
55
55
  const toggleNotification = useNotification();
56
56
  const { lockApp, unlockApp } = useOverlayBlocker();
57
57
 
58
- const updatePermissions = useMemo(() => {
59
- return { update: PERMISSIONS.updateProviders };
60
- }, []);
61
-
62
58
  const {
63
59
  isLoading: isLoadingForPermissions,
64
60
  allowedActions: { canUpdate },
65
- } = useRBAC(updatePermissions);
61
+ } = useRBAC({ update: PERMISSIONS.updateProviders });
66
62
 
67
63
  const {
68
64
  isLoading: isLoadingForData,
@@ -1,4 +1,4 @@
1
- import React, { useMemo, useState } from 'react';
1
+ import React, { useState } from 'react';
2
2
 
3
3
  import {
4
4
  ActionLayout,
@@ -33,7 +33,7 @@ import {
33
33
  } from '@strapi/helper-plugin';
34
34
  import { Plus } from '@strapi/icons';
35
35
  import { useIntl } from 'react-intl';
36
- import { useMutation, useQuery, useQueryClient } from 'react-query';
36
+ import { useMutation, useQuery } from 'react-query';
37
37
  import { useHistory } from 'react-router-dom';
38
38
 
39
39
  import { PERMISSIONS } from '../../../constants';
@@ -56,26 +56,21 @@ const RoleListPage = () => {
56
56
  const [roleToDelete, setRoleToDelete] = useState();
57
57
  useFocusWhenNavigate();
58
58
 
59
- const queryClient = useQueryClient();
60
-
61
- const updatePermissions = useMemo(() => {
62
- return {
63
- create: PERMISSIONS.createRole,
64
- read: PERMISSIONS.readRoles,
65
- update: PERMISSIONS.updateRole,
66
- delete: PERMISSIONS.deleteRole,
67
- };
68
- }, []);
69
-
70
59
  const {
71
60
  isLoading: isLoadingForPermissions,
72
61
  allowedActions: { canRead, canDelete },
73
- } = useRBAC(updatePermissions);
62
+ } = useRBAC({
63
+ create: PERMISSIONS.createRole,
64
+ read: PERMISSIONS.readRoles,
65
+ update: PERMISSIONS.updateRole,
66
+ delete: PERMISSIONS.deleteRole,
67
+ });
74
68
 
75
69
  const {
76
70
  isLoading: isLoadingForData,
77
71
  data: { roles },
78
72
  isFetching,
73
+ refetch,
79
74
  } = useQuery('get-roles', () => fetchData(toggleNotification, notifyStatus), {
80
75
  initialData: {},
81
76
  enabled: canRead,
@@ -121,7 +116,7 @@ const RoleListPage = () => {
121
116
 
122
117
  const deleteMutation = useMutation((id) => deleteData(id, toggleNotification), {
123
118
  async onSuccess() {
124
- await queryClient.invalidateQueries('get-roles');
119
+ await refetch();
125
120
  },
126
121
  });
127
122
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/plugin-users-permissions",
3
- "version": "4.11.3",
3
+ "version": "4.11.5",
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.8.0",
33
- "@strapi/helper-plugin": "4.11.3",
34
- "@strapi/icons": "1.8.0",
35
- "@strapi/utils": "4.11.3",
32
+ "@strapi/design-system": "1.8.1",
33
+ "@strapi/helper-plugin": "4.11.5",
34
+ "@strapi/icons": "1.8.1",
35
+ "@strapi/utils": "4.11.5",
36
36
  "bcryptjs": "2.4.3",
37
37
  "formik": "2.4.0",
38
38
  "grant-koa": "5.4.8",
@@ -46,7 +46,7 @@
46
46
  "purest": "4.0.2",
47
47
  "react-intl": "6.4.1",
48
48
  "react-query": "3.39.3",
49
- "react-redux": "8.0.5",
49
+ "react-redux": "8.1.1",
50
50
  "url-join": "4.0.1",
51
51
  "yup": "^0.32.9"
52
52
  },
@@ -77,5 +77,5 @@
77
77
  "required": true,
78
78
  "kind": "plugin"
79
79
  },
80
- "gitHead": "aac28413ada24fb8fff55c2908343cc3b8a2a3e0"
80
+ "gitHead": "7bdef3d27843c78666c85f30dc2f1bcf4d6b805e"
81
81
  }