Ejemplo n.º 1
0
    def add_users_to_repo(self, project, team, graph):
        """
        adds users to Neo4j
        """
        url = self.get_vsts_team_membership_url(project.Id, team.Id)
        print("Users Url:")
        print(url)
        users = self.vsts.make_request(url)

        for item in users["value"]:
            #we don't want system users
            if item.get('isContainer', False):
                print("skipped system user")
                continue

            user = Person()
            user.Id = item.get("id")
            user.Name = item.get("displayName")
            user.Url = item.get("url")
            user.UniqueName = item.get("uniqueName")
            user.MemberOf.add(team)
            print("Adding User")
            transaction = graph.begin()
            transaction.merge(user)
            transaction.graph.push(user)
Ejemplo n.º 2
0
 def link_to_author(self, comment, vsts_data, graph):
     '''
     Link to Author
     '''
     author_id = vsts_data.get("author").get("id")
     author = Person.select(graph, author_id).first()
     if author is None:
         author = Person()
         author.Id = author_id
     comment.Author.add(author)
Ejemplo n.º 3
0
 def link_created_by(self, pull_request, vsts_info, graph):
     '''
     link the pull request to the person who created it
     '''
     raw = vsts_info.get("createdBy")
     user_id = raw.get("id")
     created_by = Person.select(graph, user_id).first()
     if created_by:
         pull_request.CreatedBy.add(created_by)
     else:
         print("Pull Request CreatedBy User not in db")
         user = Person()
         user.Id = user_id
         pull_request.CreatedBy.add(user)