Skip to content
Browse files

added auth_via filter

  • Loading branch information...
1 parent 7b1c13a commit 5d61bde035fbffa5ab7ecc1c2edaaecf146ed63a @brosner brosner committed Jul 19, 2012
View
0 oauth_access/templatetags/__init__.py
No changes.
View
15 oauth_access/templatetags/oauth_access_tags.py
@@ -0,0 +1,15 @@
+from django import template
+
+from oauth_access.token import Token
+
+
+register = template.Library()
+
+
+@register.filter
+def authed_via(user, service):
+ if user.is_authenticated():
+ token = Token.lookup(service, user)
+ return token is not None and not token.expired()
+ else:
+ return False
View
4 oauth_access/token.py
@@ -46,3 +46,7 @@ def link(self, key):
params["token"] = str(self)
token = LinkedToken.objects.create(**params)
return token
+
+ def expired(self):
+ # @@@ implement
+ return False
View
1 setup.py
@@ -12,6 +12,7 @@
url = "http://github.com/eldarion/django-oauth-access",
packages = [
"oauth_access",
+ "oauth_access.templatetags",
],
classifiers = [
"Development Status :: 3 - Alpha",

0 comments on commit 5d61bde

Please sign in to comment.
Something went wrong with that request. Please try again.