Project

General

Profile

Feature #1007 » projects_controller.rb.patch

Gives authenticated users permission to create projects and assigns them as managers - Steve Cundy, 2009-05-15 05:56

View differences:

projects_controller.rb 2009-05-14 14:49:38.000000000 -0700
26 26
  before_filter :find_project, :except => [ :index, :list, :add, :activity ]
27 27
  before_filter :find_optional_project, :only => :activity
28 28
  before_filter :authorize, :except => [ :index, :list, :add, :archive, :unarchive, :destroy, :activity ]
29
  before_filter :require_admin, :only => [ :add, :archive, :unarchive, :destroy ]
29
  before_filter :require_login, :only => :add 
30
  before_filter :require_admin, :only => [ :archive, :unarchive, :destroy ]
30 31
  accept_key_auth :activity
31 32
  
32 33
  helper :sort
......
75 76
      @project.enabled_module_names = params[:enabled_modules]
76 77
      if @project.save
77 78
        flash[:notice] = l(:notice_successful_create)
78
        redirect_to :controller => 'admin', :action => 'projects'
79
	  end		
79
	if User.current.admin
80
          redirect_to :controller => 'admin', :action => 'projects'
81
        else
82
	  @project.members << Member.new(:project_id => @project, :user_id => User.current.id, :role_id => '3')
83
          redirect_to :controller => 'projects', :action => 'index'
84
	end		
85
      end
80 86
    end	
81 87
  end
82 88
	
(2-2/2)