diff --git a/server/chat-commands/room-settings.ts b/server/chat-commands/room-settings.ts
index a1d2cbaaab..45f159d1d2 100644
--- a/server/chat-commands/room-settings.ts
+++ b/server/chat-commands/room-settings.ts
@@ -1298,7 +1298,7 @@ export const commands: ChatCommands = {
if (!this.runBroadcast()) return;
if (!room.settings.introMessage) return this.sendReply("This room does not have an introduction set.");
this.sendReply('|raw|
' + room.settings.introMessage.replace(/\n/g, '') + '
');
- if (!this.broadcasting && user.can('declare', null, room) && cmd !== 'topic') {
+ if (!this.broadcasting && user.can('declare', null, room, 'roomintro') && cmd !== 'topic') {
const code = Utils.escapeHTML(room.settings.introMessage).replace(/\n/g, '
');
this.sendReplyBox(`Source:
/roomintro ${code} `);
}
@@ -1345,7 +1345,7 @@ export const commands: ChatCommands = {
this.checkCan('mute', null, room);
if (!room.settings.staffMessage) return this.sendReply("This room does not have a staff introduction set.");
this.sendReply(`|raw|${room.settings.staffMessage.replace(/\n/g, ``)}
`);
- if (user.can('ban', null, room) && cmd !== 'stafftopic') {
+ if (user.can('ban', null, room, 'staffintro') && cmd !== 'stafftopic') {
const code = Utils.escapeHTML(room.settings.staffMessage).replace(/\n/g, '
');
this.sendReplyBox(`Source:
/staffintro ${code} `);
}
diff --git a/server/chat-plugins/room-events.ts b/server/chat-plugins/room-events.ts
index 39be84fb1b..9fb671c8ac 100644
--- a/server/chat-plugins/room-events.ts
+++ b/server/chat-plugins/room-events.ts
@@ -316,11 +316,10 @@ export const commands: ChatCommands = {
buff += '';
this.sendReply(`|raw|${buff}
`);
- if (!this.broadcasting && user.can('ban', null, room) && events.length === 1) {
+ if (!this.broadcasting && user.can('ban', null, room, 'roomevents view') && events.length === 1) {
const event = events[0];
this.sendReplyBox(
- Utils.html`/roomevents add ${event.eventName} |` +
- Utils.html`${event.date} | ${event.desc}`
+ Utils.html`/roomevents add ${event.eventName} | ${event.date} | ${event.desc}`
);
}
},
diff --git a/server/chat-plugins/room-faqs.ts b/server/chat-plugins/room-faqs.ts
index d69d02cd76..386fca7e9d 100644
--- a/server/chat-plugins/room-faqs.ts
+++ b/server/chat-plugins/room-faqs.ts
@@ -156,7 +156,7 @@ export const pages: PageTable = {
if (aliases.length) {
buf += `
Aliases: ${aliases.join(', ')}`;
}
- if (user.can('ban', null, room)) {
+ if (user.can('ban', null, room, 'addfaq')) {
const src = Utils.escapeHTML(topic).replace(/\n/g, `
`);
buf += `
Raw text
`;
buf += `/addfaq ${key}, ${src} `;
diff --git a/server/users.ts b/server/users.ts
index d0174e5b4d..2eb004b425 100644
--- a/server/users.ts
+++ b/server/users.ts
@@ -528,11 +528,11 @@ export class User extends Chat.MessageContext {
const status = statusMessage + (this.userMessage || '');
return status;
}
- can(permission: RoomPermission, target: User | null, room: BasicRoom): boolean;
+ can(permission: RoomPermission, target: User | null, room: BasicRoom, cmd?: string): boolean;
can(permission: GlobalPermission, target?: User | null): boolean;
- can(permission: RoomPermission & GlobalPermission, target: User | null, room?: BasicRoom | null): boolean;
- can(permission: string, target: User | null = null, room: BasicRoom | null = null): boolean {
- return Auth.hasPermission(this, permission, target, room);
+ can(permission: RoomPermission & GlobalPermission, target: User | null, room?: BasicRoom | null, cmd?: string): boolean;
+ can(permission: string, target: User | null = null, room: BasicRoom | null = null, cmd?: string): boolean {
+ return Auth.hasPermission(this, permission, target, room, cmd);
}
/**
* Special permission check for system operators