How to limit username account naming for a specific local user directory in Jira?

Sorin Sbarnea (Citrix)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 2, 2012

I have a public Jira instance that allows people to register to create new accounts, but the same instance is used by internal people that are using LDAP to authenticate.

The main problem is how to prevent people from outside from creating accounts with the same name as ones from intranet?

3 answers

1 accepted

0 votes
Answer accepted
Sorin Sbarnea (Citrix)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 12, 2012
Here is a client-side restriction that works if you add this code to the Annoucement Banner in admin pannel.
Still rememeber that this is only client side, so people can go around this if they really want.
<script type="text/javascript">

if(typeof jQuery == 'undefined'){
        document.write('<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.min.js"></'+'script>');
  }

jQuery(function(){
jQuery('#signup').submit(function(e) {
   username = escape(document.getElementById("signup-username").value);
   if (! /^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$/.test(username)) {
   alert("Your username is not acceptable.\n\nYou must use 'firstname.lastname' pattern when you create your username.\n\nYou must have a dot inside your username.");
   stopEvent(e);

  }   
});
});

</script>

1 vote
Ruchi Tandon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 4, 2012

Hey Sorin,

I would support the option of

"force a specific pattern (regexp) for creation of local accounts."

You can use Javascript code on top of JIRA to achieve this. This would make sure that the usernames are never the same.

The other option with the email addresses

"even better allow, people to login using their email address (email as login). I know that this could be a problem if you have several accounts with the same email, something that currently is possible in Jira, even if I wish not to be possible."

seems prone to errors, so I would not recommend it.

In addition to above options, you could write a plugin in order to achieve this. If your team does not have the expertise to implement this, you could contact one of our Experts who are professionals in implementing requirements like these.

Regards,

Ruchi

1 vote
Harry Chan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 2, 2012

Hi, I can't think of any out-of-the-box way to handle it, but you can edit the registration page with some javascript.

Use the JIRA REST API to search for users with the username used to register and reject if a result returns from the REST search. Does this work for you?

Sorin Sbarnea (Citrix)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 2, 2012

It doesn't work because corporate accounts can be created at any time. All I am looking for is to force a specific pattern (regexp) for creation of local accounts.

Harry Chan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 2, 2012

Hi, you can add the regexp via javascript just as well. Are you looking for a plugin or an existing solution instead? We haven't had to do this just yet.

Sorin Sbarnea (Citrix)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 3, 2012

1st JavaScript is client side so there is no guarantee that people will not get around this, but probably I could leave with this problem. 2nd, which is more important: I don't want to modify Jira core files because the changes will be lost at each upgrade, which is quite often.

A plugin will probably do.

Suggest an answer

Log in or Sign up to answer