Skip to content

Commit 80f91f2

Browse files
committed
Repository.permissions attribute support
* Adds support for accessing permissions attribute of a repository. This is needed to enable filtering a users repositories based on admin, push and pull permissions (addresses zenodo/zenodo#135).
1 parent 1271a48 commit 80f91f2

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

AUTHORS.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,5 @@ Contributors
8484
- Bryce Boe (@bboe)
8585

8686
- Ryan Weald (@rweald)
87+
88+
- Lars Holm Nielsen (@larshankat)

github3/repos/repo.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ def _update_attributes(self, repo):
127127

128128
#: Is this repository private?
129129
self.private = repo.get('private')
130+
131+
#: Permissions for this repository
132+
self.permissions = repo.get('permissions')
133+
130134
#: ``datetime`` object representing the last time commits were pushed
131135
#: to the repository.
132136
self.pushed_at = self._strptime(repo.get('pushed_at'))

tests/test_repos.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,12 @@ def test_parent(self):
507507
r = repos.Repository(json)
508508
assert isinstance(r.parent, repos.Repository)
509509

510+
def test_permissions(self):
511+
json = load('repo')
512+
permissions = {"admin": True, "push": True, "pull": True}
513+
assert json['permissions'] == permissions
514+
assert self.repo.permissions == permissions
515+
510516
def test_pull_request(self):
511517
self.response('pull', 200)
512518
self.get(self.api + 'pulls/2')

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy