OAuth2 scope generation for WebAPI resources.
Return the scope dictionary.
This method requires
WEB_API_ROOT_RESOURCEsetting to point to an instance of the root resource for your WebAPI. Optionally, the
djblets.webapi.oauth2_scopes.WebAPIScopeDictionary) can be set to specialize scope generation.
djblets.extensionsapp is being used, then the
WEB_API_SCOPE_DICT_CLASSsetting should be set to
The scope dictionary.
- Return type
- class WebAPIScopeDictionary(root_resource)¶
A Web API scope dictionary.
This class knows how to build a list of available scopes from the WebAPI resource tree at runtime.
By default, it will only have to walk the API tree once, after which the value can be cached.
- property scope_dict¶
The dictionary of scopes defined by this dictionary.
The value is cached so that it will only be recomputed when the dictionary is updated.
Iterate through all keys in the dictionary.
This is used by oauth2_provider when on Python 3.x to get the list of scope keys.
unicode – The key for each scope.
Clear all scopes from the dictionary.
The next attempt at fetching scopes will repopulate the dictionary from scratch.
- class ExtensionEnabledWebAPIScopeDictionary(*args, **kwargs)¶
A Web API scopes dictionary that supports extensions.
This scope dictionary is only required if your app is using the
- enable_web_api_scopes(*args, **kwargs)¶
Enable WebAPI scopes.
oauth2_provider.settings.oauth2_settingsobject will be patched so that scopes are correctly cached. The cache will be lazily updated after the scopes are updated.