render_404
end
+ # Find a project based on params[:project_id]
+ # TODO: some subclasses override this, see about merging their logic
+ def find_optional_project
+ @project = Project.find(params[:project_id]) unless params[:project_id].blank?
+ allowed = User.current.allowed_to?({:controller => params[:controller], :action => params[:action]}, @project, :global => true)
+ allowed ? true : deny_access
+ rescue ActiveRecord::RecordNotFound
+ render_404
+ end
+
# Finds and sets @project based on @object.project
def find_project_from_association
render_404 unless @object.present?
end
end
- private
-
- # TODO: Refactor, duplicates IssuesController
- def find_optional_project
- @project = Project.find(params[:project_id]) unless params[:project_id].blank?
- allowed = User.current.allowed_to?({:controller => params[:controller], :action => params[:action]}, @project, :global => true)
- allowed ? true : deny_access
- rescue ActiveRecord::RecordNotFound
- render_404
- end
-
end
render_404
end
- def find_optional_project
- @project = Project.find(params[:project_id]) unless params[:project_id].blank?
- allowed = User.current.allowed_to?({:controller => params[:controller], :action => params[:action]}, @project, :global => true)
- allowed ? true : deny_access
- rescue ActiveRecord::RecordNotFound
- render_404
- end
-
# Used by #edit and #update to set some common instance variables
# from the params
# TODO: Refactor, not everything in here is needed by #edit