Provide doc for user consent model.

This commit is contained in:
Ignacio Fiorentino 2016-06-13 13:26:33 -03:00
parent b145c5d477
commit 739b6ef381
3 changed files with 22 additions and 3 deletions

View file

@ -28,6 +28,7 @@ Contents:
sections/serverkeys sections/serverkeys
sections/templates sections/templates
sections/claims sections/claims
sections/userconsent
sections/oauth2 sections/oauth2
sections/settings sections/settings
sections/contribute sections/contribute
@ -39,4 +40,3 @@ Indices and tables
* :ref:`genindex` * :ref:`genindex`
* :ref:`modindex` * :ref:`modindex`
* :ref:`search` * :ref:`search`

View 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.

View file

@ -78,7 +78,7 @@ class BaseCodeTokenModel(models.Model):
return timezone.now() >= self.expires_at return timezone.now() >= self.expires_at
def __str__(self): 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): def __unicode__(self):
return self.__str__() return self.__str__()