Skip to content

Commit

Permalink
Merge pull request #543 from nyov/master
Browse files Browse the repository at this point in the history
Support `*` OAuth scope (#471)
  • Loading branch information
bboe committed Nov 22, 2015
2 parents 96d8fc0 + 4072450 commit aab9701
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions praw/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1357,10 +1357,13 @@ def get_me(self):

def has_scope(self, scope):
"""Return True if OAuth2 authorized for the passed in scope(s)."""
if not self.is_oauth_session():
return False
if '*' in self._authentication:
return True
if isinstance(scope, six.string_types):
scope = [scope]
return self.is_oauth_session() and all(s in self._authentication
for s in scope)
return all(s in self._authentication for s in scope)

def is_logged_in(self):
"""Return True when the session is authenticated via username/password.
Expand Down

0 comments on commit aab9701

Please sign in to comment.