@strapi/plugin-users-permissions 4.0.0-beta.15 → 4.0.0-beta.16
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, {
|
|
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 =
|
|
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
|
|
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,
|
|
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 =>
|
|
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,
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/plugin-users-permissions",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.16",
|
|
4
4
|
"description": "Protect your API with a full-authentication process based on JWT",
|
|
5
5
|
"strapi": {
|
|
6
6
|
"displayName": "Roles & Permissions",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@purest/providers": "^1.0.2",
|
|
17
|
-
"@strapi/helper-plugin": "4.0.0-beta.
|
|
18
|
-
"@strapi/utils": "4.0.0-beta.
|
|
17
|
+
"@strapi/helper-plugin": "4.0.0-beta.16",
|
|
18
|
+
"@strapi/utils": "4.0.0-beta.16",
|
|
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": "
|
|
59
|
+
"gitHead": "71bdfa34637832e8e78a6cf1b57c8c6dbadf133d"
|
|
60
60
|
}
|