It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to delete a user with issue comments

Hi, I would like to know if it is possible to delete a user from Jira who has added comments to  issues.

I know that we can disable the user/remove access, but would like to know on how to permanently the user from the application.

 

2 answers

@PraveenYou  can  use this  plugin https://marketplace.atlassian.com/apps/1214301/comment-toolbox-for-jira?hosting=server&tab=overview

Right now it not  possible on  application interface, but of course you  could  crack and do it from  database but not  advisable.

Advice

Don't delete users. Inactivate them. Deleting them can cause errors when JIRA tries to resolve any action they took in an issue. It stores the database id, not their name in issues.  What  i  would do is to  deactivate them,  remove all access group/roles, save the groups some which  they belong  to  some where in case they  return. access to  projects base on single user  of-course could be given  back  by project admin.

There is a ticket already registered in  Jira  https://jira.atlassian.com/browse/JRASERVER-34718

 

best!.

Inactivating user should complete the task.

At first we wanted to do just the same but later on realized that inactivating is enough and do the trick.

I give an up to @Moses Thomas's advice.

If you have ScriptRunner or database access you can move those comments to another user and then remove that unwanted user.

please share the steps to do that

I am also interested to know how to move the comments. 

WARNING: No guarantee that this works or that it won't break your Jira.

Test this in your test environment first and backup your database before making any direct modification to your database.



import com.atlassian.jira.component.ComponentAccessor

import groovy.sql.Sqlimport org.ofbiz.core.entity.ConnectionFactory

import org.ofbiz.core.entity.DelegatorInterface

import java.sql.Connection


def delegator = (DelegatorInterface)

ComponentAccessor.getComponent(DelegatorInterface)

String helperName = delegator.getGroupHelperName("default")


def sqlStmt = """

UPDATE       "jiraaction"

SET author = 'newusername'

WHERE author = 'oldusername'

""" 
Connection conn = ConnectionFactory.getConnection(helperName);
Sql sql = new Sql(conn)
StringBuffer sb = new StringBuffer()
sql.eachRow(sqlStmt) {
    sb << "${it}\t\n"
}
sb.toString()

Also, the quotation marks may be erroneous, so if you just copy paste it may not work.

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you