@zauru-sdk/utils 6.21.0 → 6.22.1
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.
|
@@ -2,7 +2,7 @@ import { redirect } from "@remix-run/node";
|
|
|
2
2
|
import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
|
|
3
3
|
import { createWebAppTableRegister, getVariablesByName, getWebAppRow, getWebAppTableRegisters, updateWebAppTableRegister, } from "@zauru-sdk/services";
|
|
4
4
|
import { hasPermission as hasPermissionInContext, isActiveWebappRow, isSuperAdminEmail, } from "./access.js";
|
|
5
|
-
import { DEFAULT_SUPER_ADMIN_EMAIL_SUFFIXES, isValidPermissionKey,
|
|
5
|
+
import { DEFAULT_SUPER_ADMIN_EMAIL_SUFFIXES, isValidPermissionKey, normalizePermissionKeys, } from "./catalog.js";
|
|
6
6
|
const deletedAt = () => new Date().toISOString();
|
|
7
7
|
const toNumber = (value) => {
|
|
8
8
|
const parsed = Number(value);
|
|
@@ -142,16 +142,14 @@ export function createWebappRbac(config) {
|
|
|
142
142
|
}
|
|
143
143
|
return updateWebAppTableRegister(headers, employeeRolesTableId, current.id, {
|
|
144
144
|
...current.data,
|
|
145
|
-
allowed_item_ids: normalizeIdList(body.allowed_item_ids ?? current.data.allowed_item_ids),
|
|
146
|
-
allowed_payee_ids: normalizeIdList(body.allowed_payee_ids ?? current.data.allowed_payee_ids),
|
|
147
145
|
fechaEliminacion: deletedAt(),
|
|
148
146
|
});
|
|
149
147
|
}
|
|
150
148
|
const payload = {
|
|
149
|
+
...current?.data,
|
|
150
|
+
...(body.extra ?? {}),
|
|
151
151
|
employee_id: employeeId,
|
|
152
152
|
role_id: toNumber(body.role_id),
|
|
153
|
-
allowed_item_ids: normalizeIdList(body.allowed_item_ids),
|
|
154
|
-
allowed_payee_ids: normalizeIdList(body.allowed_payee_ids),
|
|
155
153
|
fechaEliminacion: "",
|
|
156
154
|
};
|
|
157
155
|
if (current) {
|
|
@@ -171,9 +169,8 @@ export function createWebappRbac(config) {
|
|
|
171
169
|
roleId: null,
|
|
172
170
|
roleName: null,
|
|
173
171
|
assignmentId: null,
|
|
172
|
+
assignment: null,
|
|
174
173
|
permissionKeys: [...config.allPermissionKeys],
|
|
175
|
-
allowedItemIds: [],
|
|
176
|
-
allowedPayeeIds: [],
|
|
177
174
|
};
|
|
178
175
|
}
|
|
179
176
|
if (!employeeId) {
|
|
@@ -202,9 +199,8 @@ export function createWebappRbac(config) {
|
|
|
202
199
|
roleId,
|
|
203
200
|
roleName: role.data.name,
|
|
204
201
|
assignmentId: assignment.id,
|
|
202
|
+
assignment: assignment.data,
|
|
205
203
|
permissionKeys: sanitizeKeys(role.data.permission_keys),
|
|
206
|
-
allowedItemIds: normalizeIdList(assignment.data.allowed_item_ids),
|
|
207
|
-
allowedPayeeIds: normalizeIdList(assignment.data.allowed_payee_ids),
|
|
208
204
|
};
|
|
209
205
|
};
|
|
210
206
|
const hasAppAccess = async (headers, session) => {
|
|
@@ -14,8 +14,7 @@ export type UpdateRoleInput = Partial<Pick<WebappRole, "name" | "description" |
|
|
|
14
14
|
export type AssignEmployeeRoleInput = {
|
|
15
15
|
employee_id: number;
|
|
16
16
|
role_id: number | null;
|
|
17
|
-
|
|
18
|
-
allowed_payee_ids?: number[];
|
|
17
|
+
extra?: Record<string, unknown>;
|
|
19
18
|
};
|
|
20
19
|
export declare function createWebappRbac(config: WebappRbacConfig): {
|
|
21
20
|
config: WebappRbacConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauru-sdk/utils",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.22.1",
|
|
4
4
|
"description": "Utilidades, parseo de request y demás para desarrollo de webapps de Zauru",
|
|
5
5
|
"main": "./dist/esm/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -71,12 +71,12 @@
|
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"@aws-sdk/client-cloudwatch-logs": "^3.1123.0",
|
|
73
73
|
"@remix-run/node": "^2.8.1",
|
|
74
|
-
"@zauru-sdk/common": "^6.8.
|
|
74
|
+
"@zauru-sdk/common": "^6.8.6",
|
|
75
75
|
"@zauru-sdk/config": "^6.0.0",
|
|
76
76
|
"@zauru-sdk/graphql": "^6.8.0",
|
|
77
|
-
"@zauru-sdk/services": "^6.11.
|
|
78
|
-
"@zauru-sdk/types": "^6.
|
|
77
|
+
"@zauru-sdk/services": "^6.11.9",
|
|
78
|
+
"@zauru-sdk/types": "^6.24.0",
|
|
79
79
|
"moment": "^2.30.1"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "d1667a29d9fabc9980d171fed30796c232de358d"
|
|
82
82
|
}
|