Provide doc for user consent model.
This commit is contained in:
parent
b145c5d477
commit
739b6ef381
|
@ -22,12 +22,13 @@ Contents:
|
|||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
|
||||
sections/installation
|
||||
sections/relyingparties
|
||||
sections/serverkeys
|
||||
sections/templates
|
||||
sections/claims
|
||||
sections/userconsent
|
||||
sections/oauth2
|
||||
sections/settings
|
||||
sections/contribute
|
||||
|
@ -39,4 +40,3 @@ Indices and tables
|
|||
* :ref:`genindex`
|
||||
* :ref:`modindex`
|
||||
* :ref:`search`
|
||||
|
||||
|
|
19
docs/sections/userconsent.rst
Normal file
19
docs/sections/userconsent.rst
Normal file
|
@ -0,0 +1,19 @@
|
|||
.. _userconsent:
|
||||
|
||||
User Consent
|
||||
############
|
||||
|
||||
The package store some information after the user grant access to some client. For example, you can use the ``UserConsent`` model to list applications that the user have authorized access. Like Google does `here <https://security.google.com/settings/security/permissions>`_.
|
||||
|
||||
>>> from oidc_provider.models import UserConsent
|
||||
>>> UserConsent.objects.filter(user__email='some@email.com')
|
||||
[<UserConsent: Example Client - some@email.com>]
|
||||
|
||||
Properties
|
||||
==========
|
||||
|
||||
* ``user``: Django user object.
|
||||
* ``client``: Relying Party object.
|
||||
* ``expires_at``: Expiration date of the consent.
|
||||
* ``scope``: Scopes authorized.
|
||||
* ``date_given``: Date of the authorization.
|
|
@ -78,7 +78,7 @@ class BaseCodeTokenModel(models.Model):
|
|||
return timezone.now() >= self.expires_at
|
||||
|
||||
def __str__(self):
|
||||
return u'{0} - {1} ({2})'.format(self.client, self.user.email, self.expires_at)
|
||||
return u'{0} - {1}'.format(self.client, self.user.email)
|
||||
|
||||
def __unicode__(self):
|
||||
return self.__str__()
|
||||
|
|
Loading…
Reference in a new issue