public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/technoweenie/mephisto.git
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
add tests for site members and assets

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@2348 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Mon Oct 09 19:57:23 -0700 2006
commit  7a2a8c8e94ae3c268972fbbf225977d0b1491d52
tree    b4ae87220dde8345109e194d8c50b63720105b96
parent  f1b4228bc564e9bff4d87876dce8ae05a5ffb82c
...
1
2
 
3
 
4
5
6
...
134
135
136
 
 
 
 
137
...
1
2
3
4
5
6
7
8
...
136
137
138
139
140
141
142
143
0
@@ -1,6 +1,8 @@
0
 class Admin::AssetsController < Admin::BaseController
0
   member_actions.push(*%w(index new create latest search add_bucket clear_bucket))
0
+ skip_before_filter :login_required
0
   before_filter :find_asset, :except => [:index, :new, :create, :latest, :search, :upload, :clear_bucket]
0
+ before_filter :login_required
0
 
0
   def index
0
     search_assets 24
0
@@ -134,4 +136,8 @@ class Admin::AssetsController < Admin::BaseController
0
         :conditions => "site_id = #{site.id} #{type_conditions && "and #{type_conditions}"} AND #{search_conditions[:conditions]}",
0
         :include => search_conditions[:include])
0
     end
0
+
0
+ def allow_member?
0
+ @asset && @asset.user_id.to_s == current_user.id.to_s
0
+ end
0
 end
...
7
8
9
 
10
11
 
 
 
 
 
 
12
13
14
...
7
8
9
10
11
 
12
13
14
15
16
17
18
19
20
0
@@ -7,8 +7,14 @@ class Admin::BaseController < ApplicationController
0
   before_filter :login_required, :except => :feed
0
 
0
   protected
0
+ # standard authorization method. allow logged in users that are admins, or members in certain actions
0
     def authorized?
0
- logged_in? && (admin? || member_actions.include?(action_name))
0
+ logged_in? && (admin? || member_actions.include?(action_name) || allow_member?)
0
+ end
0
+
0
+ # further customize the authorization process, for those special methods that require extra validation
0
+ def allow_member?
0
+ true
0
     end
0
 
0
     def find_and_sort_templates
...
17
18
19
 
20
21
22
...
17
18
19
20
21
22
23
0
@@ -17,6 +17,7 @@ gif:
0
   created_at: <%= 11.minutes.ago.to_s :db %>
0
   title: gif
0
   thumbnails_count: 1
0
+ user_id: 4
0
 png:
0
   id: 2
0
   content_type: image/png

Comments

    No one has commented yet.