示例#1
0
文件: models.py 项目: adlius/osf.io
 def on_delete(self):
     """When the user deactivates the addon, clear auth for connected nodes.
     """
     super(BaseOAuthUserSettings, self).on_delete()
     nodes = [AbstractNode.load(node_id) for node_id in self.oauth_grants.keys()]
     for node in nodes:
         node_addon = node.get_addon(self.oauth_provider.short_name)
         if node_addon and node_addon.user_settings == self:
             node_addon.clear_auth()
示例#2
0
 def on_delete(self):
     """When the user deactivates the addon, clear auth for connected nodes.
     """
     super(BaseOAuthUserSettings, self).on_delete()
     nodes = [
         AbstractNode.load(node_id) for node_id in self.oauth_grants.keys()
     ]
     for node in nodes:
         node_addon = node.get_addon(self.oauth_provider.short_name)
         if node_addon and node_addon.user_settings == self:
             node_addon.clear_auth()
示例#3
0
 def get_nodes_with_oauth_grants(self, external_account):
     # Generator of nodes which have grants for this external account
     for node_id, grants in self.oauth_grants.items():
         node = AbstractNode.load(node_id)
         if external_account._id in grants.keys() and not node.is_deleted:
             yield node
示例#4
0
文件: models.py 项目: adlius/osf.io
 def get_nodes_with_oauth_grants(self, external_account):
     # Generator of nodes which have grants for this external account
     for node_id, grants in self.oauth_grants.iteritems():
         node = AbstractNode.load(node_id)
         if external_account._id in grants.keys() and not node.is_deleted:
             yield node
示例#5
0
 def get_object(self, queryset=None):
     return AbstractNode.load(self.kwargs.get('guid'))
示例#6
0
 def get_object(self, queryset=None):
     node = AbstractNode.load(self.kwargs.get('guid'))
     return {
         'id': node.id,
     }