@webstudio-is/trpc-interface 0.87.0 → 0.88.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.
|
@@ -27,6 +27,9 @@ const hasProjectPermit = async (props, context) => {
|
|
|
27
27
|
if (props.permit === "view" && props.projectId === "62154aaef0cb0860ccf85d6e") {
|
|
28
28
|
return true;
|
|
29
29
|
}
|
|
30
|
+
if (props.permit === "view" && context.authorization.projectTemplates.includes(props.projectId)) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
30
33
|
if (authorization.userId !== void 0) {
|
|
31
34
|
checks.push(
|
|
32
35
|
authorizeTrpc.check.query({
|
|
@@ -52,6 +52,9 @@ const hasProjectPermit = async (props, context) => {
|
|
|
52
52
|
if (props.permit === "view" && props.projectId === "62154aaef0cb0860ccf85d6e") {
|
|
53
53
|
return true;
|
|
54
54
|
}
|
|
55
|
+
if (props.permit === "view" && context.authorization.projectTemplates.includes(props.projectId)) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
55
58
|
if (authorization.userId !== void 0) {
|
|
56
59
|
checks.push(
|
|
57
60
|
authorizeTrpc.check.query({
|
|
@@ -11,6 +11,10 @@ type AuthorizationContext = {
|
|
|
11
11
|
* token URLSearchParams or hostname
|
|
12
12
|
*/
|
|
13
13
|
authToken: string | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* project list serves as a template and is accessible to everyone.
|
|
16
|
+
*/
|
|
17
|
+
projectTemplates: string[];
|
|
14
18
|
/**
|
|
15
19
|
* Allow service 2 service communications to skip authorization for view calls
|
|
16
20
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webstudio-is/trpc-interface",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.88.0",
|
|
4
4
|
"description": "Webstudio TRPC Interface",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"ts-custom-error": "^3.3.1",
|
|
12
12
|
"uuid": "^9.0.0",
|
|
13
13
|
"zod": "^3.21.4",
|
|
14
|
-
"@webstudio-is/prisma-client": "^0.
|
|
14
|
+
"@webstudio-is/prisma-client": "^0.88.0"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@types/node": "^18.11.18",
|
|
@@ -62,6 +62,13 @@ export const hasProjectPermit = async (
|
|
|
62
62
|
return true;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
if (
|
|
66
|
+
props.permit === "view" &&
|
|
67
|
+
context.authorization.projectTemplates.includes(props.projectId)
|
|
68
|
+
) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
|
|
65
72
|
// Check if the user is allowed to access the project
|
|
66
73
|
if (authorization.userId !== undefined) {
|
|
67
74
|
checks.push(
|
|
@@ -14,6 +14,11 @@ type AuthorizationContext = {
|
|
|
14
14
|
*/
|
|
15
15
|
authToken: string | undefined;
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* project list serves as a template and is accessible to everyone.
|
|
19
|
+
*/
|
|
20
|
+
projectTemplates: string[];
|
|
21
|
+
|
|
17
22
|
/**
|
|
18
23
|
* Allow service 2 service communications to skip authorization for view calls
|
|
19
24
|
*/
|