summaryrefslogtreecommitdiffstats
path: root/app/controllers/projects_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-11-20 15:40:16 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-11-20 15:40:16 +0000
commit987a5aa22114ec2e931464782351431e4dfec97c (patch)
tree57af15078250c620d494306c251ad66af779bc0b /app/controllers/projects_controller.rb
parent99f9aea80a2bc43cdfc2933728f0ab72d7bf99d5 (diff)
downloadredmine-987a5aa22114ec2e931464782351431e4dfec97c.tar.gz
redmine-987a5aa22114ec2e931464782351431e4dfec97c.zip
Anonymous users can now be allowed to create, edit, comment issues, comment news and post messages in the forums.
These permissions need to be explicitly given to the Anonymous role (Admin -> Roles & Permissions -> Anonymous). git-svn-id: http://redmine.rubyforge.org/svn/trunk@919 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/projects_controller.rb')
-rw-r--r--app/controllers/projects_controller.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 289b34e24..0f50cd780 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -48,7 +48,7 @@ class ProjectsController < ApplicationController
# Lists visible projects
def list
projects = Project.find :all,
- :conditions => Project.visible_by(logged_in_user),
+ :conditions => Project.visible_by(User.current),
:include => :parent
@project_tree = projects.group_by {|p| p.parent || p}
@project_tree.each_key {|p| @project_tree[p] -= [p]}
@@ -176,7 +176,7 @@ class ProjectsController < ApplicationController
if request.post? and @document.save
# Save the attachments
params[:attachments].each { |a|
- Attachment.create(:container => @document, :file => a, :author => logged_in_user) unless a.size == 0
+ Attachment.create(:container => @document, :file => a, :author => User.current) unless a.size == 0
} if params[:attachments] and params[:attachments].is_a? Array
flash[:notice] = l(:notice_successful_create)
Mailer.deliver_document_added(@document) if Setting.notified_events.include?('document_added')
@@ -216,7 +216,7 @@ class ProjectsController < ApplicationController
return
end
@issue.status = default_status
- @allowed_statuses = ([default_status] + default_status.find_new_statuses_allowed_to(logged_in_user.role_for_project(@project), @issue.tracker))if logged_in_user
+ @allowed_statuses = ([default_status] + default_status.find_new_statuses_allowed_to(User.current.role_for_project(@project), @issue.tracker))
if request.get?
@issue.start_date ||= Date.today
@@ -321,10 +321,9 @@ class ProjectsController < ApplicationController
# Add a news to @project
def add_news
- @news = News.new(:project => @project)
+ @news = News.new(:project => @project, :author => User.current)
if request.post?
@news.attributes = params[:news]
- @news.author_id = self.logged_in_user.id if self.logged_in_user
if @news.save
flash[:notice] = l(:notice_successful_create)
Mailer.deliver_news_added(@news) if Setting.notified_events.include?('news_added')
@@ -340,7 +339,7 @@ class ProjectsController < ApplicationController
@attachments = []
params[:attachments].each { |file|
next unless file.size > 0
- a = Attachment.create(:container => @version, :file => file, :author => logged_in_user)
+ a = Attachment.create(:container => @version, :file => file, :author => User.current)
@attachments << a unless a.new_record?
} if params[:attachments] and params[:attachments].is_a? Array
Mailer.deliver_attachments_added(@attachments) if !@attachments.empty? && Setting.notified_events.include?('file_added')