{"record":{"id":"fbae6deb0c20c1ea","repo":"RocketChat/Rocket.Chat","slug":"error-not-allowed-fbae6d","errorCode":"error-not-allowed","errorMessage":"Not allowed","messagePattern":"Not allowed","errorType":"exception","errorClass":"Meteor.Error","httpStatus":null,"severity":"error","filePath":"apps/meteor/server/meteor-methods/users/deleteUserOwnAccount.ts","lineNumber":23,"sourceCode":"import { Accounts } from 'meteor/accounts-base';\nimport { check } from 'meteor/check';\nimport { Meteor } from 'meteor/meteor';\n\nimport { trim } from '../../../lib/utils/stringUtils';\nimport { methodDeprecationLogger } from '../../lib/deprecationWarningLogger';\nimport { deleteUser } from '../../lib/users/deleteUser';\nimport { settings } from '../../settings';\n\ndeclare module '@rocket.chat/ddp-client' {\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\tinterface ServerMethods {\n\t\tdeleteUserOwnAccount(password: string, confirmRelinquish?: boolean): Promise<boolean>;\n\t}\n}\n\nexport const deleteUserOwnAccount = async (fromUserId: string, password: string, confirmRelinquish = false): Promise<boolean> => {\n\tif (!settings.get('Accounts_AllowDeleteOwnAccount')) {\n\t\tthrow new Meteor.Error('error-not-allowed', 'Not allowed', {\n\t\t\tmethod: 'deleteUserOwnAccount',\n\t\t});\n\t}\n\n\tif (!fromUserId) {\n\t\tthrow new Meteor.Error('error-invalid-user', 'Invalid user', {\n\t\t\tmethod: 'deleteUserOwnAccount',\n\t\t});\n\t}\n\n\tconst user = await Users.findOneById(fromUserId);\n\tif (!user) {\n\t\tthrow new Meteor.Error('error-invalid-user', 'Invalid user', {\n\t\t\tmethod: 'deleteUserOwnAccount',\n\t\t});\n\t}\n\n\tif (user.services?.password && trim(user.services.password.bcrypt)) {","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/meteor-methods/users/deleteUserOwnAccount.ts#L5-L41","documentation":"`deleteUserOwnAccount` first checks the `Accounts_AllowDeleteOwnAccount` setting and throws `error-not-allowed` when it is disabled. Self-service account deletion is opt-in in Rocket.Chat; when the setting is off, no user can delete their own account regardless of other permissions. Subsequent checks (valid user id, password verification) never run when this gate trips.","triggerScenarios":"Invoking `Meteor.call('deleteUserOwnAccount', password, confirmRelinquish?)` on a workspace where `Accounts_AllowDeleteOwnAccount` is false — e.g. calling the method directly or from an old client while the workspace has the feature disabled.","commonSituations":"Fresh/self-managed installs where the setting defaults to off; administrators disabling self-deletion for data-retention or compliance and users still attempting it; older clients or scripts that assume the feature is available.","solutions":["Enable the feature: Admin → General → Accounts, set 'Allow Delete Own Account' to true (setting id `Accounts_AllowDeleteOwnAccount`).","Keep it disabled and remove/hide self-deletion UI when retention policy forbids user-initiated deletion.","For programmatic deletion, use an admin's `deleteUser` path with `confirmRelinquish` as appropriate instead of the self-service method."],"exampleFix":"// before\nMeteor.call('deleteUserOwnAccount', password);\n\n// after - only expose self-deletion when the workspace allows it\nimport { settings } from '@rocket.chat/settings-client'; // reactive public settings source\nif (!settings.get('Accounts_AllowDeleteOwnAccount')) {\n  throw new Error('Self-account deletion is disabled on this server');\n}\nMeteor.call('deleteUserOwnAccount', password);","handlingStrategy":"validation","validationCode":"// expose self-deletion only when the server enables it\nif (publicSettings.get('Accounts_AllowDeleteOwnAccount') === true) {\n  await Meteor.callAsync('deleteUserOwnAccount', password);\n}","typeGuard":"const isSelfDeletionEnabled = (value: unknown): value is true => value === true;","tryCatchPattern":"try {\n  await Meteor.callAsync('deleteUserOwnAccount', password);\n} catch (e: any) {\n  if (e?.error === 'error-not-allowed') {\n    // feature disabled server-side: show 'account deletion is disabled' instead of a retry\n  }\n}","preventionTips":["Read the public Accounts_AllowDeleteOwnAccount setting to decide whether to render self-deletion UI.","Administrators: enable the setting in Admin → General → Accounts before announcing self-deletion to users.","Use the admin deleteUser path for compliance-driven removals rather than user self-service."],"tags":["meteor","users","account-deletion","settings","feature-flag"],"backgroundTag":"feature-disabled-by-setting","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}