From 739b6ef381481c91e5cfb5e3c4a91a0b49a59459 Mon Sep 17 00:00:00 2001 From: Ignacio Fiorentino Date: Mon, 13 Jun 2016 13:26:33 -0300 Subject: [PATCH] Provide doc for user consent model. --- docs/index.rst | 4 ++-- docs/sections/userconsent.rst | 19 +++++++++++++++++++ oidc_provider/models.py | 2 +- 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 docs/sections/userconsent.rst diff --git a/docs/index.rst b/docs/index.rst index ceb0781..43974a5 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -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` - diff --git a/docs/sections/userconsent.rst b/docs/sections/userconsent.rst new file mode 100644 index 0000000..bc74025 --- /dev/null +++ b/docs/sections/userconsent.rst @@ -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 `_. + + >>> from oidc_provider.models import UserConsent + >>> UserConsent.objects.filter(user__email='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. diff --git a/oidc_provider/models.py b/oidc_provider/models.py index 7495044..09b36a2 100644 --- a/oidc_provider/models.py +++ b/oidc_provider/models.py @@ -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__()