Skip to content

Commit 0ac4169

Browse files
committed
fix(server/accounts): blacklist some account actions on group accounts
1 parent 9477e3c commit 0ac4169

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

server/accounts/roles.ts

+11
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ type OxAccountMetadataRow = OxAccountPermissions & { id?: number; name?: OxAccou
88

99
const accountRoles = {} as Record<string, OxAccountPermissions>;
1010

11+
const blacklistedGroupActions = {
12+
addUser: true,
13+
removeUser: true,
14+
manageUser: true,
15+
transferOwnership: true,
16+
manageAccount: true,
17+
closeAccount: true,
18+
} as Record<keyof OxAccountPermissions, true>;
19+
1120
export function CheckRolePermission(roleName: OxAccountRole | null, permission: keyof OxAccountPermissions) {
1221
if (!roleName) return;
1322

@@ -25,6 +34,8 @@ export async function CanPerformAction(
2534
const groupName = (await SelectAccount(accountId))?.group;
2635

2736
if (groupName) {
37+
if (action in blacklistedGroupActions) return false;
38+
2839
const group = GetGroup(groupName);
2940
const groupRole = group.accountRoles[player.getGroup(groupName)];
3041

0 commit comments

Comments
 (0)