aloux-iam 0.0.144 → 0.0.145

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/lib/middleware.js CHANGED
@@ -4,15 +4,13 @@ const Permission = require("./models/Permission");
4
4
  const historyController = require("./controllers/history");
5
5
 
6
6
  const getAccess = (user, resource) => {
7
- // Cuenta de servicio
7
+ // Cuenta de servicio: verifica acceso por api asignada
8
8
  const userApis = user?.data?.apis || [];
9
- if (userApis.length > 0) {
10
- return userApis.some(
11
- (apiId) => apiId.toString() === resource._id.toString(),
12
- );
9
+ if (userApis.some((apiId) => apiId.toString() === resource._id.toString())) {
10
+ return true;
13
11
  }
14
12
 
15
- // Flujo normal
13
+ // Flujo normal: verifica permisos por función/rol
16
14
  for (let i in user._functions) {
17
15
  for (let j in user._functions[i]._permissions) {
18
16
  if (user._functions[i]._permissions[j].status === "Activo") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aloux-iam",
3
- "version": "0.0.144",
3
+ "version": "0.0.145",
4
4
  "description": "Aloux IAM for APIs ",
5
5
  "main": "index.js",
6
6
  "scripts": {