def add_user(self,
                 username,
                 email,
                 directoryId=1,
                 password=None,
                 fullname=None,
                 notify=False,
                 active=True,
                 ignore_existing=False,
                 application_keys=None,
                 ):
        """Create a new JIRA user.

        :param username: the username of the new user
        :type username: str
        :param email: email address of the new user
        :type email: str
        :param directoryId: The directory ID the new user should be a part of (Default: 1)
        :type directoryId: int
        :param password: Optional, the password for the new user
        :type password: Optional[str]
        :param fullname: Optional, the full name of the new user
        :type fullname: Optional[str]
        :param notify: Whether or not to send a notification to the new user. (Default: False)
        :type notify: bool
        :param active: Whether or not to make the new user active upon creation. (Default: True)
        :type active: bool
        :param ignore_existing: Whether or not to ignore and existing user. (Default: False)
        :type ignore_existing: bool
        :param applicationKeys: Keys of products user should have access to
        :type applicationKeys: Optional[list]

        :return: Whether or not the user creation was successful.
        :rtype: bool

        :raises JIRAError:  If username already exists and `ignore_existing` has not been set to `True`.

        """
        if not fullname:
            fullname = username
        # TODO(ssbarnea): default the directoryID to the first directory in jira instead
        # of 1 which is the internal one.
        url = self._options['server'] + '/rest/api/latest/user'

        # implementation based on
        # https://docs.atlassian.com/jira/REST/ondemand/#d2e5173
        x = OrderedDict()

        x['displayName'] = fullname
        x['emailAddress'] = email
        x['name'] = username
        if password:
            x['password'] = password
        if notify:
            x['notification'] = 'True'
        if application_keys is not None:
            x['applicationKeys'] = application_keys

        payload = json.dumps(x)
        try:
            self._session.post(url, data=payload)
        except JIRAError as e:
            err = e.response.json()['errors']
            if 'username' in err and err['username'] == 'A user with that username already exists.' and ignore_existing:
                return True
            raise e
        return True
def add_user ( self , username , email , directoryId = 1 , password = None , fullname = None , notify = False , active = True , ignore_existing = False , application_keys = None , ) : if not fullname : fullname = username url = self . _options [ 'server' ] + '/rest/api/latest/user' x = OrderedDict ( ) x [ 'displayName' ] = fullname x [ 'emailAddress' ] = email x [ 'name' ] = username if password : x [ 'password' ] = password if notify : x [ 'notification' ] = 'True' if application_keys is not None : x [ 'applicationKeys' ] = application_keys payload = json . dumps ( x ) try : self . _session . post ( url , data = payload ) except JIRAError as e : err = e . response . json ( ) [ 'errors' ] if 'username' in err and err [ 'username' ] == 'A user with that username already exists.' and ignore_existing : return True raise e return True
Create a new JIRA user.

        :param username: the username of the new user
        :type username: str
        :param email: email address of the new user
        :type email: str
        :param directoryId: The directory ID the new user should be a part of (Default: 1)
        :type directoryId: int
        :param password: Optional, the password for the new user
        :type password: Optional[str]
        :param fullname: Optional, the full name of the new user
        :type fullname: Optional[str]
        :param notify: Whether or not to send a notification to the new user. (Default: False)
        :type notify: bool
        :param active: Whether or not to make the new user active upon creation. (Default: True)
        :type active: bool
        :param ignore_existing: Whether or not to ignore and existing user. (Default: False)
        :type ignore_existing: bool
        :param applicationKeys: Keys of products user should have access to
        :type applicationKeys: Optional[list]

        :return: Whether or not the user creation was successful.
        :rtype: bool

        :raises JIRAError:  If username already exists and `ignore_existing` has not been set to `True`.