@strapi/plugin-users-permissions 0.0.0-next.e50ef5e2ea57ecf3da5bcf308508b51ee3c0deca → 0.0.0-next.e5d4b412da0d932b61b2fa5012d16513fda6de04
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/dist/server/controllers/content-manager-user.js +3 -3
- package/dist/server/controllers/content-manager-user.js.map +1 -1
- package/dist/server/controllers/content-manager-user.mjs +3 -3
- package/dist/server/controllers/content-manager-user.mjs.map +1 -1
- package/dist/server/controllers/validation/user.js +6 -1
- package/dist/server/controllers/validation/user.js.map +1 -1
- package/dist/server/controllers/validation/user.mjs +6 -1
- package/dist/server/controllers/validation/user.mjs.map +1 -1
- package/dist/server/routes/content-api/auth.js +139 -91
- package/dist/server/routes/content-api/auth.js.map +1 -1
- package/dist/server/routes/content-api/auth.mjs +139 -91
- package/dist/server/routes/content-api/auth.mjs.map +1 -1
- package/dist/server/routes/content-api/index.js +11 -9
- package/dist/server/routes/content-api/index.js.map +1 -1
- package/dist/server/routes/content-api/index.mjs +11 -9
- package/dist/server/routes/content-api/index.mjs.map +1 -1
- package/dist/server/routes/content-api/permissions.js +14 -7
- package/dist/server/routes/content-api/permissions.js.map +1 -1
- package/dist/server/routes/content-api/permissions.mjs +14 -7
- package/dist/server/routes/content-api/permissions.mjs.map +1 -1
- package/dist/server/routes/content-api/role.js +61 -27
- package/dist/server/routes/content-api/role.js.map +1 -1
- package/dist/server/routes/content-api/role.mjs +61 -27
- package/dist/server/routes/content-api/role.mjs.map +1 -1
- package/dist/server/routes/content-api/user.js +119 -57
- package/dist/server/routes/content-api/user.js.map +1 -1
- package/dist/server/routes/content-api/user.mjs +119 -57
- package/dist/server/routes/content-api/user.mjs.map +1 -1
- package/dist/server/routes/content-api/validation.js +216 -0
- package/dist/server/routes/content-api/validation.js.map +1 -0
- package/dist/server/routes/content-api/validation.mjs +214 -0
- package/dist/server/routes/content-api/validation.mjs.map +1 -0
- package/package.json +7 -6
- package/server/controllers/content-manager-user.js +3 -4
- package/server/controllers/validation/user.js +12 -1
- package/server/routes/content-api/auth.js +107 -71
- package/server/routes/content-api/index.js +11 -4
- package/server/routes/content-api/permissions.js +14 -7
- package/server/routes/content-api/role.js +57 -27
- package/server/routes/content-api/user.js +108 -51
- package/server/routes/content-api/validation.js +249 -0
|
@@ -1,82 +1,118 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
const { UsersPermissionsRouteValidator } = require('./validation');
|
|
4
|
+
|
|
5
|
+
module.exports = (strapi) => {
|
|
6
|
+
const validator = new UsersPermissionsRouteValidator(strapi);
|
|
7
|
+
|
|
8
|
+
return [
|
|
9
|
+
{
|
|
10
|
+
method: 'GET',
|
|
11
|
+
path: '/connect/(.*)',
|
|
12
|
+
handler: 'auth.connect',
|
|
13
|
+
config: {
|
|
14
|
+
middlewares: ['plugin::users-permissions.rateLimit'],
|
|
15
|
+
prefix: '',
|
|
16
|
+
},
|
|
11
17
|
},
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
{
|
|
19
|
+
method: 'POST',
|
|
20
|
+
path: '/auth/local',
|
|
21
|
+
handler: 'auth.callback',
|
|
22
|
+
config: {
|
|
23
|
+
middlewares: ['plugin::users-permissions.rateLimit'],
|
|
24
|
+
prefix: '',
|
|
25
|
+
},
|
|
26
|
+
request: {
|
|
27
|
+
body: { 'application/json': validator.loginBodySchema },
|
|
28
|
+
},
|
|
29
|
+
response: validator.authResponseSchema,
|
|
20
30
|
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
{
|
|
32
|
+
method: 'POST',
|
|
33
|
+
path: '/auth/local/register',
|
|
34
|
+
handler: 'auth.register',
|
|
35
|
+
config: {
|
|
36
|
+
middlewares: ['plugin::users-permissions.rateLimit'],
|
|
37
|
+
prefix: '',
|
|
38
|
+
},
|
|
39
|
+
request: {
|
|
40
|
+
body: { 'application/json': validator.registerBodySchema },
|
|
41
|
+
},
|
|
42
|
+
response: validator.authRegisterResponseSchema,
|
|
29
43
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
44
|
+
{
|
|
45
|
+
method: 'GET',
|
|
46
|
+
path: '/auth/:provider/callback',
|
|
47
|
+
handler: 'auth.callback',
|
|
48
|
+
config: {
|
|
49
|
+
prefix: '',
|
|
50
|
+
},
|
|
51
|
+
request: {
|
|
52
|
+
params: {
|
|
53
|
+
provider: validator.providerParam,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
response: validator.authResponseSchema,
|
|
37
57
|
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
58
|
+
{
|
|
59
|
+
method: 'POST',
|
|
60
|
+
path: '/auth/forgot-password',
|
|
61
|
+
handler: 'auth.forgotPassword',
|
|
62
|
+
config: {
|
|
63
|
+
middlewares: ['plugin::users-permissions.rateLimit'],
|
|
64
|
+
prefix: '',
|
|
65
|
+
},
|
|
66
|
+
request: {
|
|
67
|
+
body: { 'application/json': validator.forgotPasswordBodySchema },
|
|
68
|
+
},
|
|
69
|
+
response: validator.forgotPasswordResponseSchema,
|
|
46
70
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
71
|
+
{
|
|
72
|
+
method: 'POST',
|
|
73
|
+
path: '/auth/reset-password',
|
|
74
|
+
handler: 'auth.resetPassword',
|
|
75
|
+
config: {
|
|
76
|
+
middlewares: ['plugin::users-permissions.rateLimit'],
|
|
77
|
+
prefix: '',
|
|
78
|
+
},
|
|
79
|
+
request: {
|
|
80
|
+
body: { 'application/json': validator.resetPasswordBodySchema },
|
|
81
|
+
},
|
|
82
|
+
response: validator.authResponseSchema,
|
|
55
83
|
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
84
|
+
{
|
|
85
|
+
method: 'GET',
|
|
86
|
+
path: '/auth/email-confirmation',
|
|
87
|
+
handler: 'auth.emailConfirmation',
|
|
88
|
+
config: {
|
|
89
|
+
prefix: '',
|
|
90
|
+
},
|
|
63
91
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
92
|
+
{
|
|
93
|
+
method: 'POST',
|
|
94
|
+
path: '/auth/send-email-confirmation',
|
|
95
|
+
handler: 'auth.sendEmailConfirmation',
|
|
96
|
+
config: {
|
|
97
|
+
prefix: '',
|
|
98
|
+
},
|
|
99
|
+
request: {
|
|
100
|
+
body: { 'application/json': validator.sendEmailConfirmationBodySchema },
|
|
101
|
+
},
|
|
102
|
+
response: validator.sendEmailConfirmationResponseSchema,
|
|
71
103
|
},
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
104
|
+
{
|
|
105
|
+
method: 'POST',
|
|
106
|
+
path: '/auth/change-password',
|
|
107
|
+
handler: 'auth.changePassword',
|
|
108
|
+
config: {
|
|
109
|
+
middlewares: ['plugin::users-permissions.rateLimit'],
|
|
110
|
+
prefix: '',
|
|
111
|
+
},
|
|
112
|
+
request: {
|
|
113
|
+
body: { 'application/json': validator.changePasswordBodySchema },
|
|
114
|
+
},
|
|
115
|
+
response: validator.authResponseSchema,
|
|
80
116
|
},
|
|
81
|
-
|
|
82
|
-
|
|
117
|
+
];
|
|
118
|
+
};
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const { createContentApiRoutesFactory } = require('@strapi/utils');
|
|
3
4
|
const authRoutes = require('./auth');
|
|
4
5
|
const userRoutes = require('./user');
|
|
5
6
|
const roleRoutes = require('./role');
|
|
6
7
|
const permissionsRoutes = require('./permissions');
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const createContentApiRoutes = createContentApiRoutesFactory(() => {
|
|
10
|
+
return [
|
|
11
|
+
...authRoutes(strapi),
|
|
12
|
+
...userRoutes(strapi),
|
|
13
|
+
...roleRoutes(strapi),
|
|
14
|
+
...permissionsRoutes(strapi),
|
|
15
|
+
];
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
module.exports = createContentApiRoutes;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
const { UsersPermissionsRouteValidator } = require('./validation');
|
|
4
|
+
|
|
5
|
+
module.exports = (strapi) => {
|
|
6
|
+
const validator = new UsersPermissionsRouteValidator(strapi);
|
|
7
|
+
|
|
8
|
+
return [
|
|
9
|
+
{
|
|
10
|
+
method: 'GET',
|
|
11
|
+
path: '/permissions',
|
|
12
|
+
handler: 'permissions.getPermissions',
|
|
13
|
+
response: validator.permissionsResponseSchema,
|
|
14
|
+
},
|
|
15
|
+
];
|
|
16
|
+
};
|
|
@@ -1,29 +1,59 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
3
|
+
const { UsersPermissionsRouteValidator } = require('./validation');
|
|
4
|
+
|
|
5
|
+
module.exports = (strapi) => {
|
|
6
|
+
const validator = new UsersPermissionsRouteValidator(strapi);
|
|
7
|
+
|
|
8
|
+
return [
|
|
9
|
+
{
|
|
10
|
+
method: 'GET',
|
|
11
|
+
path: '/roles/:id',
|
|
12
|
+
handler: 'role.findOne',
|
|
13
|
+
request: {
|
|
14
|
+
params: {
|
|
15
|
+
id: validator.roleIdParam,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
response: validator.roleResponseSchema,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
method: 'GET',
|
|
22
|
+
path: '/roles',
|
|
23
|
+
handler: 'role.find',
|
|
24
|
+
response: validator.rolesResponseSchema,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
method: 'POST',
|
|
28
|
+
path: '/roles',
|
|
29
|
+
handler: 'role.createRole',
|
|
30
|
+
request: {
|
|
31
|
+
body: { 'application/json': validator.createRoleBodySchema },
|
|
32
|
+
},
|
|
33
|
+
response: validator.roleSuccessResponseSchema,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
method: 'PUT',
|
|
37
|
+
path: '/roles/:role',
|
|
38
|
+
handler: 'role.updateRole',
|
|
39
|
+
request: {
|
|
40
|
+
params: {
|
|
41
|
+
role: validator.roleIdParam,
|
|
42
|
+
},
|
|
43
|
+
body: { 'application/json': validator.updateRoleBodySchema },
|
|
44
|
+
},
|
|
45
|
+
response: validator.roleSuccessResponseSchema,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
method: 'DELETE',
|
|
49
|
+
path: '/roles/:role',
|
|
50
|
+
handler: 'role.deleteRole',
|
|
51
|
+
request: {
|
|
52
|
+
params: {
|
|
53
|
+
role: validator.roleIdParam,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
response: validator.roleSuccessResponseSchema,
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
};
|
|
@@ -1,60 +1,117 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
const z = require('zod/v4');
|
|
4
|
+
const { UsersPermissionsRouteValidator } = require('./validation');
|
|
5
|
+
|
|
6
|
+
module.exports = (strapi) => {
|
|
7
|
+
const validator = new UsersPermissionsRouteValidator(strapi);
|
|
8
|
+
|
|
9
|
+
return [
|
|
10
|
+
{
|
|
11
|
+
method: 'GET',
|
|
12
|
+
path: '/users/count',
|
|
13
|
+
handler: 'user.count',
|
|
14
|
+
config: {
|
|
15
|
+
prefix: '',
|
|
16
|
+
},
|
|
17
|
+
request: {
|
|
18
|
+
query: {
|
|
19
|
+
filters: validator.filters.optional(),
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
response: z.number(),
|
|
10
23
|
},
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
24
|
+
{
|
|
25
|
+
method: 'GET',
|
|
26
|
+
path: '/users',
|
|
27
|
+
handler: 'user.find',
|
|
28
|
+
config: {
|
|
29
|
+
prefix: '',
|
|
30
|
+
},
|
|
31
|
+
request: {
|
|
32
|
+
query: {
|
|
33
|
+
fields: validator.queryFields.optional(),
|
|
34
|
+
populate: validator.queryPopulate.optional(),
|
|
35
|
+
sort: validator.querySort.optional(),
|
|
36
|
+
pagination: validator.pagination.optional(),
|
|
37
|
+
filters: validator.filters.optional(),
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
response: z.array(validator.userSchema),
|
|
18
41
|
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
42
|
+
{
|
|
43
|
+
method: 'GET',
|
|
44
|
+
path: '/users/me',
|
|
45
|
+
handler: 'user.me',
|
|
46
|
+
config: {
|
|
47
|
+
prefix: '',
|
|
48
|
+
},
|
|
49
|
+
request: {
|
|
50
|
+
query: {
|
|
51
|
+
fields: validator.queryFields.optional(),
|
|
52
|
+
populate: validator.queryPopulate.optional(),
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
response: validator.userSchema,
|
|
26
56
|
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
57
|
+
{
|
|
58
|
+
method: 'GET',
|
|
59
|
+
path: '/users/:id',
|
|
60
|
+
handler: 'user.findOne',
|
|
61
|
+
config: {
|
|
62
|
+
prefix: '',
|
|
63
|
+
},
|
|
64
|
+
request: {
|
|
65
|
+
params: {
|
|
66
|
+
id: validator.userIdParam,
|
|
67
|
+
},
|
|
68
|
+
query: {
|
|
69
|
+
fields: validator.queryFields.optional(),
|
|
70
|
+
populate: validator.queryPopulate.optional(),
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
response: validator.userSchema,
|
|
34
74
|
},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
75
|
+
{
|
|
76
|
+
method: 'POST',
|
|
77
|
+
path: '/users',
|
|
78
|
+
handler: 'user.create',
|
|
79
|
+
config: {
|
|
80
|
+
prefix: '',
|
|
81
|
+
},
|
|
82
|
+
request: {
|
|
83
|
+
body: { 'application/json': validator.createUserBodySchema },
|
|
84
|
+
},
|
|
85
|
+
response: validator.userSchema,
|
|
42
86
|
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
87
|
+
{
|
|
88
|
+
method: 'PUT',
|
|
89
|
+
path: '/users/:id',
|
|
90
|
+
handler: 'user.update',
|
|
91
|
+
config: {
|
|
92
|
+
prefix: '',
|
|
93
|
+
},
|
|
94
|
+
request: {
|
|
95
|
+
params: {
|
|
96
|
+
id: validator.userIdParam,
|
|
97
|
+
},
|
|
98
|
+
body: { 'application/json': validator.updateUserBodySchema },
|
|
99
|
+
},
|
|
100
|
+
response: validator.userSchema,
|
|
50
101
|
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
102
|
+
{
|
|
103
|
+
method: 'DELETE',
|
|
104
|
+
path: '/users/:id',
|
|
105
|
+
handler: 'user.destroy',
|
|
106
|
+
config: {
|
|
107
|
+
prefix: '',
|
|
108
|
+
},
|
|
109
|
+
request: {
|
|
110
|
+
params: {
|
|
111
|
+
id: validator.userIdParam,
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
response: validator.userSchema,
|
|
58
115
|
},
|
|
59
|
-
|
|
60
|
-
|
|
116
|
+
];
|
|
117
|
+
};
|