Skip to content

Commit e4d496c

Browse files
lnielsensigmavirus24
authored andcommitted
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). (cherry picked from commit 80f91f2) Conflicts: AUTHORS.rst
1 parent 6e97462 commit e4d496c

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

AUTHORS.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,6 @@ Contributors
8080
- Marc Abramowitz (@msabramo)
8181

8282
- Adrian Moisey (@adrianmoisey)
83+
84+
- Lars Holm Nielsen (@larshankat)
85+

github3/repos/repo.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ def __init__(self, repo, session=None):
122122

123123
#: Is this repository private?
124124
self.private = repo.get('private')
125+
126+
#: Permissions for this repository
127+
self.permissions = repo.get('permissions')
128+
125129
#: ``datetime`` object representing the last time commits were pushed
126130
#: to the repository.
127131
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
@@ -910,6 +910,12 @@ def test_parent(self):
910910
r = repos.Repository(json)
911911
assert isinstance(r.parent, repos.Repository)
912912

913+
def test_permissions(self):
914+
json = load('repo')
915+
permissions = {"admin": True, "push": True, "pull": True}
916+
assert json['permissions'] == permissions
917+
assert self.repo.permissions == permissions
918+
913919
def test_pull_request(self):
914920
self.response('pull', 200)
915921
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