utils.leanix_user

class LeanIXUser:

Class to represent a LeanIX user. Used for quality management calculations and subscription handling.

LeanIXUser(user)

Instantiates a User from a dict. Only used internally.

user
subscriptions
def get(self, key, default=None):

Wrapper for standard python get() function for users. Gets a user attribute or returns a default value.

@classmethod
def all(cls, options=None, lx_client=None):

Returns all users, after making sure they have all been loaded from LeanIX.
Set options to {"force_refresh": True} to refresh the users cache from LeanIX first.

@classmethod
def find_by_role(cls, role, lx_client=None):

Finds users by workspace role.
Set force_refresh = True to refresh the users cache from LeanIX first.

Example:

admins = LeanIXUser.find_by_role("ADMIN")
@classmethod
def find(cls, display_name, force_refresh=False, lx_client=None):

Finds user by displayName. Checks for exact match and returns the first matching user.
Set force_refresh = True to refresh the users cache from LeanIX first.

Example:

john = LeanIXUser.find("John Doe")
@classmethod
def find_by_email(cls, email, force_refresh=True, lx_client=None):

Finds user by email address. Checks for exact match and returns the first matching user.
force_refresh parameter is deprecated.

Example:

john = LeanIXUser.find_by_email("john.doe@example.com")
@classmethod
def find_by_id(cls, user_id, force_refresh=True, lx_client=None):

Finds user by id.
Parameter force_refresh is not used at the moment, since we load the user directly from the API and not from cache.

Example:

john = LeanIXUser.find_by_id("fac7f0a6-88be-49fd-8935-1fde3edd335d")
def is_active(self):

Returns True if user status is active.

def recently_active(self):

Returns True if user has been logged in during the last 6 months.

def archive(self, lx_client=None):

Archives a user.

def get_subscriptions(self):

Returns all subscriptions of a user. Subscriptions are loaded along with each fact sheet, so you should run Application.all() or FactSheet.all() before using .get_subscriptions(), or otherwise you will get an empty result.

def fact_sheets( self, role, subscription_type=None, fs_type=None, load=False, lx_client=None, filters=None):

Returns all fact sheets that this user is subscribed to using the given role and/or subscription_type.

def is_technical(self):