@strapi/plugin-users-permissions 4.0.0-next.9 → 4.0.3
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 +0 -8
- package/admin/src/pages/AdvancedSettings/index.js +203 -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 +21 -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 +117 -197
- package/admin/src/pages/EmailTemplates/utils/api.js +13 -0
- package/admin/src/pages/Providers/index.js +206 -221
- 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/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 +93 -54
- 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/jest.config.front.js +10 -0
- package/package.json +36 -33
- package/server/bootstrap/index.js +19 -21
- package/server/config.js +3 -3
- package/server/content-types/index.js +3 -3
- package/server/content-types/permission/index.js +30 -3
- package/server/content-types/role/index.js +47 -3
- package/server/content-types/user/index.js +65 -4
- package/server/controllers/auth.js +82 -245
- package/server/controllers/content-manager-user.js +183 -0
- package/server/controllers/index.js +12 -6
- 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 +119 -45
- package/server/controllers/validation/auth.js +29 -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 +2 -2
- package/server/{policies → middlewares}/rateLimit.js +3 -7
- 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 +4 -428
- package/server/services/index.js +10 -8
- package/server/services/jwt.js +9 -17
- package/server/services/providers.js +32 -33
- package/server/services/role.js +177 -0
- package/server/services/user.js +23 -22
- package/server/services/users-permissions.js +140 -338
- package/server/strategies/users-permissions.js +123 -0
- package/server/utils/index.d.ts +2 -0
- package/strapi-admin.js +3 -0
- package/strapi-server.js +1 -19
- 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/server/content-types/permission/schema.json +0 -48
- package/server/content-types/role/schema.json +0 -46
- package/server/content-types/user/schema.json +0 -66
- package/server/controllers/user/admin.js +0 -230
- package/server/controllers/user/api.js +0 -174
- package/server/controllers/users-permissions.js +0 -271
- package/server/middlewares/users-permissions.js +0 -44
- package/server/policies/index.js +0 -11
- package/server/policies/isAuthenticated.js +0 -9
- package/server/policies/permissions.js +0 -94
- package/server/schema.graphql.js +0 -317
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = ({ nexus }) => {
|
|
4
|
+
return nexus.objectType({
|
|
5
|
+
name: 'UsersPermissionsMe',
|
|
6
|
+
|
|
7
|
+
definition(t) {
|
|
8
|
+
t.nonNull.id('id');
|
|
9
|
+
t.nonNull.string('username');
|
|
10
|
+
t.string('email');
|
|
11
|
+
t.boolean('confirmed');
|
|
12
|
+
t.boolean('blocked');
|
|
13
|
+
t.field('role', { type: 'UsersPermissionsMeRole' });
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = ({ nexus }) => {
|
|
4
|
+
return nexus.inputObjectType({
|
|
5
|
+
name: 'UsersPermissionsRegisterInput',
|
|
6
|
+
|
|
7
|
+
definition(t) {
|
|
8
|
+
t.nonNull.string('username');
|
|
9
|
+
t.nonNull.string('email');
|
|
10
|
+
t.nonNull.string('password');
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { getOr } = require('lodash/fp');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Throws an ApolloError if context body contains a bad request
|
|
7
|
+
* @param contextBody - body of the context object given to the resolver
|
|
8
|
+
* @throws ApolloError if the body is a bad request
|
|
9
|
+
*/
|
|
10
|
+
function checkBadRequest(contextBody) {
|
|
11
|
+
const statusCode = getOr(200, 'statusCode', contextBody);
|
|
12
|
+
|
|
13
|
+
if (statusCode !== 200) {
|
|
14
|
+
const errorMessage = getOr('Bad Request', 'error', contextBody);
|
|
15
|
+
|
|
16
|
+
const exception = new Error(errorMessage);
|
|
17
|
+
|
|
18
|
+
exception.code = statusCode || 400;
|
|
19
|
+
exception.data = contextBody;
|
|
20
|
+
|
|
21
|
+
throw exception;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports = {
|
|
26
|
+
checkBadRequest,
|
|
27
|
+
};
|
package/server/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const register = require('./register');
|
|
4
|
+
const bootstrap = require('./bootstrap');
|
|
5
|
+
const contentTypes = require('./content-types');
|
|
6
|
+
const middlewares = require('./middlewares');
|
|
7
|
+
const services = require('./services');
|
|
8
|
+
const routes = require('./routes');
|
|
9
|
+
const controllers = require('./controllers');
|
|
10
|
+
const config = require('./config');
|
|
11
|
+
|
|
12
|
+
module.exports = () => ({
|
|
13
|
+
register,
|
|
14
|
+
bootstrap,
|
|
15
|
+
config,
|
|
16
|
+
routes,
|
|
17
|
+
controllers,
|
|
18
|
+
contentTypes,
|
|
19
|
+
middlewares,
|
|
20
|
+
services,
|
|
21
|
+
});
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
return require('koa2-ratelimit').RateLimit;
|
|
6
|
-
},
|
|
7
|
-
};
|
|
3
|
+
module.exports = (config, { strapi }) => async (ctx, next) => {
|
|
4
|
+
const ratelimit = require('koa2-ratelimit').RateLimit;
|
|
8
5
|
|
|
9
|
-
module.exports = async (ctx, next) => {
|
|
10
6
|
const message = [
|
|
11
7
|
{
|
|
12
8
|
messages: [
|
|
@@ -18,7 +14,7 @@ module.exports = async (ctx, next) => {
|
|
|
18
14
|
},
|
|
19
15
|
];
|
|
20
16
|
|
|
21
|
-
return
|
|
17
|
+
return ratelimit.middleware(
|
|
22
18
|
Object.assign(
|
|
23
19
|
{},
|
|
24
20
|
{
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const authStrategy = require('./strategies/users-permissions');
|
|
4
|
+
|
|
5
|
+
module.exports = ({ strapi }) => {
|
|
6
|
+
strapi.container.get('auth').register('content-api', authStrategy);
|
|
7
|
+
|
|
8
|
+
if (strapi.plugin('graphql')) {
|
|
9
|
+
require('./graphql')({ strapi });
|
|
10
|
+
}
|
|
11
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const permissionsRoutes = require('./permissions');
|
|
4
|
+
const settingsRoutes = require('./settings');
|
|
5
|
+
const roleRoutes = require('./role');
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
type: 'admin',
|
|
9
|
+
routes: [...roleRoutes, ...settingsRoutes, ...permissionsRoutes],
|
|
10
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = [
|
|
4
|
+
{
|
|
5
|
+
method: 'GET',
|
|
6
|
+
path: '/permissions',
|
|
7
|
+
handler: 'permissions.getPermissions',
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
method: 'GET',
|
|
11
|
+
path: '/policies',
|
|
12
|
+
handler: 'permissions.getPolicies',
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
{
|
|
16
|
+
method: 'GET',
|
|
17
|
+
path: '/routes',
|
|
18
|
+
handler: 'permissions.getRoutes',
|
|
19
|
+
},
|
|
20
|
+
];
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = [
|
|
4
|
+
{
|
|
5
|
+
method: 'GET',
|
|
6
|
+
path: '/roles/:id',
|
|
7
|
+
handler: 'role.getRole',
|
|
8
|
+
config: {
|
|
9
|
+
policies: [
|
|
10
|
+
{
|
|
11
|
+
name: 'admin::hasPermissions',
|
|
12
|
+
config: {
|
|
13
|
+
actions: ['plugin::users-permissions.roles.read'],
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
method: 'GET',
|
|
21
|
+
path: '/roles',
|
|
22
|
+
handler: 'role.getRoles',
|
|
23
|
+
config: {
|
|
24
|
+
policies: [
|
|
25
|
+
{
|
|
26
|
+
name: 'admin::hasPermissions',
|
|
27
|
+
config: {
|
|
28
|
+
actions: ['plugin::users-permissions.roles.read'],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
method: 'POST',
|
|
36
|
+
path: '/roles',
|
|
37
|
+
handler: 'role.createRole',
|
|
38
|
+
config: {
|
|
39
|
+
policies: [
|
|
40
|
+
{
|
|
41
|
+
name: 'admin::hasPermissions',
|
|
42
|
+
config: {
|
|
43
|
+
actions: ['plugin::users-permissions.roles.create'],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
method: 'PUT',
|
|
51
|
+
path: '/roles/:role',
|
|
52
|
+
handler: 'role.updateRole',
|
|
53
|
+
config: {
|
|
54
|
+
policies: [
|
|
55
|
+
{
|
|
56
|
+
name: 'admin::hasPermissions',
|
|
57
|
+
config: {
|
|
58
|
+
actions: ['plugin::users-permissions.roles.update'],
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
method: 'DELETE',
|
|
66
|
+
path: '/roles/:role',
|
|
67
|
+
handler: 'role.deleteRole',
|
|
68
|
+
config: {
|
|
69
|
+
policies: [
|
|
70
|
+
{
|
|
71
|
+
name: 'admin::hasPermissions',
|
|
72
|
+
config: {
|
|
73
|
+
actions: ['plugin::users-permissions.roles.delete'],
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
];
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = [
|
|
4
|
+
{
|
|
5
|
+
method: 'GET',
|
|
6
|
+
path: '/email-templates',
|
|
7
|
+
handler: 'settings.getEmailTemplate',
|
|
8
|
+
config: {
|
|
9
|
+
policies: [
|
|
10
|
+
{
|
|
11
|
+
name: 'admin::hasPermissions',
|
|
12
|
+
config: {
|
|
13
|
+
actions: ['plugin::users-permissions.email-templates.read'],
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
method: 'PUT',
|
|
21
|
+
path: '/email-templates',
|
|
22
|
+
handler: 'settings.updateEmailTemplate',
|
|
23
|
+
config: {
|
|
24
|
+
policies: [
|
|
25
|
+
{
|
|
26
|
+
name: 'admin::hasPermissions',
|
|
27
|
+
config: {
|
|
28
|
+
actions: ['plugin::users-permissions.email-templates.update'],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
method: 'GET',
|
|
36
|
+
path: '/advanced',
|
|
37
|
+
handler: 'settings.getAdvancedSettings',
|
|
38
|
+
config: {
|
|
39
|
+
policies: [
|
|
40
|
+
{
|
|
41
|
+
name: 'admin::hasPermissions',
|
|
42
|
+
config: {
|
|
43
|
+
actions: ['plugin::users-permissions.advanced-settings.read'],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
method: 'PUT',
|
|
51
|
+
path: '/advanced',
|
|
52
|
+
handler: 'settings.updateAdvancedSettings',
|
|
53
|
+
config: {
|
|
54
|
+
policies: [
|
|
55
|
+
{
|
|
56
|
+
name: 'admin::hasPermissions',
|
|
57
|
+
config: {
|
|
58
|
+
actions: ['plugin::users-permissions.advanced-settings.update'],
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
method: 'GET',
|
|
66
|
+
path: '/providers',
|
|
67
|
+
handler: 'settings.getProviders',
|
|
68
|
+
config: {
|
|
69
|
+
policies: [
|
|
70
|
+
{
|
|
71
|
+
name: 'admin::hasPermissions',
|
|
72
|
+
config: {
|
|
73
|
+
actions: ['plugin::users-permissions.providers.read'],
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
{
|
|
81
|
+
method: 'PUT',
|
|
82
|
+
path: '/providers',
|
|
83
|
+
handler: 'settings.updateProviders',
|
|
84
|
+
config: {
|
|
85
|
+
policies: [
|
|
86
|
+
{
|
|
87
|
+
name: 'admin::hasPermissions',
|
|
88
|
+
config: {
|
|
89
|
+
actions: ['plugin::users-permissions.providers.update'],
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
];
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = [
|
|
4
|
+
{
|
|
5
|
+
method: 'GET',
|
|
6
|
+
path: '/connect/(.*)',
|
|
7
|
+
handler: 'auth.connect',
|
|
8
|
+
config: {
|
|
9
|
+
middlewares: ['plugin::users-permissions.rateLimit'],
|
|
10
|
+
prefix: '',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
method: 'POST',
|
|
15
|
+
path: '/auth/local',
|
|
16
|
+
handler: 'auth.callback',
|
|
17
|
+
config: {
|
|
18
|
+
middlewares: ['plugin::users-permissions.rateLimit'],
|
|
19
|
+
prefix: '',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
method: 'POST',
|
|
24
|
+
path: '/auth/local/register',
|
|
25
|
+
handler: 'auth.register',
|
|
26
|
+
config: {
|
|
27
|
+
middlewares: ['plugin::users-permissions.rateLimit'],
|
|
28
|
+
prefix: '',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
method: 'GET',
|
|
33
|
+
path: '/auth/:provider/callback',
|
|
34
|
+
handler: 'auth.callback',
|
|
35
|
+
config: {
|
|
36
|
+
prefix: '',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
method: 'POST',
|
|
41
|
+
path: '/auth/forgot-password',
|
|
42
|
+
handler: 'auth.forgotPassword',
|
|
43
|
+
config: {
|
|
44
|
+
middlewares: ['plugin::users-permissions.rateLimit'],
|
|
45
|
+
prefix: '',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
method: 'POST',
|
|
50
|
+
path: '/auth/reset-password',
|
|
51
|
+
handler: 'auth.resetPassword',
|
|
52
|
+
config: {
|
|
53
|
+
middlewares: ['plugin::users-permissions.rateLimit'],
|
|
54
|
+
prefix: '',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
method: 'GET',
|
|
59
|
+
path: '/auth/email-confirmation',
|
|
60
|
+
handler: 'auth.emailConfirmation',
|
|
61
|
+
config: {
|
|
62
|
+
prefix: '',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
method: 'POST',
|
|
67
|
+
path: '/auth/send-email-confirmation',
|
|
68
|
+
handler: 'auth.sendEmailConfirmation',
|
|
69
|
+
config: {
|
|
70
|
+
prefix: '',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const authRoutes = require('./auth');
|
|
4
|
+
const userRoutes = require('./user');
|
|
5
|
+
const roleRoutes = require('./role');
|
|
6
|
+
const permissionsRoutes = require('./permissions');
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
type: 'content-api',
|
|
10
|
+
routes: [...authRoutes, ...userRoutes, ...roleRoutes, ...permissionsRoutes],
|
|
11
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = [
|
|
4
|
+
{
|
|
5
|
+
method: 'GET',
|
|
6
|
+
path: '/roles/:id',
|
|
7
|
+
handler: 'role.getRole',
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
method: 'GET',
|
|
11
|
+
path: '/roles',
|
|
12
|
+
handler: 'role.getRoles',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
method: 'POST',
|
|
16
|
+
path: '/roles',
|
|
17
|
+
handler: 'role.createRole',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
method: 'PUT',
|
|
21
|
+
path: '/roles/:role',
|
|
22
|
+
handler: 'role.updateRole',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
method: 'DELETE',
|
|
26
|
+
path: '/roles/:role',
|
|
27
|
+
handler: 'role.deleteRole',
|
|
28
|
+
},
|
|
29
|
+
];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = [
|
|
4
|
+
{
|
|
5
|
+
method: 'GET',
|
|
6
|
+
path: '/users/count',
|
|
7
|
+
handler: 'user.count',
|
|
8
|
+
config: {
|
|
9
|
+
prefix: '',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
method: 'GET',
|
|
14
|
+
path: '/users',
|
|
15
|
+
handler: 'user.find',
|
|
16
|
+
config: {
|
|
17
|
+
auth: {},
|
|
18
|
+
prefix: '',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
method: 'GET',
|
|
23
|
+
path: '/users/me',
|
|
24
|
+
handler: 'user.me',
|
|
25
|
+
config: {
|
|
26
|
+
prefix: '',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
method: 'GET',
|
|
31
|
+
path: '/users/:id',
|
|
32
|
+
handler: 'user.findOne',
|
|
33
|
+
config: {
|
|
34
|
+
prefix: '',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
method: 'POST',
|
|
39
|
+
path: '/users',
|
|
40
|
+
handler: 'user.create',
|
|
41
|
+
config: {
|
|
42
|
+
prefix: '',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
method: 'PUT',
|
|
47
|
+
path: '/users/:id',
|
|
48
|
+
handler: 'user.update',
|
|
49
|
+
config: {
|
|
50
|
+
prefix: '',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
method: 'DELETE',
|
|
55
|
+
path: '/users/:id',
|
|
56
|
+
handler: 'user.destroy',
|
|
57
|
+
config: {
|
|
58
|
+
prefix: '',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
];
|