<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -70,7 +70,7 @@ class ApplicationController &lt; ActionController::Base
       next unless (l[0] == :all) || 
         (l[0] == :non_user &amp;&amp; !@u) ||
         (l[0] == :user &amp;&amp; @u) ||
-        (l[0] == :owner &amp;&amp; @p &amp;&amp; @p.id==(params[:profile_id] || params[:id]).to_i)
+        (l[0] == :owner &amp;&amp; @p &amp;&amp; @profile &amp;&amp; @p == @profile)
       args = l[1]
       @level = [] and return true if args[:all] == true
       </diff>
      <filename>app/controllers/application.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,6 @@
 class BlogsController &lt; ApplicationController
   skip_filter :login_required, :only =&gt; [:index, :show]
+  prepend_before_filter :get_profile
   before_filter :setup
   
   
@@ -70,8 +71,11 @@ class BlogsController &lt; ApplicationController
 
   protected
   
-  def setup
+  def get_profile
     @profile = Profile[params[:profile_id]]
+  end
+  
+  def setup
     @user = @profile.user
     @blogs = @profile.blogs.paginate(:page =&gt; @page, :per_page =&gt; @per_page)
     </diff>
      <filename>app/controllers/blogs_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,6 @@
 class PhotosController &lt; ApplicationController
   skip_filter :login_required
+  prepend_before_filter :get_profile
   before_filter :setup
   
   
@@ -54,9 +55,11 @@ class PhotosController &lt; ApplicationController
     super :all, :only =&gt; [:index, :show]
   end
   
+  def get_profile
+    @profile = Profile[params[:profile_id] || params[:id]]
+  end
   
   def setup
-    @profile = Profile[params[:profile_id] || params[:id]]
     @user = @profile.user
     @photos = @profile.photos.paginate(:all, :page =&gt; @page, :per_page =&gt; @per_page)
     @photo = Photo.new</diff>
      <filename>app/controllers/photos_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 class ProfilesController &lt; ApplicationController
   include ApplicationHelper
-    
+  prepend_before_filter :get_profile, :except =&gt; [:new, :create, :index, :search]  
   before_filter :setup, :except =&gt; [:index, :search]
   before_filter :search_results, :only =&gt; [:index, :search]
   skip_filter :login_required, :only=&gt;[:show, :index, :feed, :search]
@@ -106,8 +106,11 @@ class ProfilesController &lt; ApplicationController
     super :all, :only =&gt; [:show, :index, :search]
   end
   
-  def setup
+  def get_profile
     @profile = Profile[params[:id]]
+  end
+  
+  def setup
     @user = @profile.user
   end
   </diff>
      <filename>app/controllers/profiles_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -54,7 +54,6 @@ class ProfilesControllerTest &lt; ActionController::TestCase
     end
 
     should_not_assign_to :user
-    should_not_assign_to :profile
     should_respond_with :redirect
     should_redirect_to 'login_path'
     should_not_set_the_flash</diff>
      <filename>test/functional/profiles_controller_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>9ca0a5271fd97e9128fcaa6a10fdd514b1fa1674</id>
    </parent>
  </parents>
  <author>
    <name>Matthew Peychich</name>
    <email>mpeychich@mac.com</email>
  </author>
  <url>http://github.com/stevenbristol/lovd-by-less/commit/e279286807cb7b8691ca25bac323e5572e315e17</url>
  <id>e279286807cb7b8691ca25bac323e5572e315e17</id>
  <committed-date>2008-05-01T11:52:59-07:00</committed-date>
  <authored-date>2008-05-01T11:52:59-07:00</authored-date>
  <message>Improve the :owner permissions for allow_to</message>
  <tree>6355e04fe288ece9a6694c0e4516e3369b835b20</tree>
  <committer>
    <name>Matthew Peychich</name>
    <email>mpeychich@mac.com</email>
  </committer>
</commit>
