@akemona-org/strapi-plugin-users-permissions 3.12.4 → 3.13.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/FormBloc/index.js +3 -3
- package/admin/src/components/IntlInput/index.js +2 -2
- package/admin/src/components/ListRow/index.js +2 -2
- package/admin/src/components/ModalForm/index.js +3 -3
- package/admin/src/components/Permissions/PermissionRow/SubCategory/index.js +2 -2
- package/admin/src/components/Permissions/PermissionRow/index.js +2 -2
- package/admin/src/components/Permissions/index.js +2 -2
- package/admin/src/components/Policies/index.js +2 -2
- package/admin/src/components/PrefixedIcon/index.js +2 -2
- package/admin/src/components/Roles/EmptyRole/index.js +2 -2
- package/admin/src/components/Roles/RoleRow/index.js +2 -2
- package/admin/src/components/SizedInput/index.js +2 -2
- package/admin/src/containers/AdvancedSettings/index.js +2 -2
- package/admin/src/containers/EmailTemplates/CustomTextInput.js +3 -3
- package/admin/src/containers/EmailTemplates/index.js +2 -2
- package/admin/src/containers/Providers/index.js +2 -2
- package/admin/src/containers/Roles/CreatePage/index.js +2 -2
- package/admin/src/containers/Roles/EditPage/index.js +2 -2
- package/admin/src/containers/Roles/ListPage/index.js +2 -2
- package/admin/src/containers/Roles/ProtectedCreatePage/index.js +3 -3
- package/admin/src/containers/Roles/ProtectedEditPage/index.js +3 -3
- package/admin/src/containers/Roles/ProtectedListPage/index.js +2 -2
- package/admin/src/containers/Roles/index.js +2 -2
- package/admin/src/contexts/EditPage/index.js +2 -2
- package/admin/src/contexts/HomePage/index.js +2 -2
- package/admin/src/contexts/UsersPermissionsContext/index.js +2 -2
- package/config/policies/permissions.js +2 -3
- package/controllers/UsersPermissions.js +6 -9
- package/package.json +4 -4
- package/services/User.js +4 -6
|
@@ -5,8 +5,8 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import BaselineAlignement from '../BaselineAlignement';
|
|
6
6
|
import Bloc from '../Bloc';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
<Bloc>
|
|
8
|
+
function FormBloc({ children, actions, isLoading, title, subtitle }) {
|
|
9
|
+
return <Bloc>
|
|
10
10
|
<BaselineAlignement top size={title ? '18px' : '22px'} />
|
|
11
11
|
<Padded left right size="sm">
|
|
12
12
|
{isLoading ? (
|
|
@@ -41,7 +41,7 @@ const FormBloc = ({ children, actions, isLoading, title, subtitle }) => (
|
|
|
41
41
|
)}
|
|
42
42
|
</Padded>
|
|
43
43
|
</Bloc>
|
|
44
|
-
|
|
44
|
+
}
|
|
45
45
|
|
|
46
46
|
FormBloc.defaultProps = {
|
|
47
47
|
actions: null,
|
|
@@ -4,7 +4,7 @@ import { useIntl } from 'react-intl';
|
|
|
4
4
|
import { Inputs } from '@buffetjs/custom';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
function IntlInput({ label: labelId, defaultMessage, error, ...rest }) {
|
|
8
8
|
const { formatMessage } = useIntl();
|
|
9
9
|
const label = formatMessage({ id: labelId, defaultMessage: defaultMessage || labelId });
|
|
10
10
|
const translatedError = error ? formatMessage(error) : null;
|
|
@@ -20,7 +20,7 @@ const IntlInput = ({ label: labelId, defaultMessage, error, ...rest }) => {
|
|
|
20
20
|
return (
|
|
21
21
|
<Inputs {...rest} label={label} error={translatedError} translatedErrors={formattedErrors} />
|
|
22
22
|
);
|
|
23
|
-
}
|
|
23
|
+
}
|
|
24
24
|
|
|
25
25
|
IntlInput.defaultProps = {
|
|
26
26
|
defaultMessage: null,
|
|
@@ -4,7 +4,7 @@ import { IconLinks } from '@buffetjs/core';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import PrefixedIcon from '../PrefixedIcon';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
function ListRow({ icon, name, onClick, links, children }) {
|
|
8
8
|
return (
|
|
9
9
|
<CustomRow onClick={onClick}>
|
|
10
10
|
<td>
|
|
@@ -16,7 +16,7 @@ const ListRow = ({ icon, name, onClick, links, children }) => {
|
|
|
16
16
|
</td>
|
|
17
17
|
</CustomRow>
|
|
18
18
|
);
|
|
19
|
-
}
|
|
19
|
+
}
|
|
20
20
|
|
|
21
21
|
ListRow.defaultProps = {
|
|
22
22
|
children: null,
|
|
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import BaselineAlignment from '../ListBaselineAlignment';
|
|
7
7
|
import Wrapper from './Wrapper';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
function ModalForm({
|
|
10
10
|
children,
|
|
11
11
|
headerBreadcrumbs,
|
|
12
12
|
isLoading,
|
|
@@ -16,7 +16,7 @@ const ModalForm = ({
|
|
|
16
16
|
onClick,
|
|
17
17
|
onOpened,
|
|
18
18
|
onToggle,
|
|
19
|
-
})
|
|
19
|
+
}) {
|
|
20
20
|
const { formatMessage } = useIntl();
|
|
21
21
|
|
|
22
22
|
return (
|
|
@@ -42,7 +42,7 @@ const ModalForm = ({
|
|
|
42
42
|
</ModalFooter>
|
|
43
43
|
</Modal>
|
|
44
44
|
);
|
|
45
|
-
}
|
|
45
|
+
}
|
|
46
46
|
|
|
47
47
|
ModalForm.propTypes = {
|
|
48
48
|
children: PropTypes.node.isRequired,
|
|
@@ -18,7 +18,7 @@ const Border = styled.div`
|
|
|
18
18
|
padding: 0px 10px;
|
|
19
19
|
`;
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
function SubCategory({ subCategory }) {
|
|
22
22
|
const { formatMessage } = useIntl();
|
|
23
23
|
const { onChange, onChangeSelectAll, onSelectedAction, selectedAction, modifiedData } =
|
|
24
24
|
useUsersPermissions();
|
|
@@ -102,7 +102,7 @@ const SubCategory = ({ subCategory }) => {
|
|
|
102
102
|
</Padded>
|
|
103
103
|
</SubCategoryWrapper>
|
|
104
104
|
);
|
|
105
|
-
}
|
|
105
|
+
}
|
|
106
106
|
|
|
107
107
|
SubCategory.propTypes = {
|
|
108
108
|
subCategory: PropTypes.object.isRequired,
|
|
@@ -10,7 +10,7 @@ import getTrad from '../../../utils/getTrad';
|
|
|
10
10
|
import SubCategory from './SubCategory';
|
|
11
11
|
import RowStyle from './RowStyle';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
function PermissionRow({ isOpen, isWhite, name, onOpenPlugin, permissions }) {
|
|
14
14
|
const { formatMessage } = useIntl();
|
|
15
15
|
|
|
16
16
|
const subCategories = useMemo(() => {
|
|
@@ -79,7 +79,7 @@ const PermissionRow = ({ isOpen, isWhite, name, onOpenPlugin, permissions }) =>
|
|
|
79
79
|
)}
|
|
80
80
|
</RowContainer>
|
|
81
81
|
);
|
|
82
|
-
}
|
|
82
|
+
}
|
|
83
83
|
|
|
84
84
|
PermissionRow.propTypes = {
|
|
85
85
|
isOpen: PropTypes.bool.isRequired,
|
|
@@ -6,7 +6,7 @@ import PermissionRow from './PermissionRow';
|
|
|
6
6
|
import init from './init';
|
|
7
7
|
import { initialState, reducer } from './reducer';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
function Permissions() {
|
|
10
10
|
const { modifiedData } = useUsersPermissions();
|
|
11
11
|
const [{ collapses }, dispatch] = useReducer(reducer, initialState, (state) =>
|
|
12
12
|
init(state, modifiedData)
|
|
@@ -39,6 +39,6 @@ const Permissions = () => {
|
|
|
39
39
|
</Padded>
|
|
40
40
|
</ListWrapper>
|
|
41
41
|
);
|
|
42
|
-
}
|
|
42
|
+
}
|
|
43
43
|
|
|
44
44
|
export default memo(Permissions);
|
|
@@ -8,7 +8,7 @@ import BoundRoute from '../BoundRoute';
|
|
|
8
8
|
import SizedInput from '../SizedInput';
|
|
9
9
|
import { Header, Wrapper, Sticky } from './Components';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
function Policies() {
|
|
12
12
|
const { modifiedData, selectedAction, routes, policies, onChange } = useUsersPermissions();
|
|
13
13
|
const baseTitle = 'users-permissions.Policies.header';
|
|
14
14
|
const title = !selectedAction ? 'hint' : 'title';
|
|
@@ -56,6 +56,6 @@ const Policies = () => {
|
|
|
56
56
|
</Sticky>
|
|
57
57
|
</Wrapper>
|
|
58
58
|
);
|
|
59
|
-
}
|
|
59
|
+
}
|
|
60
60
|
|
|
61
61
|
export default Policies;
|
|
@@ -4,7 +4,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
|
4
4
|
import { upperFirst } from 'lodash';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
function PrefixedIcon({ icon, name }) {
|
|
8
8
|
return (
|
|
9
9
|
<Flex>
|
|
10
10
|
<div>
|
|
@@ -17,7 +17,7 @@ const PrefixedIcon = ({ icon, name }) => {
|
|
|
17
17
|
</Padded>
|
|
18
18
|
</Flex>
|
|
19
19
|
);
|
|
20
|
-
}
|
|
20
|
+
}
|
|
21
21
|
|
|
22
22
|
PrefixedIcon.propTypes = {
|
|
23
23
|
icon: PropTypes.array.isRequired,
|
|
@@ -4,7 +4,7 @@ import { useIntl } from 'react-intl';
|
|
|
4
4
|
|
|
5
5
|
import BaselineAlignment from './BaselineAlignment';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
function EmptyRole() {
|
|
8
8
|
const { formatMessage } = useIntl();
|
|
9
9
|
|
|
10
10
|
return (
|
|
@@ -22,6 +22,6 @@ const EmptyRole = () => {
|
|
|
22
22
|
</Padded>
|
|
23
23
|
</>
|
|
24
24
|
);
|
|
25
|
-
}
|
|
25
|
+
}
|
|
26
26
|
|
|
27
27
|
export default EmptyRole;
|
|
@@ -6,7 +6,7 @@ import { useIntl } from 'react-intl';
|
|
|
6
6
|
|
|
7
7
|
import RoleDescription from './RoleDescription';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
function RoleRow({ role, onClick, links }) {
|
|
10
10
|
const { formatMessage } = useIntl();
|
|
11
11
|
const number = role.nb_users;
|
|
12
12
|
const text = formatMessage(
|
|
@@ -30,7 +30,7 @@ const RoleRow = ({ role, onClick, links }) => {
|
|
|
30
30
|
</td>
|
|
31
31
|
</CustomRow>
|
|
32
32
|
);
|
|
33
|
-
}
|
|
33
|
+
}
|
|
34
34
|
|
|
35
35
|
RoleRow.defaultProps = {
|
|
36
36
|
onClick: null,
|
|
@@ -3,13 +3,13 @@ import { Col } from 'reactstrap';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import IntlInput from '../IntlInput';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
function SizedInput({ size, ...rest }) {
|
|
7
7
|
return (
|
|
8
8
|
<Col {...size}>
|
|
9
9
|
<IntlInput {...rest} />
|
|
10
10
|
</Col>
|
|
11
11
|
);
|
|
12
|
-
}
|
|
12
|
+
}
|
|
13
13
|
|
|
14
14
|
SizedInput.defaultProps = {
|
|
15
15
|
size: {
|
|
@@ -16,7 +16,7 @@ import ListBaselineAlignment from '../../components/ListBaselineAlignment';
|
|
|
16
16
|
import form from './utils/form';
|
|
17
17
|
import reducer, { initialState } from './reducer';
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
function AdvancedSettingsPage() {
|
|
20
20
|
const { formatMessage } = useIntl();
|
|
21
21
|
const [showModalWarning, setShowModalWarning] = useState(false);
|
|
22
22
|
const pageTitle = formatMessage({
|
|
@@ -211,6 +211,6 @@ const AdvancedSettingsPage = () => {
|
|
|
211
211
|
/>
|
|
212
212
|
</>
|
|
213
213
|
);
|
|
214
|
-
}
|
|
214
|
+
}
|
|
215
215
|
|
|
216
216
|
export default AdvancedSettingsPage;
|
|
@@ -12,7 +12,7 @@ import { Description, ErrorMessage } from '@buffetjs/styles';
|
|
|
12
12
|
import { getTrad } from '../../utils';
|
|
13
13
|
import Wrapper from './Wrapper';
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
function CustomTextInput({
|
|
16
16
|
description,
|
|
17
17
|
error: inputError,
|
|
18
18
|
label,
|
|
@@ -21,7 +21,7 @@ const CustomTextInput = ({
|
|
|
21
21
|
validations,
|
|
22
22
|
value,
|
|
23
23
|
...rest
|
|
24
|
-
})
|
|
24
|
+
}) {
|
|
25
25
|
const inputId = name;
|
|
26
26
|
const descriptionId = `description-${inputId}`;
|
|
27
27
|
const errorId = `error-${inputId}`;
|
|
@@ -76,7 +76,7 @@ const CustomTextInput = ({
|
|
|
76
76
|
)}
|
|
77
77
|
</Error>
|
|
78
78
|
);
|
|
79
|
-
}
|
|
79
|
+
}
|
|
80
80
|
|
|
81
81
|
CustomTextInput.defaultProps = {
|
|
82
82
|
description: null,
|
|
@@ -20,7 +20,7 @@ import { getRequestURL, getTrad } from '../../utils';
|
|
|
20
20
|
import forms from './utils/forms';
|
|
21
21
|
import schema from './utils/schema';
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
function EmailTemplatesPage() {
|
|
24
24
|
const { formatMessage } = useIntl();
|
|
25
25
|
const { emitEvent } = useGlobalContext();
|
|
26
26
|
const emitEventRef = useRef(emitEvent);
|
|
@@ -217,6 +217,6 @@ const EmailTemplatesPage = () => {
|
|
|
217
217
|
</ModalForm>
|
|
218
218
|
</>
|
|
219
219
|
);
|
|
220
|
-
}
|
|
220
|
+
}
|
|
221
221
|
|
|
222
222
|
export default EmailTemplatesPage;
|
|
@@ -21,7 +21,7 @@ import ModalForm from '../../components/ModalForm';
|
|
|
21
21
|
import createProvidersArray from './utils/createProvidersArray';
|
|
22
22
|
import forms from './utils/forms';
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
function ProvidersPage() {
|
|
25
25
|
const { formatMessage } = useIntl();
|
|
26
26
|
const { emitEvent } = useGlobalContext();
|
|
27
27
|
const emitEventRef = useRef(emitEvent);
|
|
@@ -278,6 +278,6 @@ const ProvidersPage = () => {
|
|
|
278
278
|
</ModalForm>
|
|
279
279
|
</>
|
|
280
280
|
);
|
|
281
|
-
}
|
|
281
|
+
}
|
|
282
282
|
|
|
283
283
|
export default ProvidersPage;
|
|
@@ -15,7 +15,7 @@ import UsersPermissions from '../../../components/UsersPermissions';
|
|
|
15
15
|
import { usePlugins } from '../../../hooks';
|
|
16
16
|
import schema from './utils/schema';
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
function CreatePage() {
|
|
19
19
|
const { formatMessage } = useIntl();
|
|
20
20
|
const { emitEvent } = useGlobalContext();
|
|
21
21
|
const { goBack } = useHistory();
|
|
@@ -162,6 +162,6 @@ const CreatePage = () => {
|
|
|
162
162
|
}}
|
|
163
163
|
</Formik>
|
|
164
164
|
);
|
|
165
|
-
}
|
|
165
|
+
}
|
|
166
166
|
|
|
167
167
|
export default CreatePage;
|
|
@@ -17,7 +17,7 @@ import { usePlugins, useFetchRole } from '../../../hooks';
|
|
|
17
17
|
|
|
18
18
|
import schema from './utils/schema';
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
function EditPage() {
|
|
21
21
|
const { formatMessage } = useIntl();
|
|
22
22
|
const [isSubmiting, setIsSubmiting] = useState(false);
|
|
23
23
|
const { settingsBaseURL } = useGlobalContext();
|
|
@@ -156,6 +156,6 @@ const EditPage = () => {
|
|
|
156
156
|
)}
|
|
157
157
|
</Formik>
|
|
158
158
|
);
|
|
159
|
-
}
|
|
159
|
+
}
|
|
160
160
|
|
|
161
161
|
export default EditPage;
|
|
@@ -18,7 +18,7 @@ import BaselineAlignment from './BaselineAlignment';
|
|
|
18
18
|
import pluginId from '../../../pluginId';
|
|
19
19
|
import { getTrad } from '../../../utils';
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
function RoleListPage() {
|
|
22
22
|
const { formatMessage } = useIntl();
|
|
23
23
|
const { emitEvent } = useGlobalContext();
|
|
24
24
|
const { push } = useHistory();
|
|
@@ -188,6 +188,6 @@ const RoleListPage = () => {
|
|
|
188
188
|
)}
|
|
189
189
|
</>
|
|
190
190
|
);
|
|
191
|
-
}
|
|
191
|
+
}
|
|
192
192
|
|
|
193
193
|
export default RoleListPage;
|
|
@@ -3,10 +3,10 @@ import { CheckPagePermissions } from '@akemona-org/strapi-helper-plugin';
|
|
|
3
3
|
import pluginPermissions from '../../../permissions';
|
|
4
4
|
import RolesCreatePage from '../CreatePage';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
<CheckPagePermissions permissions={pluginPermissions.createRole}>
|
|
6
|
+
function ProtectedRolesCreatePage() {
|
|
7
|
+
return <CheckPagePermissions permissions={pluginPermissions.createRole}>
|
|
8
8
|
<RolesCreatePage />
|
|
9
9
|
</CheckPagePermissions>
|
|
10
|
-
|
|
10
|
+
}
|
|
11
11
|
|
|
12
12
|
export default ProtectedRolesCreatePage;
|
|
@@ -3,10 +3,10 @@ import { CheckPagePermissions } from '@akemona-org/strapi-helper-plugin';
|
|
|
3
3
|
import pluginPermissions from '../../../permissions';
|
|
4
4
|
import RolesEditPage from '../EditPage';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
<CheckPagePermissions permissions={pluginPermissions.updateRole}>
|
|
6
|
+
function ProtectedRolesEditPage() {
|
|
7
|
+
return <CheckPagePermissions permissions={pluginPermissions.updateRole}>
|
|
8
8
|
<RolesEditPage />
|
|
9
9
|
</CheckPagePermissions>
|
|
10
|
-
|
|
10
|
+
}
|
|
11
11
|
|
|
12
12
|
export default ProtectedRolesEditPage;
|
|
@@ -4,12 +4,12 @@ import pluginPermissions from '../../../permissions';
|
|
|
4
4
|
|
|
5
5
|
import RolesListPage from '../ListPage';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
function ProtectedRolesListPage() {
|
|
8
8
|
return (
|
|
9
9
|
<CheckPagePermissions permissions={pluginPermissions.accessRoles}>
|
|
10
10
|
<RolesListPage />
|
|
11
11
|
</CheckPagePermissions>
|
|
12
12
|
);
|
|
13
|
-
}
|
|
13
|
+
}
|
|
14
14
|
|
|
15
15
|
export default ProtectedRolesListPage;
|
|
@@ -7,7 +7,7 @@ import ProtectedRolesListPage from './ProtectedListPage';
|
|
|
7
7
|
import ProtectedRolesEditPage from './ProtectedEditPage';
|
|
8
8
|
import ProtectedRolesCreatePage from './ProtectedCreatePage';
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
function Roles() {
|
|
11
11
|
const { settingsBaseURL } = useGlobalContext();
|
|
12
12
|
|
|
13
13
|
return (
|
|
@@ -30,6 +30,6 @@ const Roles = () => {
|
|
|
30
30
|
<Route path="" component={NotFound} />
|
|
31
31
|
</Switch>
|
|
32
32
|
);
|
|
33
|
-
}
|
|
33
|
+
}
|
|
34
34
|
|
|
35
35
|
export default Roles;
|
|
@@ -3,9 +3,9 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
|
|
4
4
|
const EditPageContext = createContext({});
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
function EditPageContextProvider({ children, ...rest }) {
|
|
7
7
|
return <EditPageContext.Provider value={rest}>{children}</EditPageContext.Provider>;
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
9
|
|
|
10
10
|
const useEditPageContext = () => useContext(EditPageContext);
|
|
11
11
|
|
|
@@ -3,9 +3,9 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
|
|
4
4
|
const HomePageContext = createContext({});
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
function HomePageContextProvider({ children, ...rest }) {
|
|
7
7
|
return <HomePageContext.Provider value={rest}>{children}</HomePageContext.Provider>;
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
9
|
|
|
10
10
|
const useHomePageContext = () => useContext(HomePageContext);
|
|
11
11
|
|
|
@@ -3,9 +3,9 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
|
|
4
4
|
const UsersPermissions = createContext({});
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
function UsersPermissionsProvider({ children, value }) {
|
|
7
7
|
return <UsersPermissions.Provider value={value}>{children}</UsersPermissions.Provider>;
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
9
|
|
|
10
10
|
const useUsersPermissions = () => useContext(UsersPermissions);
|
|
11
11
|
|
|
@@ -19,9 +19,8 @@ module.exports = async (ctx, next) => {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
// fetch authenticated user
|
|
22
|
-
ctx.state.user =
|
|
23
|
-
'users-permissions'
|
|
24
|
-
].services.user.fetchAuthenticatedUser(id);
|
|
22
|
+
ctx.state.user =
|
|
23
|
+
await strapi.plugins['users-permissions'].services.user.fetchAuthenticatedUser(id);
|
|
25
24
|
} catch (err) {
|
|
26
25
|
return handleErrors(ctx, err, 'unauthorized');
|
|
27
26
|
}
|
|
@@ -64,9 +64,8 @@ module.exports = {
|
|
|
64
64
|
|
|
65
65
|
async getPermissions(ctx) {
|
|
66
66
|
try {
|
|
67
|
-
const permissions =
|
|
68
|
-
'users-permissions'
|
|
69
|
-
].services.userspermissions.getActions();
|
|
67
|
+
const permissions =
|
|
68
|
+
await strapi.plugins['users-permissions'].services.userspermissions.getActions();
|
|
70
69
|
|
|
71
70
|
ctx.send({ permissions });
|
|
72
71
|
} catch (err) {
|
|
@@ -86,9 +85,8 @@ module.exports = {
|
|
|
86
85
|
async getRole(ctx) {
|
|
87
86
|
const { id } = ctx.params;
|
|
88
87
|
const { lang } = ctx.query;
|
|
89
|
-
const plugins =
|
|
90
|
-
lang
|
|
91
|
-
);
|
|
88
|
+
const plugins =
|
|
89
|
+
await strapi.plugins['users-permissions'].services.userspermissions.getPlugins(lang);
|
|
92
90
|
const role = await strapi.plugins['users-permissions'].services.userspermissions.getRole(
|
|
93
91
|
id,
|
|
94
92
|
plugins
|
|
@@ -113,9 +111,8 @@ module.exports = {
|
|
|
113
111
|
|
|
114
112
|
async getRoutes(ctx) {
|
|
115
113
|
try {
|
|
116
|
-
const routes =
|
|
117
|
-
'users-permissions'
|
|
118
|
-
].services.userspermissions.getRoutes();
|
|
114
|
+
const routes =
|
|
115
|
+
await strapi.plugins['users-permissions'].services.userspermissions.getRoutes();
|
|
119
116
|
|
|
120
117
|
ctx.send({ routes });
|
|
121
118
|
} catch (err) {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "3.
|
|
6
|
+
"version": "3.13.0",
|
|
7
7
|
"description": "Protect your API with a full-authentication process based on JWT",
|
|
8
8
|
"strapi": {
|
|
9
9
|
"name": "Roles & Permissions",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"test": "echo \"no tests yet\""
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@akemona-org/strapi-helper-plugin": "3.
|
|
19
|
-
"@akemona-org/strapi-utils": "3.
|
|
18
|
+
"@akemona-org/strapi-helper-plugin": "3.13.0",
|
|
19
|
+
"@akemona-org/strapi-utils": "3.13.0",
|
|
20
20
|
"@buffetjs/core": "3.3.8",
|
|
21
21
|
"@buffetjs/custom": "3.3.8",
|
|
22
22
|
"@buffetjs/hooks": "3.3.8",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"npm": ">=6.0.0"
|
|
67
67
|
},
|
|
68
68
|
"license": "SEE LICENSE IN LICENSE",
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "8bb7b41ae9cc2110f94b9338f0ec2df437e49161"
|
|
70
70
|
}
|
package/services/User.js
CHANGED
|
@@ -38,9 +38,8 @@ module.exports = {
|
|
|
38
38
|
*/
|
|
39
39
|
async add(values) {
|
|
40
40
|
if (values.password) {
|
|
41
|
-
values.password =
|
|
42
|
-
values
|
|
43
|
-
);
|
|
41
|
+
values.password =
|
|
42
|
+
await strapi.plugins['users-permissions'].services.user.hashPassword(values);
|
|
44
43
|
}
|
|
45
44
|
|
|
46
45
|
return strapi.query('user', 'users-permissions').create(values);
|
|
@@ -52,9 +51,8 @@ module.exports = {
|
|
|
52
51
|
*/
|
|
53
52
|
async edit(params, values) {
|
|
54
53
|
if (values.password) {
|
|
55
|
-
values.password =
|
|
56
|
-
values
|
|
57
|
-
);
|
|
54
|
+
values.password =
|
|
55
|
+
await strapi.plugins['users-permissions'].services.user.hashPassword(values);
|
|
58
56
|
}
|
|
59
57
|
|
|
60
58
|
return strapi.query('user', 'users-permissions').update(params, values);
|