def get_user_groups()

in ees_sharepoint/permission_sync_command.py [0:0]


    def get_user_groups(self, user_ids):
        """This method returns the groups of each user in all the site-collections
        :param user_ids: user ids to fetch the groups of the specific user"""
        user_group = {}
        for collection in self.site_collections:
            user_group_collection = {}
            rel_url = f"sites/{collection}/"
            for name, user_id in user_ids[collection].items():
                response = self.permissions.fetch_groups(rel_url, user_id)
                if response:
                    groups = get_results(self.logger, response.json(), "user_groups")
                    if groups:
                        user_group_collection[name] = [group["Title"] for group in groups]
            user_group.update({collection: user_group_collection})
        return user_group