Package: zivverscim
zivverscimZivver Python pip module to CRUD accounts dynamically.
This library enables the use of SCIM to talk toZivverRequirementsYou will need to get the API key from Zivver to allow REST calls.Generate API Keys, go to this URLGenerate API keyor follow these steps:In Zivver, go to Organization Settings -> API KeysClick on Generate API KeysSave the API Key, you will need the key to setup a connection to ZivverPython >=3.6Endpoint URLs to Zivver for CRUD actions.Example endpoint:https://app.zivver.com/api/scim/v2/UsersInstallInstall via pip$: pip install zivverscimTestingYou should create an.envfile, we already have added the.env.dummyfile that you need to rename to.env.
Update the enviroment variables inside that file.Clone this repo and install requirements:$: git clone git@github.com:Adapta-Innovation/zivverscim.git
$: cd zivverscim
$: pip install -r requirements.txtInstall Zivverscim locally:$: pip install -e .Run the tests:$: python tests/crud_accounts.pyExceptionsUse the customZivverCRUDErrorobject to get the exception messages:ZivverCRUDError.get_message()# Returns the error messageZivvZivverCRUDError.get_sollution()# Returns the possible sollutionCreate accountBefore you do anything in Python with Zivver, you will need to import the Zivver library:fromzivverscimimportscim_connection_crud# ...create a new Zivver Scim Connection Object:zivver_scim_connection=scim_connection_crud.ZivverSCIMConnection(external_oauth_token_value=self.external_oauth_token.token_value,# Generated API keyscim_api_create_url='https://app.zivver.com/api/scim/v2/Users/',# Endpoint URL from Zivverscim_api_update_url='https://app.zivver.com/api/scim/v2/Users/',# Endpoint URL from Zivverscim_api_get_url='https://app.zivver.com/api/scim/v2/Users/',# Endpoint URL from Zivverscim_api_delete_url='https://app.zivver.com/api/scim/v2/Users/',# Endpoint URL from Zivver)You can use thezivver_scim_connectionobject to create new accounts:zivver_user_object=zivver_scim_connection.create_user_in_zivver(first_name='John',last_name='Doe',nick_name='{}{}'.format('John','Doe'),user_name='john@gmail.com',zivver_account_key='john@gmail.com',sso_connection=True,# Only if SSO is enabledis_active=True# If the user should be active upon creation)print(zivver_user_object)# Prints a json represetation of the objectYou can also usealiasesanddelegatesattributes to append those:zivver_user_object=zivver_scim_connection.create_user_in_zivver(# ...aliases=['john.doe@gmail.com'],# Alias for current userdelegates=['manager@gmail.com']# Delegate access for other users)ReferenceCreate accounts:zivver_user_object=zivver_scim_connection.create_user_in_zivver(first_name='John',last_name='Doe',nick_name='{}{}'.format('John','Doe'),user_name='john@gmail.com',zivver_account_key='john@gmail.com',sso_connection=True,# Only if SSO is enabledis_active=True,# If the user should be active upon creationaliases=['john.doe@gmail.com'],# Alias for current userdelegates=['manager@gmail.com']# Delegate access for other users)Update accounts:zivver_user_object=zivver_scim_connection.update_user_in_zivver(account_id='12412412-4124124124-12412412412-124124412241',first_name='John',last_name='Doe',nick_name='{}{}'.format('John','Doe'),user_name='john@gmail.com',zivver_account_key='john@gmail.com',sso_connection=True,# Only if SSO is enabledis_active=True,# If the user should be active upon creationaliases=['john.doe@gmail.com'],# Alias for current userdelegates=['manager@gmail.com']# Delegate access for other users)Get one account:zivver_user_object=zivver_scim_connection.get_user_from_zivver(account_id=zivver_user_object.account_id)Get bulk accountszivver_users_object=zivver_scim_connection.get_all_users_from_zivver()Delete accountzivver_scim_connection.delete_user_from_zivver(account_id=zivver_user_object.account_id)zivver_users_objectZivver returns azivver_users_objectobject containing the account information.
The most important one is the account_id, which you will need to update/get/delete the existing account.Theaccount_idis a UUID randomly generated by Zivver, so save it.classZivverUser:"""ZivverUser Class object created from the ZivverUser create/update response"""def__init__(self,account_id=None,name_formatted=None,meta_created_at=None,meta_location=None,meta_resource_type=None,phone_numbers=None,user_name=None,nick_name=None,is_active=False,schemas=None,enterprise_user=None,zivver_scim_user_aliases=None,zivver_scim_user_delegates=None):self.account_id=account_idself.name_formatted=name_formattedself.meta_created_at=meta_created_atself.meta_location=meta_locationself.meta_resource_type=meta_resource_typeself.phone_numbers=phone_numbersself.user_name=user_nameself.nick_name=nick_nameself.is_active=is_activeself.schemas=schemasself.enterprise_user=enterprise_userself.zivver_scim_user_aliases=zivver_scim_user_aliasesself.zivver_scim_user_delegates=zivver_scim_user_delegates#...ContributionAdapta welcomes any contributions to the open source ZivverSCIM library, so feel free to contribute.IssuesFeel free to submit issues and enhancement requests.Contributing (how to)Please refer to each project's style and contribution guidelines for submitting patches and additions. In general, we follow the "fork-and-pull" Git workflow.Forkthe repo on GitHubClonethe project to your own machineCommitchanges to your own branchPushyour work back up to your forkSubmit aPull requestso that we can review your changesNOTE: Be sure to merge the latest from "upstream" before making a pull request!Copyright and LicensingThe Zivverscim library software is licensed under GNU GENERAL PUBLIC LICENSE V3.0