@strapi/plugin-users-permissions 4.0.0-next.6 → 4.0.0
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.
- package/admin/src/components/BoundRoute/getMethodColor.js +41 -0
- package/admin/src/components/BoundRoute/index.js +40 -24
- package/admin/src/components/FormModal/Input/index.js +121 -0
- package/admin/src/components/FormModal/index.js +123 -0
- package/admin/src/components/Permissions/PermissionRow/CheckboxWrapper.js +19 -26
- package/admin/src/components/Permissions/PermissionRow/SubCategory.js +118 -0
- package/admin/src/components/Permissions/PermissionRow/index.js +9 -48
- package/admin/src/components/Permissions/index.js +36 -24
- package/admin/src/components/Permissions/init.js +1 -6
- package/admin/src/components/Policies/index.js +46 -47
- package/admin/src/components/UsersPermissions/index.js +29 -26
- package/admin/src/components/UsersPermissions/init.js +1 -2
- package/admin/src/hooks/useFetchRole/index.js +17 -7
- package/admin/src/hooks/useForm/index.js +3 -29
- package/admin/src/hooks/useForm/reducer.js +2 -21
- package/admin/src/hooks/usePlugins/index.js +12 -21
- package/admin/src/hooks/usePlugins/reducer.js +0 -3
- package/admin/src/index.js +29 -34
- package/admin/src/pages/AdvancedSettings/index.js +210 -193
- package/admin/src/pages/AdvancedSettings/utils/api.js +13 -0
- package/admin/src/pages/AdvancedSettings/utils/layout.js +96 -0
- package/admin/src/pages/AdvancedSettings/utils/schema.js +22 -0
- package/admin/src/pages/EmailTemplates/components/EmailForm.js +173 -0
- package/admin/src/pages/EmailTemplates/components/EmailTable.js +116 -0
- package/admin/src/pages/EmailTemplates/index.js +125 -198
- package/admin/src/pages/EmailTemplates/utils/api.js +13 -0
- package/admin/src/pages/Providers/index.js +208 -216
- package/admin/src/pages/Providers/utils/api.js +21 -0
- package/admin/src/pages/Providers/utils/forms.js +168 -126
- package/admin/src/pages/Roles/CreatePage/index.js +155 -147
- package/admin/src/pages/Roles/EditPage/index.js +162 -134
- package/admin/src/pages/Roles/ListPage/components/TableBody.js +96 -0
- package/admin/src/pages/Roles/ListPage/index.js +176 -156
- package/admin/src/pages/Roles/ListPage/utils/api.js +28 -0
- package/admin/src/pages/Roles/index.js +14 -8
- package/admin/src/permissions.js +12 -14
- package/admin/src/translations/ar.json +0 -8
- package/admin/src/translations/cs.json +0 -8
- package/admin/src/translations/de.json +0 -8
- package/admin/src/translations/dk.json +0 -8
- package/admin/src/translations/en.json +33 -12
- package/admin/src/translations/es.json +0 -8
- package/admin/src/translations/fr.json +0 -8
- package/admin/src/translations/id.json +0 -8
- package/admin/src/translations/it.json +0 -8
- package/admin/src/translations/ja.json +0 -8
- package/admin/src/translations/ko.json +0 -8
- package/admin/src/translations/ms.json +0 -8
- package/admin/src/translations/nl.json +0 -8
- package/admin/src/translations/pl.json +0 -8
- package/admin/src/translations/pt-BR.json +0 -8
- package/admin/src/translations/pt.json +0 -8
- package/admin/src/translations/ru.json +0 -8
- package/admin/src/translations/sk.json +0 -8
- package/admin/src/translations/sv.json +0 -8
- package/admin/src/translations/th.json +0 -8
- package/admin/src/translations/tr.json +0 -8
- package/admin/src/translations/uk.json +0 -8
- package/admin/src/translations/vi.json +0 -8
- package/admin/src/translations/zh-Hans.json +5 -14
- package/admin/src/translations/zh.json +0 -8
- package/admin/src/utils/axiosInstance.js +36 -0
- package/admin/src/utils/formatPluginName.js +26 -0
- package/admin/src/utils/index.js +1 -0
- package/documentation/1.0.0/overrides/users-permissions-Role.json +6 -6
- package/documentation/1.0.0/overrides/users-permissions-User.json +7 -7
- package/package.json +30 -29
- package/{config/functions/bootstrap.js → server/bootstrap/index.js} +26 -33
- package/{config → server/bootstrap}/users-permissions-actions.js +0 -0
- package/server/config.js +23 -0
- package/server/content-types/index.js +11 -0
- package/server/content-types/permission/index.js +34 -0
- package/server/content-types/role/index.js +51 -0
- package/server/content-types/user/index.js +72 -0
- package/{models/User.config.js → server/content-types/user/schema-config.js} +0 -0
- package/server/controllers/auth.js +440 -0
- package/server/controllers/content-manager-user.js +183 -0
- package/server/controllers/index.js +17 -0
- package/server/controllers/permissions.js +26 -0
- package/server/controllers/role.js +77 -0
- package/server/controllers/settings.js +85 -0
- package/server/controllers/user.js +191 -0
- package/server/controllers/validation/auth.js +29 -0
- package/{controllers → server/controllers}/validation/email-template.js +0 -0
- package/server/controllers/validation/user.js +38 -0
- package/server/graphql/index.js +44 -0
- package/server/graphql/mutations/auth/email-confirmation.js +39 -0
- package/server/graphql/mutations/auth/forgot-password.js +38 -0
- package/server/graphql/mutations/auth/login.js +38 -0
- package/server/graphql/mutations/auth/register.js +39 -0
- package/server/graphql/mutations/auth/reset-password.js +41 -0
- package/server/graphql/mutations/crud/role/create-role.js +37 -0
- package/server/graphql/mutations/crud/role/delete-role.js +28 -0
- package/server/graphql/mutations/crud/role/update-role.js +38 -0
- package/server/graphql/mutations/crud/user/create-user.js +48 -0
- package/server/graphql/mutations/crud/user/delete-user.js +42 -0
- package/server/graphql/mutations/crud/user/update-user.js +49 -0
- package/server/graphql/mutations/index.js +42 -0
- package/server/graphql/queries/index.js +13 -0
- package/server/graphql/queries/me.js +17 -0
- package/server/graphql/resolvers-configs.js +37 -0
- package/server/graphql/types/create-role-payload.js +11 -0
- package/server/graphql/types/delete-role-payload.js +11 -0
- package/server/graphql/types/index.js +21 -0
- package/server/graphql/types/login-input.js +13 -0
- package/server/graphql/types/login-payload.js +12 -0
- package/server/graphql/types/me-role.js +14 -0
- package/server/graphql/types/me.js +16 -0
- package/server/graphql/types/password-payload.js +11 -0
- package/server/graphql/types/register-input.js +13 -0
- package/server/graphql/types/update-role-payload.js +11 -0
- package/server/graphql/utils.js +27 -0
- package/server/index.js +21 -0
- package/server/middlewares/index.js +7 -0
- package/{config/policies → server/middlewares}/rateLimit.js +4 -8
- package/server/register.js +11 -0
- package/server/routes/admin/index.js +10 -0
- package/server/routes/admin/permissions.js +20 -0
- package/server/routes/admin/role.js +79 -0
- package/server/routes/admin/settings.js +95 -0
- package/server/routes/content-api/auth.js +73 -0
- package/server/routes/content-api/index.js +11 -0
- package/server/routes/content-api/permissions.js +9 -0
- package/server/routes/content-api/role.js +29 -0
- package/server/routes/content-api/user.js +61 -0
- package/server/routes/index.js +6 -0
- package/server/services/index.js +15 -0
- package/server/services/jwt.js +55 -0
- package/server/services/providers.js +599 -0
- package/server/services/role.js +177 -0
- package/{services → server/services}/user.js +32 -35
- package/server/services/users-permissions.js +233 -0
- package/server/strategies/users-permissions.js +123 -0
- package/{utils → server/utils}/index.d.ts +6 -1
- package/server/utils/index.js +9 -0
- package/strapi-admin.js +3 -0
- package/strapi-server.js +3 -0
- package/admin/src/assets/images/logo.svg +0 -1
- package/admin/src/components/BaselineAlignement/index.js +0 -33
- package/admin/src/components/Bloc/index.js +0 -10
- package/admin/src/components/BoundRoute/Components.js +0 -78
- package/admin/src/components/ContainerFluid/index.js +0 -13
- package/admin/src/components/FormBloc/index.js +0 -61
- package/admin/src/components/IntlInput/index.js +0 -38
- package/admin/src/components/ListBaselineAlignment/index.js +0 -8
- package/admin/src/components/ListRow/Components.js +0 -74
- package/admin/src/components/ListRow/index.js +0 -35
- package/admin/src/components/ModalForm/Wrapper.js +0 -12
- package/admin/src/components/ModalForm/index.js +0 -59
- package/admin/src/components/Permissions/ListWrapper.js +0 -9
- package/admin/src/components/Permissions/PermissionRow/BaselineAlignment.js +0 -7
- package/admin/src/components/Permissions/PermissionRow/RowStyle.js +0 -28
- package/admin/src/components/Permissions/PermissionRow/SubCategory/ConditionsButtonWrapper.js +0 -13
- package/admin/src/components/Permissions/PermissionRow/SubCategory/PolicyWrapper.js +0 -8
- package/admin/src/components/Permissions/PermissionRow/SubCategory/SubCategoryWrapper.js +0 -26
- package/admin/src/components/Permissions/PermissionRow/SubCategory/index.js +0 -116
- package/admin/src/components/Policies/Components.js +0 -26
- package/admin/src/components/PrefixedIcon/index.js +0 -27
- package/admin/src/components/Roles/EmptyRole/BaselineAlignment.js +0 -7
- package/admin/src/components/Roles/EmptyRole/index.js +0 -27
- package/admin/src/components/Roles/RoleListWrapper/index.js +0 -17
- package/admin/src/components/Roles/RoleRow/RoleDescription.js +0 -9
- package/admin/src/components/Roles/RoleRow/index.js +0 -45
- package/admin/src/components/Roles/index.js +0 -3
- package/admin/src/components/SizedInput/index.js +0 -24
- package/admin/src/pages/AdvancedSettings/reducer.js +0 -65
- package/admin/src/pages/AdvancedSettings/utils/form.js +0 -52
- package/admin/src/pages/EmailTemplates/CustomTextInput.js +0 -105
- package/admin/src/pages/EmailTemplates/Wrapper.js +0 -36
- package/admin/src/pages/EmailTemplates/reducer.js +0 -58
- package/admin/src/pages/EmailTemplates/utils/forms.js +0 -81
- package/admin/src/pages/Roles/ListPage/BaselineAlignment.js +0 -8
- package/config/layout.js +0 -10
- package/config/policies/isAuthenticated.js +0 -9
- package/config/policies/permissions.js +0 -94
- package/config/request.json +0 -6
- package/config/routes.json +0 -381
- package/config/schema.graphql.js +0 -284
- package/config/security.json +0 -5
- package/controllers/auth.js +0 -596
- package/controllers/user/admin.js +0 -230
- package/controllers/user/api.js +0 -174
- package/controllers/user.js +0 -117
- package/controllers/users-permissions.js +0 -271
- package/middlewares/users-permissions/defaults.json +0 -5
- package/middlewares/users-permissions/index.js +0 -40
- package/models/Permission.js +0 -7
- package/models/Permission.settings.json +0 -45
- package/models/Role.js +0 -7
- package/models/Role.settings.json +0 -43
- package/models/User.js +0 -7
- package/models/User.settings.json +0 -63
- package/services/jwt.js +0 -65
- package/services/providers.js +0 -598
- package/services/users-permissions.js +0 -429
- package/utils/index.js +0 -11
package/strapi-admin.js
ADDED
package/strapi-server.js
ADDED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg"><text transform="translate(-24 -6)" fill="#4B515A" fill-rule="evenodd" font-size="24" font-family="AppleColorEmoji, Apple Color Emoji"><tspan x="24" y="28">🔐</tspan></text></svg>
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
|
|
4
|
-
// You can see in the index.js file that I used the design system to do the UI integration but
|
|
5
|
-
// sometimes, we need to create some "temporary" custom style to fix the baseline alignment.
|
|
6
|
-
// -----
|
|
7
|
-
// TODO : remove this component. I think that this kind components should not exist in Strapi.
|
|
8
|
-
// I create it to temporary fix the baseline alignment until we have the design system.
|
|
9
|
-
|
|
10
|
-
const BaselineAlignment = styled.div`
|
|
11
|
-
padding-top: ${({ size, top }) => top && size};
|
|
12
|
-
padding-right: ${({ size, right }) => right && size};
|
|
13
|
-
padding-bottom: ${({ size, bottom }) => bottom && size};
|
|
14
|
-
padding-left: ${({ size, left }) => left && size};
|
|
15
|
-
`;
|
|
16
|
-
|
|
17
|
-
BaselineAlignment.defaultProps = {
|
|
18
|
-
bottom: false,
|
|
19
|
-
left: false,
|
|
20
|
-
right: false,
|
|
21
|
-
size: '0',
|
|
22
|
-
top: false,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
BaselineAlignment.propTypes = {
|
|
26
|
-
bottom: PropTypes.bool,
|
|
27
|
-
left: PropTypes.bool,
|
|
28
|
-
right: PropTypes.bool,
|
|
29
|
-
size: PropTypes.string,
|
|
30
|
-
top: PropTypes.bool,
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export default BaselineAlignment;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
|
|
3
|
-
const Bloc = styled.div`
|
|
4
|
-
flex: 1;
|
|
5
|
-
background: ${({ theme }) => theme.main.colors.white};
|
|
6
|
-
border-radius: ${({ theme }) => theme.main.sizes.borderRadius};
|
|
7
|
-
box-shadow: 0 2px 4px #e3e9f3;
|
|
8
|
-
`;
|
|
9
|
-
|
|
10
|
-
export default Bloc;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
import { themePropTypes } from '@strapi/helper-plugin';
|
|
3
|
-
|
|
4
|
-
const Wrapper = styled.div`
|
|
5
|
-
display: flex;
|
|
6
|
-
min-height: 2.4rem;
|
|
7
|
-
border-radius: 3px;
|
|
8
|
-
background-color: #e9eaeb;
|
|
9
|
-
line-height: 2.4rem;
|
|
10
|
-
`;
|
|
11
|
-
|
|
12
|
-
const Header = styled.div`
|
|
13
|
-
margin-bottom: 3rem;
|
|
14
|
-
padding-top: 1.2rem;
|
|
15
|
-
color: #333740;
|
|
16
|
-
font-size: 18px;
|
|
17
|
-
font-weight: ${({ theme }) => theme.main.fontWeights.bold};
|
|
18
|
-
|
|
19
|
-
> span:not(:first-child) {
|
|
20
|
-
color: #787e8f;
|
|
21
|
-
font-size: 16px;
|
|
22
|
-
font-weight: ${({ theme }) => theme.main.fontWeights.semiBold};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
> span:last-child {
|
|
26
|
-
color: #1642e1;
|
|
27
|
-
font-weight: ${({ theme }) => theme.main.fontWeights.bold};
|
|
28
|
-
}
|
|
29
|
-
`;
|
|
30
|
-
|
|
31
|
-
Header.propTypes = {
|
|
32
|
-
...themePropTypes,
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const Path = styled.div`
|
|
36
|
-
padding: 0 1rem;
|
|
37
|
-
font-size: 13px;
|
|
38
|
-
font-weight: ${({ theme }) => theme.main.fontWeights.bold};
|
|
39
|
-
color: #333740;
|
|
40
|
-
`;
|
|
41
|
-
|
|
42
|
-
Path.propTypes = {
|
|
43
|
-
...themePropTypes,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const Verb = styled.div`
|
|
47
|
-
display: flex;
|
|
48
|
-
flex-direction: column;
|
|
49
|
-
justify-content: center;
|
|
50
|
-
padding: 0 1rem;
|
|
51
|
-
border-radius: 3px;
|
|
52
|
-
color: #ffffff;
|
|
53
|
-
font-size: 12px;
|
|
54
|
-
font-weight: ${({ theme }) => theme.main.fontWeights.bold};
|
|
55
|
-
text-transform: uppercase;
|
|
56
|
-
letter-spacing: 0.5px;
|
|
57
|
-
&.get {
|
|
58
|
-
background-color: #008dfe;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
&.post {
|
|
62
|
-
background-color: #69ba05;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
&.put {
|
|
66
|
-
background-color: #f68e0e;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
&.delete {
|
|
70
|
-
background-color: #f64d0a;
|
|
71
|
-
}
|
|
72
|
-
`;
|
|
73
|
-
|
|
74
|
-
Verb.propTypes = {
|
|
75
|
-
...themePropTypes,
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export { Header, Path, Verb, Wrapper };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
import { Container } from 'reactstrap';
|
|
3
|
-
|
|
4
|
-
const ContainerFluid = styled(Container)`
|
|
5
|
-
padding: ${({ padding }) => padding};
|
|
6
|
-
`;
|
|
7
|
-
|
|
8
|
-
ContainerFluid.defaultProps = {
|
|
9
|
-
fluid: true,
|
|
10
|
-
padding: '18px 30px !important',
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export default ContainerFluid;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Flex, Padded, Text } from '@buffetjs/core';
|
|
3
|
-
import { LoadingIndicator } from '@strapi/helper-plugin';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import BaselineAlignement from '../BaselineAlignement';
|
|
6
|
-
import Bloc from '../Bloc';
|
|
7
|
-
|
|
8
|
-
const FormBloc = ({ children, actions, isLoading, title, subtitle }) => (
|
|
9
|
-
<Bloc>
|
|
10
|
-
<BaselineAlignement top size={title ? '18px' : '22px'} />
|
|
11
|
-
<Padded left right size="sm">
|
|
12
|
-
{isLoading ? (
|
|
13
|
-
<>
|
|
14
|
-
<LoadingIndicator />
|
|
15
|
-
<BaselineAlignement bottom size="22px" />
|
|
16
|
-
</>
|
|
17
|
-
) : (
|
|
18
|
-
<>
|
|
19
|
-
{title && (
|
|
20
|
-
<>
|
|
21
|
-
<Padded left right size="xs">
|
|
22
|
-
<Flex justifyContent="space-between">
|
|
23
|
-
<Padded left right size="sm">
|
|
24
|
-
<Text fontSize="lg" fontWeight="bold">
|
|
25
|
-
{title}
|
|
26
|
-
</Text>
|
|
27
|
-
{subtitle && (
|
|
28
|
-
<Text color="grey" lineHeight="1.8rem">
|
|
29
|
-
{subtitle}
|
|
30
|
-
</Text>
|
|
31
|
-
)}
|
|
32
|
-
</Padded>
|
|
33
|
-
{actions}
|
|
34
|
-
</Flex>
|
|
35
|
-
</Padded>
|
|
36
|
-
<BaselineAlignement top size="18px" />
|
|
37
|
-
</>
|
|
38
|
-
)}
|
|
39
|
-
{children}
|
|
40
|
-
</>
|
|
41
|
-
)}
|
|
42
|
-
</Padded>
|
|
43
|
-
</Bloc>
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
FormBloc.defaultProps = {
|
|
47
|
-
actions: null,
|
|
48
|
-
isLoading: false,
|
|
49
|
-
subtitle: null,
|
|
50
|
-
title: null,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
FormBloc.propTypes = {
|
|
54
|
-
actions: PropTypes.any,
|
|
55
|
-
children: PropTypes.node.isRequired,
|
|
56
|
-
isLoading: PropTypes.bool,
|
|
57
|
-
subtitle: PropTypes.string,
|
|
58
|
-
title: PropTypes.string,
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export default FormBloc;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
2
|
-
import { translatedErrors } from '@strapi/helper-plugin';
|
|
3
|
-
import { useIntl } from 'react-intl';
|
|
4
|
-
import { Inputs } from '@buffetjs/custom';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
|
-
|
|
7
|
-
const IntlInput = ({ label: labelId, defaultMessage, error, ...rest }) => {
|
|
8
|
-
const { formatMessage } = useIntl();
|
|
9
|
-
const label = formatMessage({ id: labelId, defaultMessage: defaultMessage || labelId });
|
|
10
|
-
const translatedError = error ? formatMessage(error) : null;
|
|
11
|
-
const formattedErrors = useMemo(() => {
|
|
12
|
-
return Object.keys(translatedErrors).reduce((acc, current) => {
|
|
13
|
-
acc[current] = formatMessage({ id: translatedErrors[current] });
|
|
14
|
-
|
|
15
|
-
return acc;
|
|
16
|
-
}, {});
|
|
17
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
18
|
-
}, []);
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<Inputs {...rest} label={label} error={translatedError} translatedErrors={formattedErrors} />
|
|
22
|
-
);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
IntlInput.defaultProps = {
|
|
26
|
-
defaultMessage: null,
|
|
27
|
-
error: null,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
IntlInput.propTypes = {
|
|
31
|
-
defaultMessage: PropTypes.string,
|
|
32
|
-
error: PropTypes.shape({
|
|
33
|
-
id: PropTypes.string,
|
|
34
|
-
}),
|
|
35
|
-
label: PropTypes.string.isRequired,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export default IntlInput;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
|
|
3
|
-
const Container = styled.div`
|
|
4
|
-
margin: 0 3.2rem 0 1.9rem;
|
|
5
|
-
padding: 0 1.4rem 0 0rem;
|
|
6
|
-
border-bottom: 1px solid rgba(14, 22, 34, 0.04);
|
|
7
|
-
color: #333740;
|
|
8
|
-
font-size: 1.3rem;
|
|
9
|
-
> div {
|
|
10
|
-
padding: 0;
|
|
11
|
-
align-self: center;
|
|
12
|
-
}
|
|
13
|
-
> div:first-child {
|
|
14
|
-
padding-left: 1.4rem;
|
|
15
|
-
}
|
|
16
|
-
> div:last-child {
|
|
17
|
-
text-align: right;
|
|
18
|
-
}
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
const Flex = styled.div`
|
|
22
|
-
display: flex;
|
|
23
|
-
padding-left: 7px;
|
|
24
|
-
font-weight: 600;
|
|
25
|
-
> div:first-child {
|
|
26
|
-
width: 17px;
|
|
27
|
-
padding-top: 2px;
|
|
28
|
-
> i,
|
|
29
|
-
> svg {
|
|
30
|
-
font-size: 12px;
|
|
31
|
-
vertical-align: inherit;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
> div:last-child {
|
|
35
|
-
width: 80%;
|
|
36
|
-
margin-left: 54px;
|
|
37
|
-
padding-left: 7px;
|
|
38
|
-
text-align: left;
|
|
39
|
-
font-weight: 500 !important;
|
|
40
|
-
}
|
|
41
|
-
`;
|
|
42
|
-
|
|
43
|
-
const Row = styled.div`
|
|
44
|
-
margin-top: 0 !important;
|
|
45
|
-
position: relative;
|
|
46
|
-
height: 5.4rem;
|
|
47
|
-
line-height: 5.4rem;
|
|
48
|
-
cursor: pointer;
|
|
49
|
-
&:hover {
|
|
50
|
-
background-color: #f7f8f8;
|
|
51
|
-
}
|
|
52
|
-
div {
|
|
53
|
-
overflow: hidden;
|
|
54
|
-
text-overflow: ellipsis;
|
|
55
|
-
white-space: nowrap;
|
|
56
|
-
}
|
|
57
|
-
`;
|
|
58
|
-
|
|
59
|
-
const Wrapper = styled.div`
|
|
60
|
-
> div:first-child {
|
|
61
|
-
text-align: left;
|
|
62
|
-
}
|
|
63
|
-
> div:nth-of-type(2) {
|
|
64
|
-
text-align: center;
|
|
65
|
-
}
|
|
66
|
-
strong {
|
|
67
|
-
font-weight: 600;
|
|
68
|
-
}
|
|
69
|
-
b {
|
|
70
|
-
font-weight: 500;
|
|
71
|
-
}
|
|
72
|
-
`;
|
|
73
|
-
|
|
74
|
-
export { Container, Flex, Row, Wrapper };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { CustomRow } from '@buffetjs/styles';
|
|
3
|
-
import { IconLinks } from '@buffetjs/core';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import PrefixedIcon from '../PrefixedIcon';
|
|
6
|
-
|
|
7
|
-
const ListRow = ({ icon, name, onClick, links, children }) => {
|
|
8
|
-
return (
|
|
9
|
-
<CustomRow onClick={onClick}>
|
|
10
|
-
<td>
|
|
11
|
-
<PrefixedIcon icon={icon} name={name} />
|
|
12
|
-
</td>
|
|
13
|
-
{children}
|
|
14
|
-
<td>
|
|
15
|
-
<IconLinks links={links} />
|
|
16
|
-
</td>
|
|
17
|
-
</CustomRow>
|
|
18
|
-
);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
ListRow.defaultProps = {
|
|
22
|
-
children: null,
|
|
23
|
-
onClick: () => {},
|
|
24
|
-
links: [],
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
ListRow.propTypes = {
|
|
28
|
-
children: PropTypes.node,
|
|
29
|
-
icon: PropTypes.array.isRequired,
|
|
30
|
-
links: PropTypes.array,
|
|
31
|
-
name: PropTypes.string.isRequired,
|
|
32
|
-
onClick: PropTypes.func,
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export default ListRow;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Modal, ModalHeader, ModalSection, ModalFooter } from '@strapi/helper-plugin';
|
|
3
|
-
import { useIntl } from 'react-intl';
|
|
4
|
-
import { Button, Padded } from '@buffetjs/core';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
|
-
import BaselineAlignment from '../ListBaselineAlignment';
|
|
7
|
-
import Wrapper from './Wrapper';
|
|
8
|
-
|
|
9
|
-
const ModalForm = ({
|
|
10
|
-
children,
|
|
11
|
-
headerBreadcrumbs,
|
|
12
|
-
isLoading,
|
|
13
|
-
isOpen,
|
|
14
|
-
onCancel,
|
|
15
|
-
onClosed,
|
|
16
|
-
onClick,
|
|
17
|
-
onOpened,
|
|
18
|
-
onToggle,
|
|
19
|
-
}) => {
|
|
20
|
-
const { formatMessage } = useIntl();
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<Modal isOpen={isOpen} onOpened={onOpened} onToggle={onToggle} onClosed={onClosed}>
|
|
24
|
-
<ModalHeader headerBreadcrumbs={headerBreadcrumbs} />
|
|
25
|
-
<ModalSection>
|
|
26
|
-
<Wrapper>
|
|
27
|
-
<BaselineAlignment />
|
|
28
|
-
<Padded top size="md">
|
|
29
|
-
{children}
|
|
30
|
-
</Padded>
|
|
31
|
-
</Wrapper>
|
|
32
|
-
</ModalSection>
|
|
33
|
-
<ModalFooter>
|
|
34
|
-
<section>
|
|
35
|
-
<Button type="button" color="cancel" onClick={onCancel}>
|
|
36
|
-
{formatMessage({ id: 'app.components.Button.cancel' })}
|
|
37
|
-
</Button>
|
|
38
|
-
<Button color="success" type="button" onClick={onClick} isLoading={isLoading}>
|
|
39
|
-
{formatMessage({ id: 'app.components.Button.save' })}
|
|
40
|
-
</Button>
|
|
41
|
-
</section>
|
|
42
|
-
</ModalFooter>
|
|
43
|
-
</Modal>
|
|
44
|
-
);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
ModalForm.propTypes = {
|
|
48
|
-
children: PropTypes.node.isRequired,
|
|
49
|
-
headerBreadcrumbs: PropTypes.array.isRequired,
|
|
50
|
-
isLoading: PropTypes.bool.isRequired,
|
|
51
|
-
isOpen: PropTypes.bool.isRequired,
|
|
52
|
-
onCancel: PropTypes.func.isRequired,
|
|
53
|
-
onClosed: PropTypes.func.isRequired,
|
|
54
|
-
onClick: PropTypes.func.isRequired,
|
|
55
|
-
onOpened: PropTypes.func.isRequired,
|
|
56
|
-
onToggle: PropTypes.func.isRequired,
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export default ModalForm;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
import { Text } from '@buffetjs/core';
|
|
3
|
-
|
|
4
|
-
const activeStyle = theme => `
|
|
5
|
-
background-color: ${({ theme }) => theme.main.colors.lightestBlue};
|
|
6
|
-
border: 1px solid ${theme.main.colors.darkBlue};
|
|
7
|
-
${Text} {
|
|
8
|
-
color: ${theme.main.colors.mediumBlue};
|
|
9
|
-
}
|
|
10
|
-
svg {
|
|
11
|
-
color: ${theme.main.colors.mediumBlue};
|
|
12
|
-
}
|
|
13
|
-
`;
|
|
14
|
-
|
|
15
|
-
const RowStyle = styled.div`
|
|
16
|
-
height: 5.4rem;
|
|
17
|
-
padding: 1rem 3rem;
|
|
18
|
-
border: 1px solid transparent;
|
|
19
|
-
background-color: ${({ theme, isWhite }) => theme.main.colors[isWhite ? 'white' : 'lightGrey']};
|
|
20
|
-
cursor: pointer;
|
|
21
|
-
&:hover {
|
|
22
|
-
background-color: ${({ theme }) => theme.main.colors.lightestBlue};
|
|
23
|
-
${({ theme }) => activeStyle(theme)};
|
|
24
|
-
}
|
|
25
|
-
${({ isActive, theme }) => isActive && activeStyle(theme)};
|
|
26
|
-
`;
|
|
27
|
-
|
|
28
|
-
export default RowStyle;
|
package/admin/src/components/Permissions/PermissionRow/SubCategory/ConditionsButtonWrapper.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/* eslint-disable indent */
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
|
|
4
|
-
const ConditionsButtonWrapper = styled.div`
|
|
5
|
-
padding: 0.9rem;
|
|
6
|
-
${({ hasConditions }) =>
|
|
7
|
-
hasConditions &&
|
|
8
|
-
`
|
|
9
|
-
padding-left: 22px;
|
|
10
|
-
`}
|
|
11
|
-
`;
|
|
12
|
-
|
|
13
|
-
export default ConditionsButtonWrapper;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/* eslint-disable indent */
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
|
|
4
|
-
const SubCategoryWrapper = styled.div`
|
|
5
|
-
padding-bottom: 2.6rem;
|
|
6
|
-
input[type='checkbox'] {
|
|
7
|
-
&:after {
|
|
8
|
-
color: ${({ theme }) => theme.main.colors.mediumBlue};
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
${({ disabled, theme }) =>
|
|
12
|
-
disabled &&
|
|
13
|
-
`
|
|
14
|
-
label {
|
|
15
|
-
cursor: default !important;
|
|
16
|
-
color: ${theme.main.colors.grey};
|
|
17
|
-
}
|
|
18
|
-
input[type='checkbox'] {
|
|
19
|
-
&:after {
|
|
20
|
-
color: ${theme.main.colors.grey};
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
`}
|
|
24
|
-
`;
|
|
25
|
-
|
|
26
|
-
export default SubCategoryWrapper;
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useMemo } from 'react';
|
|
2
|
-
import { get } from 'lodash';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import { Flex, Padded, Text, Checkbox } from '@buffetjs/core';
|
|
6
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
7
|
-
import { useIntl } from 'react-intl';
|
|
8
|
-
import CheckboxWrapper from '../CheckboxWrapper';
|
|
9
|
-
import BaselineAlignment from '../BaselineAlignment';
|
|
10
|
-
import SubCategoryWrapper from './SubCategoryWrapper';
|
|
11
|
-
import { useUsersPermissions } from '../../../../contexts/UsersPermissionsContext';
|
|
12
|
-
import PolicyWrapper from './PolicyWrapper';
|
|
13
|
-
|
|
14
|
-
const Border = styled.div`
|
|
15
|
-
flex: 1;
|
|
16
|
-
align-self: center;
|
|
17
|
-
border-top: 1px solid #f6f6f6;
|
|
18
|
-
padding: 0px 10px;
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
const SubCategory = ({ subCategory }) => {
|
|
22
|
-
const { formatMessage } = useIntl();
|
|
23
|
-
const {
|
|
24
|
-
onChange,
|
|
25
|
-
onChangeSelectAll,
|
|
26
|
-
onSelectedAction,
|
|
27
|
-
selectedAction,
|
|
28
|
-
modifiedData,
|
|
29
|
-
} = useUsersPermissions();
|
|
30
|
-
|
|
31
|
-
const currentScopedModifiedData = useMemo(() => {
|
|
32
|
-
return get(modifiedData, subCategory.name, {});
|
|
33
|
-
}, [modifiedData, subCategory]);
|
|
34
|
-
|
|
35
|
-
const hasAllActionsSelected = useMemo(() => {
|
|
36
|
-
return Object.values(currentScopedModifiedData).every(action => action.enabled === true);
|
|
37
|
-
}, [currentScopedModifiedData]);
|
|
38
|
-
|
|
39
|
-
const hasSomeActionsSelected = useMemo(() => {
|
|
40
|
-
return (
|
|
41
|
-
Object.values(currentScopedModifiedData).some(action => action.enabled === true) &&
|
|
42
|
-
!hasAllActionsSelected
|
|
43
|
-
);
|
|
44
|
-
}, [currentScopedModifiedData, hasAllActionsSelected]);
|
|
45
|
-
|
|
46
|
-
const handleChangeSelectAll = useCallback(
|
|
47
|
-
({ target: { name } }) => {
|
|
48
|
-
onChangeSelectAll({ target: { name, value: !hasAllActionsSelected } });
|
|
49
|
-
},
|
|
50
|
-
[hasAllActionsSelected, onChangeSelectAll]
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
const isActionSelected = useCallback(
|
|
54
|
-
actionName => {
|
|
55
|
-
return selectedAction === actionName;
|
|
56
|
-
},
|
|
57
|
-
[selectedAction]
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
return (
|
|
61
|
-
<SubCategoryWrapper>
|
|
62
|
-
<Flex justifyContent="space-between" alignItems="center">
|
|
63
|
-
<Padded right size="sm">
|
|
64
|
-
<Text
|
|
65
|
-
lineHeight="18px"
|
|
66
|
-
color="#919bae"
|
|
67
|
-
fontWeight="bold"
|
|
68
|
-
fontSize="xs"
|
|
69
|
-
textTransform="uppercase"
|
|
70
|
-
>
|
|
71
|
-
{subCategory.label}
|
|
72
|
-
</Text>
|
|
73
|
-
</Padded>
|
|
74
|
-
<Border />
|
|
75
|
-
<Padded left size="sm">
|
|
76
|
-
<BaselineAlignment />
|
|
77
|
-
<Checkbox
|
|
78
|
-
name={subCategory.name}
|
|
79
|
-
message={formatMessage({ id: 'app.utils.select-all' })}
|
|
80
|
-
onChange={handleChangeSelectAll}
|
|
81
|
-
someChecked={hasSomeActionsSelected}
|
|
82
|
-
value={hasAllActionsSelected}
|
|
83
|
-
/>
|
|
84
|
-
</Padded>
|
|
85
|
-
</Flex>
|
|
86
|
-
<BaselineAlignment />
|
|
87
|
-
<Padded top size="xs">
|
|
88
|
-
<Flex flexWrap="wrap">
|
|
89
|
-
{subCategory.actions.map(action => {
|
|
90
|
-
const name = `${action.name}.enabled`;
|
|
91
|
-
|
|
92
|
-
return (
|
|
93
|
-
<CheckboxWrapper isActive={isActionSelected(action.name)} key={action.name}>
|
|
94
|
-
<Checkbox
|
|
95
|
-
value={get(modifiedData, name, false)}
|
|
96
|
-
name={name}
|
|
97
|
-
message={action.label}
|
|
98
|
-
onChange={onChange}
|
|
99
|
-
/>
|
|
100
|
-
<PolicyWrapper onClick={() => onSelectedAction(action.name)}>
|
|
101
|
-
<FontAwesomeIcon icon="cog" />
|
|
102
|
-
</PolicyWrapper>
|
|
103
|
-
</CheckboxWrapper>
|
|
104
|
-
);
|
|
105
|
-
})}
|
|
106
|
-
</Flex>
|
|
107
|
-
</Padded>
|
|
108
|
-
</SubCategoryWrapper>
|
|
109
|
-
);
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
SubCategory.propTypes = {
|
|
113
|
-
subCategory: PropTypes.object.isRequired,
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
export default SubCategory;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
import { themePropTypes } from '@strapi/helper-plugin';
|
|
3
|
-
|
|
4
|
-
const Wrapper = styled.div`
|
|
5
|
-
min-height: 100%;
|
|
6
|
-
background-color: #f6f6f6;
|
|
7
|
-
`;
|
|
8
|
-
|
|
9
|
-
const Header = styled.div`
|
|
10
|
-
margin-bottom: 1.1rem;
|
|
11
|
-
padding-top: 1.1rem;
|
|
12
|
-
font-size: 18px;
|
|
13
|
-
font-weight: ${({ theme }) => theme.main.fontWeights.bold};
|
|
14
|
-
line-height: 3.6rem;
|
|
15
|
-
`;
|
|
16
|
-
|
|
17
|
-
const Sticky = styled.div`
|
|
18
|
-
position: sticky;
|
|
19
|
-
top: 70px;
|
|
20
|
-
`;
|
|
21
|
-
|
|
22
|
-
Header.propTypes = {
|
|
23
|
-
...themePropTypes,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export { Header, Wrapper, Sticky };
|