From 3dd6b2fa8c4ed497a40db3bf7a11649e95de9ce5 Mon Sep 17 00:00:00 2001
From: Alex Shulgin <ash@commandprompt.com>
Date: Sun, 25 Sep 2011 11:48:38 +0300
Subject: [PATCH] Admin user is always authorized when no context is given.

In a situation where @project might or might not be set by filters
before the call to `authorize' you would need to check for that and
either call authorize or authorize_global.  With this change, a plain
`before_filter :authorize' may be used instead.
---
 app/models/user.rb |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/app/models/user.rb b/app/models/user.rb
index c06a907..f4b603c 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -432,7 +432,8 @@ class User < Principal
         (block_given? ? yield(role, self) : true)
       }
     else
-      false
+      # Admin users are always authorized when no context is given
+      return true if admin?
     end
   end
 
-- 
1.7.4.1

