From 5d13888e8776ea495c274afb94e78fa85c69fe76 Mon Sep 17 00:00:00 2001 From: Peter253545 <58088721+Peter253545@users.noreply.github.com> Date: Fri, 29 Dec 2023 02:33:25 +0000 Subject: [PATCH 1/5] fix: actually pass new id to `hasPermission` --- src/routes/APIResource.mjs | 2 +- src/routes/Clients.mjs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/routes/APIResource.mjs b/src/routes/APIResource.mjs index ab7d9e5a..73f3ab98 100644 --- a/src/routes/APIResource.mjs +++ b/src/routes/APIResource.mjs @@ -360,7 +360,7 @@ export default class APIResource extends API { return undefined } - if (!Reflect.apply(changeRelationship.hasPermission, this, [ctx, entity, relationship.id])) { + if (!Reflect.apply(changeRelationship.hasPermission, this, [ctx, entity, data.id])) { throw new ForbiddenAPIError({ pointer: '/data' }) } return changeRelationship.patch({ entity, id: data.id, ctx, transaction }) diff --git a/src/routes/Clients.mjs b/src/routes/Clients.mjs index acdf422c..7c4aade9 100755 --- a/src/routes/Clients.mjs +++ b/src/routes/Clients.mjs @@ -201,8 +201,8 @@ export default class Clients extends APIResource { if (relationship === 'user') { return { many: false, - hasPermission (connection, entity, id) { - return (!entity.userId && id === connection.state.user.id) || Permission.granted({ + hasPermission (connection) { + return Permission.granted({ permissions: ['clients.write'], connection, }) From 75da28aa05c5ee8ea40f668fe5926a284f0b164c Mon Sep 17 00:00:00 2001 From: Peter253545 <58088721+Peter253545@users.noreply.github.com> Date: Fri, 29 Dec 2023 02:37:48 +0000 Subject: [PATCH 2/5] fix: check if a CMDR name contains "cmdr" correctly --- src/helpers/Validators.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/Validators.mjs b/src/helpers/Validators.mjs index a00276ab..cb423caf 100644 --- a/src/helpers/Validators.mjs +++ b/src/helpers/Validators.mjs @@ -4,7 +4,7 @@ import { UnprocessableEntityAPIError } from '../classes/APIError' import RegexLiteral from './RegexLiteral' -const forbiddenCMDRNameComponents = ['[pc]', '[xb]', '[ps]', 'CMDR'] +const forbiddenCMDRNameComponents = ['[pc]', '[xb]', '[ps]', 'cmdr'] const requiredQuoteFields = [ 'message', 'author', From 5fa7f65bea8a57a55ddd0c6057ba3cf6348a7d5a Mon Sep 17 00:00:00 2001 From: Peter253545 <58088721+Peter253545@users.noreply.github.com> Date: Fri, 29 Dec 2023 03:16:21 +0000 Subject: [PATCH 3/5] fix: remove unused deleted dependency --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index be1abbcd..c2394758 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ "git-rev-promises": "^1.1.0", "gulp-cli": "^2.2.0", "i18next": "^19.0.1", - "join-js": "xlexi/joinjs", "knex": "~2.4.2", "koa": "^2.11.0", "koa-body": "^4.1.1", From 7822664a6ad4cf541c100dce69f361fdf5cc77a5 Mon Sep 17 00:00:00 2001 From: Peter253545 <58088721+Peter253545@users.noreply.github.com> Date: Fri, 29 Dec 2023 03:20:07 +0000 Subject: [PATCH 4/5] chore: update lockfile --- yarn.lock | 8 -------- 1 file changed, 8 deletions(-) diff --git a/yarn.lock b/yarn.lock index 532824f3..f5ee3946 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2462,7 +2462,6 @@ __metadata: gulp-cli: ^2.2.0 i18next: ^19.0.1 jest: ^24.9.0 - join-js: xlexi/joinjs jsdoc: ^3.6.7 jsonapi-validator: ^3.0.5 knex: ~2.4.2 @@ -6755,13 +6754,6 @@ __metadata: languageName: node linkType: hard -join-js@xlexi/joinjs: - version: 0.0.0-development - resolution: "join-js@https://github.com/xlexi/joinjs.git#commit=d159421c5179c27b076bf7b19dc3276bd85136b7" - checksum: 8cf321d4e5fedb17c3b0c7b9a26da5b6a865068e5365470b6c2ea0abf5cd560e1a2d2b20d1a142b3d510efd2cb3121ce111dc9f4b27a6f8ad3c168e771e8ea50 - languageName: node - linkType: hard - "js-beautify@npm:^1.8.8": version: 1.14.6 resolution: "js-beautify@npm:1.14.6" From 533f7b852a54ec46f614275a094c49a4bced6ce4 Mon Sep 17 00:00:00 2001 From: Peter253545 <58088721+Peter253545@users.noreply.github.com> Date: Sat, 30 Dec 2023 02:25:47 +0000 Subject: [PATCH 5/5] fix: set NS_NO_EXPIRE on nick (NickAlias table) rather than group (NickCore table) See https://wiki.anope.org/index.php/2.0/Mysql:Scheme#NickAlias --- src/classes/Anope.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/classes/Anope.mjs b/src/classes/Anope.mjs index 6d7f1851..a49e028b 100644 --- a/src/classes/Anope.mjs +++ b/src/classes/Anope.mjs @@ -453,7 +453,6 @@ class Anope { KILLPROTECT: 1, MEMO_RECEIVE: 1, MEMO_SIGNON: 1, - NS_NO_EXPIRE: 1, NS_PRIVATE: 1, NS_SECURE: 1, display: nick, @@ -472,6 +471,7 @@ class Anope { vhost_creator: 'API', vhost_time: createdUnixTime, vhost_host: vhost, + NS_NO_EXPIRE: 1, }).into('anope_db_NickAlias') await transaction.commit()