Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixes error

undefined method `admin?` for :false:Symbol
quote> [RAILS_ROOT]/vendor/plugins/webistrano_privileges/lib/webistrano_privileges.rb:9:in `setup_privileges`

when anonymous user tries to open restricted link
  • Loading branch information...
commit 2c5ba4737348155744c8a2ab9900a4a6549b184a 1 parent 8717cab
Alexander Kuznecov authored
Showing with 12 additions and 8 deletions.
  1. +12 −8 lib/webistrano_privileges.rb
View
20 lib/webistrano_privileges.rb
@@ -5,19 +5,23 @@ def setup_privileges
#check if in a resource nested in a project
unless params[:project_id].nil?
- unless current_user.admin? or current_user.project_ids.include?(params[:project_id].to_i)
- flash[:notice] = "Action not allowed"
- redirect_to home_path
- return false
+ if logged_in?
+ unless current_user.admin? or current_user.project_ids.include?(params[:project_id].to_i)
+ flash[:notice] = "Action not allowed"
+ redirect_to home_path
+ return false
+ end
end
end
#check if in projects controller
if controller_name == "projects" and action_name != "index" and action_name != "dashboard"
- unless current_user.admin? or current_user.project_ids.include?(params[:id].to_i)
- flash[:notice] = "Action not allowed"
- redirect_to home_path
- return false
+ if logged_in?
+ unless current_user.admin? or current_user.project_ids.include?(params[:id].to_i)
+ flash[:notice] = "Action not allowed"
+ redirect_to home_path
+ return false
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.