dev: obtain driver permission from system user

This commit is contained in:
KernelDeimos 2024-07-19 16:36:14 -04:00 committed by Eric Dubé
parent ab156297a7
commit d1261460ba
3 changed files with 7 additions and 4 deletions

View File

@ -88,7 +88,7 @@ const implicit_user_app_permissions = [
]; ];
const implicit_user_permissions = { const implicit_user_permissions = {
'driver': {}, // 'driver': {},
}; };
class PermissionRewriter { class PermissionRewriter {

View File

@ -91,7 +91,6 @@ class DriverService extends BaseService {
try { try {
return await this._call(...a); return await this._call(...a);
} catch ( e ) { } catch ( e ) {
console.error(e);
return this._driver_response_from_error(e); return this._driver_response_from_error(e);
} }
} }

View File

@ -20,9 +20,13 @@ const { Sequence } = require("../../codex/Sequence");
const { get_user } = require("../../helpers"); const { get_user } = require("../../helpers");
const { Actor, UserActorType } = require("../../services/auth/Actor"); const { Actor, UserActorType } = require("../../services/auth/Actor");
module.exports = new Sequence([ 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) { async function rewrite_permission (a) {
let { permission } = a.values(); let { permission } = a.values();
permission = await a.icall('_rewrite_permission', permission); permission = await a.icall('_rewrite_permission', permission);