@strapi/plugin-users-permissions 4.0.0-beta.13 → 4.0.0-beta.17

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, { memo, useCallback, useReducer } from 'react';
1
+ import React, { useReducer } from 'react';
2
2
  import { Accordion, AccordionToggle, AccordionContent } from '@strapi/design-system/Accordion';
3
3
  import { useIntl } from 'react-intl';
4
4
  import { Box } from '@strapi/design-system/Box';
@@ -15,12 +15,11 @@ const Permissions = () => {
15
15
  init(state, modifiedData)
16
16
  );
17
17
 
18
- const handleToggle = useCallback(index => {
18
+ const handleToggle = index =>
19
19
  dispatch({
20
20
  type: 'TOGGLE_COLLAPSE',
21
21
  index,
22
22
  });
23
- }, []);
24
23
 
25
24
  return (
26
25
  <>
@@ -52,4 +51,4 @@ const Permissions = () => {
52
51
  );
53
52
  };
54
53
 
55
- export default memo(Permissions);
54
+ export default Permissions;
@@ -3,18 +3,21 @@ import { useIntl } from 'react-intl';
3
3
  import { Typography } from '@strapi/design-system/Typography';
4
4
  import { Stack } from '@strapi/design-system/Stack';
5
5
  import { GridItem } from '@strapi/design-system/Grid';
6
- import { get, isEmpty, takeRight, toLower, without } from 'lodash';
6
+ import { get, isEmpty, without } from 'lodash';
7
7
  import { useUsersPermissions } from '../../contexts/UsersPermissionsContext';
8
8
  import BoundRoute from '../BoundRoute';
9
9
 
10
10
  const Policies = () => {
11
11
  const { formatMessage } = useIntl();
12
12
  const { selectedAction, routes } = useUsersPermissions();
13
+
13
14
  const path = without(selectedAction.split('.'), 'controllers');
14
15
  const controllerRoutes = get(routes, path[0]);
16
+ const pathResolved = path.slice(1).join('.');
17
+
15
18
  const displayedRoutes = isEmpty(controllerRoutes)
16
19
  ? []
17
- : controllerRoutes.filter(o => toLower(o.handler) === toLower(takeRight(path, 2).join('.')));
20
+ : controllerRoutes.filter(o => o.handler.endsWith(pathResolved));
18
21
 
19
22
  return (
20
23
  <GridItem
@@ -1,4 +1,4 @@
1
- import React, { memo, useReducer, useCallback, forwardRef, useImperativeHandle } from 'react';
1
+ import React, { memo, useReducer, forwardRef, useImperativeHandle } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Typography } from '@strapi/design-system/Typography';
4
4
  import { Stack } from '@strapi/design-system/Stack';
@@ -31,28 +31,25 @@ const UsersPermissions = forwardRef(({ permissions, routes }, ref) => {
31
31
  },
32
32
  }));
33
33
 
34
- const handleChange = useCallback(({ target: { name, value } }) => {
34
+ const handleChange = ({ target: { name, value } }) =>
35
35
  dispatch({
36
36
  type: 'ON_CHANGE',
37
37
  keys: name.split('.'),
38
38
  value: value === 'empty__string_value' ? '' : value,
39
39
  });
40
- }, []);
41
40
 
42
- const handleChangeSelectAll = useCallback(({ target: { name, value } }) => {
41
+ const handleChangeSelectAll = ({ target: { name, value } }) =>
43
42
  dispatch({
44
43
  type: 'ON_CHANGE_SELECT_ALL',
45
44
  keys: name.split('.'),
46
45
  value,
47
46
  });
48
- }, []);
49
47
 
50
- const handleSelectedAction = useCallback(actionToSelect => {
48
+ const handleSelectedAction = actionToSelect =>
51
49
  dispatch({
52
50
  type: 'SELECT_ACTION',
53
51
  actionToSelect,
54
52
  });
55
- }, []);
56
53
 
57
54
  const providerValue = {
58
55
  ...state,
@@ -16,6 +16,7 @@ import {
16
16
  NoPermissions,
17
17
  LoadingIndicatorPage,
18
18
  SearchURLQuery,
19
+ useFocusWhenNavigate,
19
20
  useQueryParams,
20
21
  EmptyStateLayout,
21
22
  ConfirmDialog,
@@ -42,6 +43,7 @@ const RoleListPage = () => {
42
43
  const [showConfirmDelete, setShowConfirmDelete] = useState(false);
43
44
  const [isConfirmButtonLoading, setIsConfirmButtonLoading] = useState(false);
44
45
  const [roleToDelete, setRoleToDelete] = useState();
46
+ useFocusWhenNavigate();
45
47
 
46
48
  const queryClient = useQueryClient();
47
49
 
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@strapi/plugin-users-permissions",
3
- "version": "4.0.0-beta.13",
3
+ "version": "4.0.0-beta.17",
4
4
  "description": "Protect your API with a full-authentication process based on JWT",
5
5
  "strapi": {
6
6
  "displayName": "Roles & Permissions",
7
7
  "name": "users-permissions",
8
- "description": "users-permissions.plugin.description",
8
+ "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.",
9
9
  "required": true,
10
10
  "kind": "plugin"
11
11
  },
@@ -14,8 +14,8 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@purest/providers": "^1.0.2",
17
- "@strapi/helper-plugin": "4.0.0-beta.13",
18
- "@strapi/utils": "4.0.0-beta.13",
17
+ "@strapi/helper-plugin": "4.0.0-beta.17",
18
+ "@strapi/utils": "4.0.0-beta.17",
19
19
  "bcryptjs": "2.4.3",
20
20
  "grant-koa": "5.4.8",
21
21
  "jsonwebtoken": "^8.1.0",
@@ -56,5 +56,5 @@
56
56
  "npm": ">=6.0.0"
57
57
  },
58
58
  "license": "SEE LICENSE IN LICENSE",
59
- "gitHead": "3a31a96067aa0a74cabf51282215820ba46dd447"
59
+ "gitHead": "8f9cf3803464d3dbfc8c1090c16bb5f53a60c6c3"
60
60
  }
@@ -13,6 +13,9 @@ module.exports = {
13
13
  'content-manager': {
14
14
  visible: false,
15
15
  },
16
+ 'content-type-builder': {
17
+ visible: false,
18
+ },
16
19
  },
17
20
  attributes: {
18
21
  action: {
@@ -13,6 +13,9 @@ module.exports = {
13
13
  'content-manager': {
14
14
  visible: false,
15
15
  },
16
+ 'content-type-builder': {
17
+ visible: false,
18
+ },
16
19
  },
17
20
  attributes: {
18
21
  name: {