Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add user as a collaborator with permission parameter #1101

Closed
snadon opened this issue Feb 9, 2016 · 10 comments
Closed

Add user as a collaborator with permission parameter #1101

snadon opened this issue Feb 9, 2016 · 10 comments
Labels
Type: Bug Something isn't working as documented

Comments

@snadon
Copy link

snadon commented Feb 9, 2016

Should we be able to set permissions when adding a collaborator to a repository?

The GitHub API supports it:
https://developer.github.com/v3/repos/collaborators/#add-user-as-a-collaborator

But Octokit.Net does not:
https://github.com/octokit/octokit.net/blob/master/Octokit%2FClients%2FIRepoCollaboratorsClient.cs#L44

@haacked
Copy link
Contributor

haacked commented Feb 9, 2016

Yeah, that looks like an oversight on our part. It think we should add an overload that accepts an enum with the available permission options.

@haacked
Copy link
Contributor

haacked commented Feb 9, 2016

Want to submit a PR?

@M-Zuber
Copy link
Contributor

M-Zuber commented Feb 9, 2016

And here I was talking bad about you.
image
Please accept my apologies 😄

@haacked
Copy link
Contributor

haacked commented Feb 9, 2016

Please accept my apologies

LOLOLOL! No apologies necessary. You're usually correct. I happen to be taking a break to try and respond to all the OSS projects I maintain so the timing was lucky.

@ryangribble
Copy link
Contributor

Just a question on this out of interest...

I think we should add an overload that accepts an enum with the available permission options.

Are you saying @haacked that this body parameter should actually be explicitly in the overloaded function, or should it be what appears to be the "usual" Octokit way where a Request object is passed in?

Just trying to get a feel for the octokit.net conventions, most I had come across seem to use the request object approach, so was surprised to see you mention adding an overload directly taking the enum paramter (unless i misunderstood)

Enum directly in Ad function

enum CollaboratorPermission { Read, Write, Admin }

Task Add(string owner, string repo, string user, CollaboratorPermission permission);

vs

Using a request object

enum CollaboratorPermission { Read, Write, Admin }

public class CollaboratorUpdate
{
   public CollaboratorPermission Permission { get; set; }
}

Task Add(string owner, string repo, string user, CollaboratorUpdate update);

@haacked
Copy link
Contributor

haacked commented Feb 10, 2016

@ryangribble you're exactly right, it should be a request object. I was being lazy with my words. 😄

@ryangribble
Copy link
Contributor

Sweet, my understanding remains intact 😁

@ryangribble
Copy link
Contributor

Also note that as part of this GitHub API change, they indicated that the permission parameter when creating and editing Teams is deprecated. So potentially on our NewTeam and UpdateTeam request model classes, we should mark that field as Obsolete

@shiftkey
Copy link
Member

So potentially on our NewTeam and UpdateTeam request model classes, we should mark that field as Obsolete

👍

@ryangribble
Copy link
Contributor

This was implemented in #1410 but I will raise a new issue to cover this other comment:

Also note that as part of this GitHub API change, they indicated that the permission parameter when creating and editing Teams is deprecated. So potentially on our NewTeam and UpdateTeam request model classes, we should mark that field as Obsolete

@nickfloyd nickfloyd added Type: Bug Something isn't working as documented and removed category: bug labels Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working as documented
Projects
None yet
Development

No branches or pull requests

6 participants