public
Description: The kick ass (non-commercial) home for musicians and their music
Homepage: http://alonetone.com
Clone URL: git://github.com/sudara/alonetone.git
better name & fix error
tiendung (author)
Wed Oct 08 18:26:22 -0700 2008
commit  6c1f76552a062a2398f43200892565b440403047
tree    258afab039c5e756d3f3616eb75a5d1ddc4eb53c
parent  99880e8c556eab6c1e2d8e5009df43d890fc766b
...
82
83
84
85
 
86
87
88
89
90
 
 
91
92
93
...
82
83
84
 
85
86
87
88
 
 
89
90
91
92
93
0
@@ -82,12 +82,12 @@ class ApplicationController < ActionController::Base
0
     @user = User.find_by_login(login) || current_user
0
   end
0
 
0
- def admin_or_user?(user)
0
+ def current_use_is_admin_or_user?(user)
0
     logged_in? && (current_user.id.to_s == user.id.to_s || current_user.admin?)
0
   end
0
 
0
- def admin_or_moderator_or_user?(user)
0
- admin_or_user? || moderator?
0
+ def current_use_is_admin_or_moderator_or_user?(user)
0
+ current_use_is_admin_or_user? || moderator?
0
   end
0
 
0
   def find_asset
...
157
158
159
 
160
161
 
162
163
164
165
 
 
166
167
168
...
172
173
174
 
175
176
177
...
183
184
185
186
 
187
188
189
...
240
241
242
243
 
244
245
246
...
157
158
159
160
161
162
163
164
165
166
 
167
168
169
170
171
...
175
176
177
178
179
180
181
...
187
188
189
 
190
191
192
193
...
244
245
246
 
247
248
249
250
0
@@ -157,12 +157,15 @@ class AssetsController < ApplicationController
0
         end
0
       end
0
     end
0
+
0
     flashes = ''
0
     good = false
0
+
0
     @assets.each do |asset|
0
       # TODO: find a non-hackish way to ensure content_types are only mp3s at this point
0
       # The problem is a zip can contain a zip, which passes validation
0
- # Furthermore, if there is an issue with the zip, the rescue in the Asset model will hand the file back
0
+ # Furthermore, if there is an issue with the zip,
0
+ # the rescue in the Asset model will hand the file back
0
       # Butt ugly, my friends.
0
       if !asset.new_record?
0
         flashes += "#{CGI.escapeHTML asset.filename} uploaded!<br/>"
0
@@ -172,6 +175,7 @@ class AssetsController < ApplicationController
0
         flashes += "'#{CGI.escapeHTML asset.filename}' failed to upload: <br/>#{errors}<br/>"
0
       end
0
     end
0
+
0
     if good
0
       flash[:ok] = flashes + "<br/>Now, check the title and add description for your track(s)"
0
       redirect_to mass_edit_user_tracks_path(current_user, :assets => (@assets.collect(&:id)))
0
@@ -183,7 +187,7 @@ class AssetsController < ApplicationController
0
         flashes
0
       end
0
       redirect_to new_user_track_path(current_user)
0
- end
0
+ end # if good
0
   end
0
 
0
   # PUT /assets/1
0
@@ -240,7 +244,7 @@ class AssetsController < ApplicationController
0
   
0
   def authorized?
0
     # admin or the owner of the asset can edit/update/delete
0
- params[:permalink].nil? || admin_or_user?(@asset.user)
0
+ params[:permalink].nil? || current_use_is_admin_or_user?(@asset.user)
0
   end
0
   
0
   def register_listen
...
12
13
14
15
 
16
17
18
...
36
37
38
39
 
40
41
42
...
193
194
195
196
 
197
198
199
...
12
13
14
 
15
16
17
18
...
36
37
38
 
39
40
41
42
...
193
194
195
 
196
197
198
199
0
@@ -12,7 +12,7 @@ class PlaylistsController < ApplicationController
0
   # GET /playlists
0
   # GET /playlists.xml
0
   def index
0
- @all_playlists = admin_or_user?(@user) ?
0
+ @all_playlists = current_use_is_admin_or_user?(@user) ?
0
                       @user.playlists.include_private :
0
                       @user.playlists.public
0
 
0
@@ -36,7 +36,7 @@ class PlaylistsController < ApplicationController
0
 
0
   def sort
0
     redirect_to user_home_url(@user) \
0
- unless admin_or_user?(@user)
0
+ unless current_use_is_admin_or_user?(@user)
0
 
0
     respond_to do |format|
0
       format.html { @playlists = @user.playlists.include_private.find(:all) }
0
@@ -193,7 +193,7 @@ class PlaylistsController < ApplicationController
0
   end
0
     
0
   def authorized?
0
- admin_or_user?(@playlist.user) ||
0
+ current_use_is_admin_or_user?(@playlist.user) ||
0
     not %w[ destroy admin edit update remove_track attach_pic sort_tracks
0
             add_track set_playlist_description set_playlist_title ].include?(action_name)
0
   end
...
82
83
84
85
 
86
87
88
...
82
83
84
 
85
86
87
88
0
@@ -82,7 +82,7 @@ class TopicsController < ApplicationController
0
 protected
0
   def authorized?
0
     not %w(destroy edit update).include?(action_name) ||
0
- admin_or_moderator_or_user? @topic.user
0
+ current_use_is_admin_or_moderator_or_user?(@topic.user)
0
   end
0
   
0
   def find_forum

Comments

    No one has commented yet.