changeset 686:ff6a8196ebfe beta

fixed anonymous access bug.
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 13 Nov 2010 02:50:32 +0100
parents 87943675813a
children b9442a8b5e02
files rhodecode/lib/auth.py rhodecode/model/user.py
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/auth.py	Sat Nov 13 02:39:03 2010 +0100
+++ b/rhodecode/lib/auth.py	Sat Nov 13 02:50:32 2010 +0100
@@ -209,8 +209,6 @@
     :param session:
     """
     user = session.get('rhodecode_user', AuthUser())
-
-
     #if the user is not logged in we check for anonymous access
     #if user is logged and it's a default user check if we still have anonymous
     #access enabled
@@ -219,6 +217,7 @@
         if anonymous_user.active is True:
             #then we set this user is logged in
             user.is_authenticated = True
+            user.user_id = anonymous_user.user_id
         else:
             user.is_authenticated = False
 
--- a/rhodecode/model/user.py	Sat Nov 13 02:39:03 2010 +0100
+++ b/rhodecode/model/user.py	Sat Nov 13 02:50:32 2010 +0100
@@ -151,6 +151,11 @@
         present in database
         :param user:
         """
+
+        if not hasattr(user, 'user_id') or user.user_id is None:
+            raise Exception('passed in user has to have the user_id attribute')
+
+
         log.debug('filling auth user data')
         try:
             dbuser = self.get(user.user_id)