Skip to content

Allow Adding Repo With Permissions #388

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

Merged
merged 2 commits into from
Jun 24, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/Github/Api/Organization/Teams.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,12 @@ public function repository($team, $username, $repository)
return $this->get('teams/'.rawurlencode($team).'/repos/'.rawurlencode($username).'/'.rawurlencode($repository));
}

public function addRepository($team, $username, $repository)
public function addRepository($team, $username, $repository, $params = array())
{
if (isset($params['permission']) && !in_array($params['permission'], array('pull', 'push', 'admin'))) {
$params['permission'] = 'pull';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to throw an exception for bad input

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am literally following the standard way this has been done not 20 lines above. Would you like me to change that one as well?

}

return $this->put('teams/'.rawurlencode($team).'/repos/'.rawurlencode($username).'/'.rawurlencode($repository));
}

Expand Down