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()
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()
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
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
def get_object(self, queryset=None): return AbstractNode.load(self.kwargs.get('guid'))
def get_object(self, queryset=None): node = AbstractNode.load(self.kwargs.get('guid')) return { 'id': node.id, }