Exemple #1
0
 def revoke(self):
     super(OAuth2RefreshToken, self).revoke()
     account = Account._byID36(self.user_id)
     access_tokens = OAuth2AccessToken._by_user(account)
     for token in access_tokens:
         if token.refresh_token == self._id:
             token.revoke()
Exemple #2
0
 def get_editor_accounts(self):
     editors = self.get_editors()
     accounts = [Account._byID36(editor, data=True)
                 for editor in self.get_editors()]
     accounts = [account for account in accounts
                 if not account._deleted]
     return accounts
Exemple #3
0
    def check_valid(self):
        """Returns boolean indicating whether or not this access token is still valid."""

        # Has the token been revoked?
        if getattr(self, 'revoked', False):
            return False

        # Is the OAuth2Client still valid?
        try:
            client = OAuth2Client._byID(self.client_id)
            if getattr(client, 'deleted', False):
                raise NotFound
        except NotFound:
            return False

        # Is the user account still valid?
        if self.user_id:
            try:
                account = Account._byID36(self.user_id)
                if account._deleted:
                    raise NotFound
            except NotFound:
                return False

        return True
Exemple #4
0
 def get_editor_accounts(self):
     editors = self.get_editors()
     accounts = [Account._byID36(editor, data=True)
                 for editor in self.get_editors()]
     accounts = [account for account in accounts
                 if not account._deleted]
     return accounts
Exemple #5
0
    def check_valid(self):
        if getattr(self, 'revoked', False):
            return False

        try:
            client = OAuth2Client._byID(self.client_id)
            if getattr(client, 'deleted', False):
                raise NotFound
        except AttributeError:
            g.log.error("bad token %s: %s", self, self._t)
            raise
        except NotFound:
            return False

        if self.user_id:
            try:
                account = Account._byID36(self.user_id)
                if account._deleted:
                    raise NotFound
            except NotFound:
                return False

        return True
Exemple #6
0
    def check_valid(self):
        if getattr(self, 'revoked', False):
            return False

        try:
            client = OAuth2Client._byID(self.client_id)
            if getattr(client, 'deleted', False):
                raise NotFound
        except AttributeError:
            g.log.error("bad token %s: %s", self, self._t)
            raise
        except NotFound:
            return False

        if self.user_id:
            try:
                account = Account._byID36(self.user_id)
                if account._deleted:
                    raise NotFound
            except NotFound:
                return False

        return True
Exemple #7
0
 def get_authors(cls, revisions):
     authors = [r._get('author') for r in revisions]
     authors = filter(None, authors)
     return Account._byID36(authors, data=True)
Exemple #8
0
 def get_author(self):
     author = self._get('author')
     return Account._byID36(author, data=True) if author else None
Exemple #9
0
 def get_author(self):
     if self._get('last_edit_by'):
         return Account._byID36(self.last_edit_by, data=True)
     return None
Exemple #10
0
 def get_author(self):
     author = self._get('author')
     return Account._byID36(author, data=True) if author else None
Exemple #11
0
 def get_author(self):
     if self._get('last_edit_by'):
         return Account._byID36(self.last_edit_by, data=True)
     return None
Exemple #12
0
 def get_authors(cls, revisions):
     authors = [r._get('author') for r in revisions]
     authors = filter(None, authors)
     return Account._byID36(authors, data=True)