How to add a user to JIRA Backend

This article descibes how to add a user to the JIRA backend database (Microsoft SQL Server in our case)

We use this in our script that adds users from active directory to JIRA. Any comments welcome...

Create a record in userbase & membershipbase tables:

userbase

ID username PASSWORD_HASH
10100 alitest (null)

So UserID = 10100 in our case

membershipbase

ID USER_NAME GROUP_NAME
10049 alitest jira-users

Ignore the membershipID (10049)

Create property strings (just increment IDs)

ID propertyvalue
10088 alitest@test
10089 Ali Test

Here 10088 is the emailID, and 10089 is the nameID

Now create property entries using the previously used IDs in ID column (emailID, nameID), and the UserID in the ENTITY_ID column

ID ENTITY_NAME ENTITY_ID PROPERTY_KEY propertytype
10088 OSUser 10100 email 5
10089 OSUser 10100 fullName 5

Labels

 
(None)
  1. Dec 27, 2005

    doggy mcdog says:

    Here's the tsql I used to update the names of everyone in our jira backend from ...

    Here's the tsql I used to update the names of everyone in our jira backend from a table in another db with the username | fullnames:

    Declare nameCursor Cursor
    For
    Select netid, fullname
    From usernames
    
    Open nameCursor
    Declare @netid varchar(25)
    Declare @fullname varchar(50)
    
    Fetch Next from nameCursor into @netid, @fullname
    while (@@Fetch_Status <> -1)
    Begin
    
    Update jirauser.propertystring 
        SET propertyvalue = @fullname
        Where ID = (select ps.ID as psID 
    from jirauser.userbase ub, jirauser.propertyentry pe, jirauser.propertystring ps
    where ub.ID = pe.entity_ID and
    pe.ID = ps.ID and pe.PROPERTY_KEY='fullName' and
    ub.username=@netid)
    
    Fetch Next from nameCursor into @netid, @fullname
    End
    
    Close nameCursor
    Deallocate nameCursor

    Yes - cursors are not manly enough for most sql gurus, but they're very readable.

  2. Feb 01, 2006

    Aino Andriessen says:

    Don't forget to update the OS... properties in the sequencevalueitem table. And ...

    Don't forget to update the OS... properties in the sequence_value_item table.
    And restart Jira, else caching can (and will) prevent to show your new users.