Added checkAccess routine
authorSantosh G. Vattam <vattam.santosh@gmail.com>
Thu, 06 Aug 2009 18:49:06 +0530
changeset 33 2840389ee7f9
parent 5 88ae12bc6280
child 34 21942fac2b4b
Added checkAccess routine
app/projrev/views/helpers/access.py
--- a/app/projrev/views/helpers/access.py	Thu Aug 06 18:38:54 2009 +0530
+++ b/app/projrev/views/helpers/access.py	Thu Aug 06 18:49:06 2009 +0530
@@ -5,3 +5,23 @@
 __authors__ = [
   '"Madhusudan.C.S" <madhusudancs@gmail.com>',
 ]
+
+
+def checkAccess(func, request):
+  """ To check the access of the user and then return the appropriate function 
+object
+ """
+  user_kind = rights[func.__name__]
+  if user.is_authenticated():
+    if user_kind == 'staff':
+      if user.is_staff:
+        return func(request)
+      else:
+        return 
+        
+    if user_kind == 'proposer':
+      if not user.is_staff:
+        return func(request)
+      else:
+        return
+    
\ No newline at end of file