diff --git a/mo/web/__init__.py b/mo/web/__init__.py
index 91b6b579610201da190cb9c5ce7516a680bfc667..5fcc17104420775d5d29dd9d386e8a2693296f9a 100644
--- a/mo/web/__init__.py
+++ b/mo/web/__init__.py
@@ -189,7 +189,7 @@ def init_request():
         if user.is_org or user.is_admin:
             return redirect(url_for('org_index'))
     elif path.startswith('/doc/'):
-        if user.is_org or user.is_admin:
+        if user and user.is_org or user.is_admin:
             g.gatekeeper = mo.rights.Gatekeeper(user)