{"record":{"id":"8097122ca4eb17c7","repo":"RocketChat/Rocket.Chat","slug":"error-not-allowed-809712","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/setRealName.ts","lineNumber":27,"sourceCode":"\ndeclare module '@rocket.chat/ddp-client' {\n\t// eslint-disable-next-line @typescript-eslint/naming-convention\n\tinterface ServerMethods {\n\t\tsetRealName(name: string): string;\n\t}\n}\n\nMeteor.methods<ServerMethods>({\n\tasync setRealName(name) {\n\t\tmethodDeprecationLogger.method('setRealName', '9.0.0', '/v1/users.updateOwnBasicInfo');\n\t\tcheck(name, String);\n\t\tconst userId = Meteor.userId();\n\t\tif (!userId) {\n\t\t\tthrow new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'setRealName' });\n\t\t}\n\n\t\tif (!settings.get('Accounts_AllowRealNameChange')) {\n\t\t\tthrow new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'setRealName' });\n\t\t}\n\n\t\tif (!(await setRealName(userId, name))) {\n\t\t\tthrow new Meteor.Error('error-could-not-change-name', 'Could not change name', {\n\t\t\t\tmethod: 'setRealName',\n\t\t\t});\n\t\t}\n\n\t\treturn name;\n\t},\n});\n\nRateLimiter.limitMethod('setRealName', 1, 1000, {\n\tuserId: () => true,\n});\n","sourceCodeStart":9,"sourceCodeEnd":43,"githubUrl":"https://github.com/RocketChat/Rocket.Chat/blob/b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0/apps/meteor/server/meteor-methods/users/setRealName.ts#L9-L43","documentation":"setRealName refuses every name change when the workspace setting Accounts_AllowRealNameChange is false. The setting is read per-call from server settings, so a disabled value blocks the method even for otherwise valid names.","triggerScenarios":"Meteor.call('setRealName', name) or a saveUserProfile submit that includes realname, while Accounts_AllowRealNameChange is disabled in Administration > Accounts.","commonSituations":"LDAP-managed workspaces that lock display names to the directory source; default setups where the toggle is off; profile UIs that still render an editable name field.","solutions":["Enable Accounts_AllowRealNameChange if self-service rename should work","Hide/disable the name field when the setting is false (it is exposed in public settings)","Use /v1/users.updateOwnBasicInfo or an admin-only users.update flow when names are centrally managed"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const allowRealNameChange = publicSettings['Accounts_AllowRealNameChange'] === true;\nif (!allowRealNameChange) {\n  disableField('realname'); // do not submit realname at all\n}","typeGuard":null,"tryCatchPattern":"catch (err) {\n  if (err instanceof Meteor.Error && err.error === 'error-not-allowed') {\n    showNotice('Name change is disabled on this server');\n  }\n}","preventionTips":["Hide the name field when Accounts_AllowRealNameChange is false in public settings","Prefer /v1/users.updateOwnBasicInfo for new integrations - setRealName is deprecated","On LDAP-synced workspaces treat name as directory-owned and read-only in the UI"],"tags":["meteor","users","settings","account"],"backgroundTag":"feature-disabled-by-setting","analyzedSha":"b2c16d5842cbe6b69b59bdf6fc5e5f1afcd1f0b0","analyzedAt":"2026-08-18T15:26:39.429Z","contentChangedAt":"2026-08-18T15:26:39.429Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}