Fetch all permissions for a single user

I’m looking to retrieve all the repo permissions for a user.

Effectively something that I could massage to produce:

{
"login": "myUser",
"name": "myUsername",
  "repositories":[
    {
      "name": "myRepo"
      "permissions":[
        {
          "permission":"ADMIN",
          "permissionSources": .....
         },
        {
          "permission":"READ",
          "permissionSources": .....
        }
      ]
    }
  ]
}

The closest thing I have so far is to:

  • lookup my user,
  • iterate through the user’s repos (unfortunately the collection here doesn’t have all the nice details that RepositoryCollaboratorEdge has)
  • iterate through those repos’ collaborators
  • get permission and permission sources

But the problem is I get ALL of the collaborators for the repo on the third step. Is there a way to filter down to just the current user somehow? Or perhaps there is another way to go about this?

Here’s the query I’m describing:

query {
  user( login: myuser ) {
    name
    repositories(first:100, affiliations:[OWNER, ORGANIZATION_MEMBER, COLLABORATOR], ownerAffiliations:[OWNER, ORGANIZATION_MEMBER, COLLABORATOR] ) {
      edges {
        node {
          name
          nameWithOwner
	  collaborators ( first: 100 ){
	    edges {
	      permission
	      permissionSources {
                source {
	 	  ... on Organization { id name }
		  ... on Repository { id name nameWithOwner }
		  ... on Team { id name slug }
	        }
	      }
	    }
	  }
        }
      }
    }
  }
}

It looks like the collaborators connection on Repository allows you to add a query parameter to filter by username.

Let us know if you have more questions.

I also want to know the same. Kindly Guide me about APK Street