NOTE: Trivore ID Documentation has moved to https://trivoreid.com

The content on this site IS OUT OF DATE!

This space has been archived!

Please go ahead to the new site!

Namespace Service (python)

Wrapper for '/namespace' API.

List of all options

  • Get list of namespaces
  • Create/get one/modify namespace

Get and filter list of namespaces

from trivoreid.utils.criteria import Filter

fil = Filter(Filter.CONTAINS, 'code', 'sdk')
ns = api.namespace_service.get_all(filter_fields=fil).resources

print(ns[0].serialize())
 Output
INFO:root:Found 3 namespaces

{'id': 'exampleId',
 'code': 'testsdk',
 'name': 'Test SDK',
 'shortName': 'Test SDK',
 'usernamePolicy': 'EMAIL',
 'commMethodMaxQty': 10,
 'duplicateNicknamesAllowed': True,
 'validFrom': '2019-04-24T05:33:58.162Z',
 'validTo': '2099-12-31T23:59:59Z',
 'smsSettings': {'enabled': True,
  'customEnabled': False,
  'defaultOriginator': None,
  'defaultRegion': None},
 'authorisationRestrictedMode': True,
 'defaultGroupPolicy': {'policyName': 'Organisation default account policy',
  'policyDescription': 'This default policy cannot be removed',
  'inactivityTime': 30,
  'resetPasswordOptions': {'namespaceInfoHidden': False,
   'namespaceInfoHiddenEnabled': False,
   'allFieldsEnabled': None},
  'preferredLocale': None,
  'preferredTimeFormat': None,
  'preferredDateFormat': None,
  'displayNameFormat': 'FIRSTNAME_MIDDLENAME_LASTNAME',
  'timeZone': 'Europe/Helsinki',
  'minPwLength': 9,
  'minCharClasses': 1,
  'pwMaxAge': 730,
  'pwHistorySaved': 1,
  'incorrectLoginAttemptsThresh': 10,
  'incorrectLoginTimeWin': 5,
  'incorrectLoginLockoutTime': 5,
  'maxPwSequenceLength': 0,
  'maxConsecutiveIdenticalChars': 0,
  'dataStoreCountry': None,
  'passwordUserNameRuleEnforced': False,
  'passwordDictionaryRuleEnforced': False,
  'ciscoGroupPolicy': '',
  'twoFactorAuthOptions': 'ALLOW_BOTH',
  'loginAllowedIpRules': [],
  'emailVerifyLinkExpireDays': None,
  'mobileVerificationRequired': False,
  'persistentLoginAllowed': True,
  'emailLoginAllowed': 'ALLOWED',
  'mobileLoginAllowed': 'ALLOWED',
  'mobileVerificationAttemptsPerDay': None,
  'strongIdRequiredForMyDataDownload': False,
  'emailVerificationUnlocksUser': False,
  'userImageAllowed': True,
  'deleteMode': 'HARD_DELETE',
  'hideOnSoftDelete': True,
  'loginTargetBlacklist': []}}

Namespace management

from trivoreid.models.namespace import UsernamePolicy, Namespace

ns_to_create = Namespace()

ns_to_create.code = 'examplecode'
ns_to_create.name = 'Example Name'
ns_to_create.shortName = 'Example Name'
ns_to_create.usernamePolicy = UsernamePolicy.EMAIL

namespace = api.namespace_service.create(ns_to_create)
namespace.usernamePolicy = UsernamePolicy.EIGHT_NUMBERS

# Disable sending SMS messages
namespace.smsSettings.enabled = False

api.namespace_service.update(namespace)
namespace2 = api.namespace_service.get(idOrCode='examplecode')
 Output
INFO:root:Successfully created namespace with id exampleId
INFO:root:Successfully modified namespace with id exampleId

Modified Namespace fields : {'id': 'exampleId',
 'code': 'examplecode',
 'name': 'Example Name',
 'shortName': 'Example Name',
 'usernamePolicy': 'EIGHT_NUMBERS',
 'commMethodMaxQty': 2,
 'duplicateNicknamesAllowed': False,
 'validFrom': '2019-06-07T08:38:42.684Z',
 'validTo': '2099-12-31T23:59:59Z',
 'smsSettings': {'enabled': False,
  'customEnabled': False,
  'defaultOriginator': None,
  'defaultRegion': None},
 'authorisationRestrictedMode': True,
 'defaultGroupPolicy': {'policyName': 'Organisation default account policy',
  'policyDescription': 'This default policy cannot be removed',
  'inactivityTime': 30,
  'resetPasswordOptions': {'namespaceInfoHidden': False,
   'namespaceInfoHiddenEnabled': False,
   'allFieldsEnabled': None},
  'preferredLocale': None,
  'preferredTimeFormat': None,
  'preferredDateFormat': None,
  'displayNameFormat': 'FIRSTNAME_MIDDLENAME_LASTNAME',
  'timeZone': 'Europe/Helsinki',
  'minPwLength': 9,
  'minCharClasses': 1,
  'pwMaxAge': 730,
  'pwHistorySaved': 1,
  'incorrectLoginAttemptsThresh': 10,
  'incorrectLoginTimeWin': 5,
  'incorrectLoginLockoutTime': 5,
  'maxPwSequenceLength': 0,
  'maxConsecutiveIdenticalChars': 0,
  'dataStoreCountry': None,
  'passwordUserNameRuleEnforced': False,
  'passwordDictionaryRuleEnforced': False,
  'ciscoGroupPolicy': '',
  'twoFactorAuthOptions': 'ALLOW_BOTH',
  'loginAllowedIpRules': [],
  'emailVerifyLinkExpireDays': None,
  'mobileVerificationRequired': False,
  'persistentLoginAllowed': True,
  'emailLoginAllowed': 'ALLOWED',
  'mobileLoginAllowed': 'ALLOWED',
  'mobileVerificationAttemptsPerDay': None,
  'strongIdRequiredForMyDataDownload': False,
  'emailVerificationUnlocksUser': False,
  'userImageAllowed': True,
  'deleteMode': 'HARD_DELETE',
  'hideOnSoftDelete': True,
  'loginTargetBlacklist': []}}

INFO:root:Successfully found namespace with id exampleId

Namespace Service Models

/wiki/spaces/TISpubdoc/pages/20515206

/wiki/spaces/TISpubdoc/pages/20515212

/wiki/spaces/TISpubdoc/pages/20515210

/wiki/spaces/TISpubdoc/pages/20515205

/wiki/spaces/TISpubdoc/pages/20515211

NOTE: Trivore ID Documentation has moved to https://trivoreid.com

The content on this site IS OUT OF DATE!

This space has been archived!