This article will focus on the groupHandler class that is incorporated in this module. This class is important as it will enable you to control the membership within each class.
As explained in the article about User Groups and Product Profile, you can manage your users within the Product Profiles or with User Groups for multi solution access. Product Profiles are exclusive to one product and sometimes, you may want to manage access rights for multiple products, the common requests being for Adobe Analytics and Adobe Launch, or Analytics and Target.
By creating users groups, you are able to manage multi-products access within the admin console. Adding a user to the group grants him access to a complete list of solution.
The API and the python module provides possibility to manage users attached to a product profile or to a user groups as they are both consider groups. However, at the moment of the writing, the groups doesn’t return the product profile attached to them.
The groupHandler class will enable you to create an instance of a group and manage the users inside these groups.
This class comes with several methods :
This method creates the instance itself. In order to be set, the class init method would need one argument, the group name.
- groupName : REQUIRED : the group name
- users=None : OPTIONAL : if you have a set of users that
It will set 2 objects after initialization; the users object, that is a list of users you have passed in, empty if you didn’t give any. The groupName, which is the string name of your group.
This method takes one parameter (users). Users can be a string or a list and it is filling the internal variable “new_users” of the instance.
This method takes one parameter (users). Users can be a string or a list and it is filling the internal variable “delete_users“. It also remove the users from the other existing variables (“users” and “new_users“)
This methods takes one parameter (df_users), df_users is the the list of users that has been retrieved by the method retrieveInfos.
This method is here to save you time and automatically filled the users list.
If the instance of the groupHandler class that you are creating doesn’t contain _admin_. A new method is created : createAdminGroup.
This new method is creating the admin group so you can add admin users to the user group created.
This method is used to send the information to adobe and therefore to sync your user group with adobe status.
It takes 2 parameters :
- action : REQUIRED: 2 possible values :
- “add” : it will add the list of users of that group to it officially (passing the information to adobe)
- “remove” : it will remove the list of users that you have in this instance, as “delete_users“. Sending that information to Adobe.
- token : OPTIONAL : It will take the token that is required for the connection. However, if the token is not provided but information to the adobe io account uploaded, it will automatically create the token before sending the information.
I will show you an example on how you can create a group instance, add or remove a user and sync the group afterwards.
myGroup = pyaum.groupHandler(groupName='mygroup') ## will create the instance
myGroup.addUsers('email@example.com') ## will keep information on the new user to add
myGroup.new_users ## will display the list of new users to add to this group
myGroup.removeUsers('firstname.lastname@example.org') ## will keep information on the users to remove from the group.
myGroup.delete_users ## will display the list of the users to remove from the group.
result_add = myGroup.syncGroup(action='add') ## will send the information contained in the new_users list to Adobe
result_remove = myGroup.syncGroup(action='remove') ## will send the information contained in the delete_users list to Adobe
I hope that this article is making understand the different methods available on this module. I feel that this can be very useful for lots of Admin users with their Adobe management.
On this serie, you may want to read those articles:
|Adobe IO : JWT authentication||How to create JWT authentication with OpenSSL and python|
|Adobe IO : User Management : Introduction||What you need to know about this module|
|Adobe IO : User Management : Configuration||What do you need to have for this module.|
|Adobe IO : User Management : retrieve information||How to retrieve the information currently held on your adobe admin console.|
|Adobe IO : User Management : Create and Remove Users and Users Groups||How to create and remove users and user groups.|
|Adobe IO : User Management : User Group Class||Discover how you can handle the different group with the python class available|
|Adobe IO : User Management : Other functionnalities||Other functionalities that are included in this python module and that can be quite usefule|