From d1261460bac6b365db808127be36a16dd2a79cc0 Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Fri, 19 Jul 2024 16:36:14 -0400 Subject: [PATCH] dev: obtain driver permission from system user --- src/backend/src/services/auth/PermissionService.js | 2 +- src/backend/src/services/drivers/DriverService.js | 1 - .../src/structured/sequence/check-user-permission.js | 8 ++++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/backend/src/services/auth/PermissionService.js b/src/backend/src/services/auth/PermissionService.js index b18d1a2a..e913ddb0 100644 --- a/src/backend/src/services/auth/PermissionService.js +++ b/src/backend/src/services/auth/PermissionService.js @@ -88,7 +88,7 @@ const implicit_user_app_permissions = [ ]; const implicit_user_permissions = { - 'driver': {}, + // 'driver': {}, }; class PermissionRewriter { diff --git a/src/backend/src/services/drivers/DriverService.js b/src/backend/src/services/drivers/DriverService.js index 861957c3..0553714a 100644 --- a/src/backend/src/services/drivers/DriverService.js +++ b/src/backend/src/services/drivers/DriverService.js @@ -91,7 +91,6 @@ class DriverService extends BaseService { try { return await this._call(...a); } catch ( e ) { - console.error(e); return this._driver_response_from_error(e); } } diff --git a/src/backend/src/structured/sequence/check-user-permission.js b/src/backend/src/structured/sequence/check-user-permission.js index 421a78ca..f28d12a7 100644 --- a/src/backend/src/structured/sequence/check-user-permission.js +++ b/src/backend/src/structured/sequence/check-user-permission.js @@ -20,9 +20,13 @@ const { Sequence } = require("../../codex/Sequence"); const { get_user } = require("../../helpers"); const { Actor, UserActorType } = require("../../services/auth/Actor"); - - module.exports = new Sequence([ + async function grant_if_system (a) { + const { actor } = a.values(); + if ( actor.type.user.username === 'system' ) { + return a.stop({}); + } + }, async function rewrite_permission (a) { let { permission } = a.values(); permission = await a.icall('_rewrite_permission', permission);