Cannot delete an internal directory user in Bamboo with error - The user directory doesn't allow this operation.
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Cannot delete an internal directory user in Bamboo with the following error appear in GUI
Can't delete user 'testuser'. The user directory doesn't allow this operation.
Please try reloading the page.
Environment
The solution in this article has been tested on version 8.1.2 but may work with other versions of Bamboo.
Diagnosis
Confirm the user directories on Bamboo Server to confirm the user directory is enabled using the below query:
SELECT * FROM cwd_directory;
Verify the user information on Bamboo database to confirm that the user is created in internal database:
SELECT * FROM cwd_user WHERE user_name = 'testuser';
Cause
One of the limitations of the current internal user management is that users that have added labels or comments can't be removed.
Solution
Search through the comments and labels made by a user using the below SQL query:
SELECT * FROM USER_COMMENT WHERE USER_NAME='<username>';
SELECT * FROM BUILDRESULTSUMMARY_LABEL WHERE USER_NAME='<username>';
If found, you can delete them using the below SQL query:
DELETE FROM USER_COMMENT WHERE USER_NAME='<username>';
DELETE FROM BUILDRESULTSUMMARY_LABEL WHERE USER_NAME='<username>';
Replace <username> with the username you cannot delete
Always take a database backup before performing manual update or deletion queries.
The following bug BAM-25932 Deleting a Bamboo Internal directory user gives exception - The user directory doesn't allow this operation is reported for working on a permanent solution.