Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

At the current moment, we don’t have a possibility to choose disabled or deleted users, but it is only a restriction of the Jira default REST API. We are planning to fix it in the next release as well as review a correctness of the process for deleted users. But we have few workarounds how Jira administrators can manage this situation.

  • It is possible to anonymize any text field and replace information about disabled / deleted users using custom templates. It will work only for text fields. For it, administrators should create a custom template and then create a number of rules to replace user names, display names, and e-mail address.
    1. Click on the “Create custom template” button

    2. Fill all necessary fields, like Template name, Scope and Fields.
    3. Go to the “Data Processing Rules” tab and using “Create new rule” dialog create 3 rules.

    Do the same for Display names and E-mail address.
    After creating of all rules, an administrator should have something similar

    (all “Search type” fields should have “Plain text” type)

  • The first workaround will help to search / anonymize disabled / deleted users only for text fields, but if you need to find user in the user fields (like assignee, reporter, etc) you should do one more step. Unfortunately because of the limitations of the Jira REST API, you could not use the same “Data Processing rule” dialog to create a special rule for users, just because you can’t choose user in the user picker, but it is possible to use our API to create rule due to special Rest Call. Please execute the next javascript in the browser console with the correct parameters.

    let templateId = 1; // Here should be your template id
    let userMap = {"yoursourceusername":"yourtargetusername"}; // it is map of the changes "sourceUser" -> "targetUser", it is possible to specify a few number of users here
    let serverUrl = "https://your.server.url.com/contextPathIfExists"; // Your server url
    
    console.log("Starting...");
    let success = 0;
    let error = 0;
    let link = serverUrl + "/rest/actonic-gdpr/1.0/data-cleaner-template/rules";
    Object.keys(userMap).forEach((key) => {
    	console.log("> creating rule for '" + key + "' -> '" + userMap[key] + "'");
    	
    	let sourceUser = key
    	let targetUser = userMap[key]
    	let data = {
    		templateId: templateId,
    		name: sourceUser + " -> " + targetUser,
    		enabled: true,
    		replaceType: "user",
    		searchType: "user",
    		searchString: sourceUser,
    		replaceString: targetUser
    	}
    	
    	$.ajax({
    		url: link,
    		method: "PUT",
    		async: false,
    		headers: {
    			"Content-Type": "application/json"
    		},
    		data: JSON.stringify(data),
    		success: function (data) {
    			console.log(">>> ...created (" + JSON.stringify(data) + ")")
    			success++;
    		}, 
    		error: function (xhr) {
    			console.log("> !! FAILED for '" + sourceUser + "' -> '" + targetUser + "', reason: (" + xhr.status + ") " + xhr.statusText);
    			error++;
    		}
    	})
    });
    
    console.log("Finished!");
    console.log("Created rules : " + success);
    console.log("Failed create : " + error);
    
    
    
    
    https://test.actonic.io/jira/rest/api/2/user/search?username=myuser2&includeInactive=true&includeActive=true
  • No labels