diff options
author | Małgorzata Ksionek <meksionek@gmail.com> | 2019-03-20 14:39:07 +0100 |
---|---|---|
committer | Małgorzata Ksionek <meksionek@gmail.com> | 2019-03-20 14:52:18 +0100 |
commit | 0b324d3463d5fdd887b46d9ad043d2d45e70360b (patch) | |
tree | 372b312f3c067779abee4497874704e6d2e44e9b /app | |
parent | 37bd7aa6beffd1567dadcb4fff8167d050deabd8 (diff) | |
download | gitlab-ce-0b324d3463d5fdd887b46d9ad043d2d45e70360b.tar.gz |
Disallow changing namespace of a project in update method
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects_controller.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 33c6608d321..b419d669544 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -47,7 +47,7 @@ class ProjectsController < Projects::ApplicationController end def create - @project = ::Projects::CreateService.new(current_user, project_params).execute + @project = ::Projects::CreateService.new(current_user, project_params(attributes: project_params_create_attributes)).execute if @project.saved? cookies[:issue_board_welcome_hidden] = { path: project_path(@project), value: nil, expires: Time.at(0) } @@ -328,9 +328,9 @@ class ProjectsController < Projects::ApplicationController end # rubocop: enable CodeReuse/ActiveRecord - def project_params + def project_params(attributes: project_params_attributes) params.require(:project) - .permit(project_params_attributes) + .permit(attributes) end def project_params_attributes @@ -349,11 +349,10 @@ class ProjectsController < Projects::ApplicationController :last_activity_at, :lfs_enabled, :name, - :namespace_id, :only_allow_merge_if_all_discussions_are_resolved, :only_allow_merge_if_pipeline_succeeds, - :printing_merge_request_link_enabled, :path, + :printing_merge_request_link_enabled, :public_builds, :request_access_enabled, :runners_token, @@ -375,6 +374,10 @@ class ProjectsController < Projects::ApplicationController ] end + def project_params_create_attributes + project_params_attributes << :namespace_id + end + def custom_import_params {} end |