Example #1
0
    def run(self, user, base_url, filter=None, role=None, limit=20):

        kwargs = {}
        if filter:
            kwargs['filter'] = filter
        if role:
            kwargs['role'] = role

        result = []
        try:
            if base_url == None:
                self._reset(user)
            else:
                self._reset(user + '|' + base_url)
            org = self._client.get_organization(user)
            members = org.get_members(**kwargs)
            members = list(members)

            for index, member in enumerate(members):
                member = user_to_dict(user=member)
                result.append(member)
                if (index + 1) >= limit:
                    break

        except UnknownObjectException:
            member = self._client.get_user(user)
            member = user_to_dict(user=member)
            result.append(member)

        return result
Example #2
0
    def run(self, user, token_user):
        if token_user:
            self._change_to_user_token(token_user)

        user = self._client.get_user(user)
        result = user_to_dict(user=user)
        return result
 def run(self, organization, team_id, user):
     user = self._client.get_user(user)
     organization = self._client.get_organization(organization)
     team = organization.get_team(team_id)
     team.add_membership(member=user)
     result = user_to_dict(user=user)
     return result
Example #4
0
    def run(self, user, token_user, github_type):
        enterprise = self._is_enterprise(github_type)
        if token_user:
            self._change_to_user_token(token_user, enterprise)

        user = self._client.get_user(user)
        result = user_to_dict(user=user)
        return result
Example #5
0
 def run(self, user):
     user = self._client.get_user(user)
     result = user_to_dict(user=user)
     return result