Skip to content

Commit c438456

Browse files
committed
feat: enhance backend routes with middleware for permissions
1 parent 9cd5fa8 commit c438456

1 file changed

Lines changed: 91 additions & 7 deletions

File tree

plugin.json

Lines changed: 91 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,97 @@
77
"backend": {
88
"eventSubscriptions": ["task.deleted"],
99
"routes": [
10-
{ "method": "GET", "path": "/hello" },
11-
{ "method": "POST", "path": "/hello" },
12-
{ "method": "PATCH", "path": "/hello/:id" },
13-
{ "method": "DELETE", "path": "/hello/:id" },
14-
{ "method": "GET", "path": "/hello/plain" },
15-
{ "method": "GET", "path": "/hello/stats" },
16-
{ "method": "DELETE", "path": "/hello/stats/cache" }
10+
{
11+
"method": "GET",
12+
"path": "/hello",
13+
"middlewares": [
14+
{ "name": "optionalAuthn" },
15+
{ "name": "requireFreshPassword" },
16+
{
17+
"name": "requirePermissions",
18+
"scope": "project",
19+
"permissions": ["projects.read"]
20+
}
21+
]
22+
},
23+
{
24+
"method": "POST",
25+
"path": "/hello",
26+
"middlewares": [
27+
{ "name": "optionalAuthn" },
28+
{ "name": "requireFreshPassword" },
29+
{
30+
"name": "requirePermissions",
31+
"scope": "project",
32+
"permissions": ["projects.write"]
33+
}
34+
]
35+
},
36+
{
37+
"method": "PATCH",
38+
"path": "/hello/:id",
39+
"middlewares": [
40+
{ "name": "optionalAuthn" },
41+
{ "name": "requireFreshPassword" },
42+
{
43+
"name": "requirePermissions",
44+
"scope": "project",
45+
"permissions": ["projects.write"]
46+
}
47+
]
48+
},
49+
{
50+
"method": "DELETE",
51+
"path": "/hello/:id",
52+
"middlewares": [
53+
{ "name": "optionalAuthn" },
54+
{ "name": "requireFreshPassword" },
55+
{
56+
"name": "requirePermissions",
57+
"scope": "project",
58+
"permissions": ["projects.write"]
59+
}
60+
]
61+
},
62+
{
63+
"method": "GET",
64+
"path": "/hello/plain",
65+
"middlewares": [
66+
{ "name": "optionalAuthn" },
67+
{ "name": "requireFreshPassword" },
68+
{
69+
"name": "requirePermissions",
70+
"scope": "project",
71+
"permissions": ["projects.read"]
72+
}
73+
]
74+
},
75+
{
76+
"method": "GET",
77+
"path": "/hello/stats",
78+
"middlewares": [
79+
{ "name": "optionalAuthn" },
80+
{ "name": "requireFreshPassword" },
81+
{
82+
"name": "requirePermissions",
83+
"scope": "project",
84+
"permissions": ["projects.read"]
85+
}
86+
]
87+
},
88+
{
89+
"method": "DELETE",
90+
"path": "/hello/stats/cache",
91+
"middlewares": [
92+
{ "name": "optionalAuthn" },
93+
{ "name": "requireFreshPassword" },
94+
{
95+
"name": "requirePermissions",
96+
"scope": "project",
97+
"permissions": ["projects.write"]
98+
}
99+
]
100+
}
17101
]
18102
},
19103
"frontend": {

0 commit comments

Comments
 (0)