Bugfix to permission updates

This commit is contained in:
Erik 2023-07-04 19:19:46 +03:00
parent e76fab36ed
commit 9aae5b576a
Signed by: Navy.gif
GPG Key ID: 2532FBBB61C65A68
3 changed files with 4 additions and 4 deletions

View File

@ -91,10 +91,10 @@ class Registry
if (!(endpoint instanceof Endpoint))
throw new Error(`Attempt to load invalid endpoint at ${file.name}`);
if (endpoints.has(endpoint.resolveable))
throw new Error(`Error registering endpoint ${endpoint.resolveable}: an endpoint with that resolveable already exists`);
throw new Error(`Error registering endpoint ${endpoint.resolveable} from file ${file.name}: an endpoint with that resolveable already exists`);
endpoints.set(endpoint.resolveable, endpoint);
logger.info(`Created endpoint ${endpoint.name}`);
logger.info(`Created endpoint ${endpoint.name} from file ${file.name}`);
}

View File

@ -43,7 +43,7 @@ class Entity
this.#_id = id;
this.#_name = name;
this.#_disabled = disabled ?? false;
this.#_permissions = PermissionManager.merge(permissions || {}, PermissionManager.DefaultPermissions);
this.#_permissions = PermissionManager.merge(PermissionManager.DefaultPermissions, permissions || {});
this.#_createdTimestamp = createdTimestamp ?? Date.now();
this.#_cachedTimestamp = Date.now();
this.#_note = note ?? null;

View File

@ -118,7 +118,7 @@ class PermissionManager
PermissionManager.merge(to[key] as Permissions, from[key] as Permissions);
// eslint-disable-next-line no-undefined
}
else if (!(key in to))
else // if (!(key in to))
{
to[key] = from[key];
}