diff options
author | James Edwards-Jones <jedwardsjones@gitlab.com> | 2017-03-17 19:55:15 +0000 |
---|---|---|
committer | James Edwards-Jones <jedwardsjones@gitlab.com> | 2017-03-17 19:55:15 +0000 |
commit | 43a91b0703112baea0fdce5d4e4d11c9de41ed0d (patch) | |
tree | 681625a3d9a4e2f3a506d8ae11b3b4cf902f3f4e | |
parent | a0e8cab31027ed3f8f66413939bbd5f54cce1701 (diff) | |
download | gitlab-ce-18471-restrict-tag-pushes-protected-tags-copy-paste-version.tar.gz |
-rw-r--r-- | app/controllers/projects/settings/repository_controller.rb | 12 | ||||
-rw-r--r-- | app/models/concerns/protected_ref_access.rb | 6 |
2 files changed, 13 insertions, 5 deletions
diff --git a/app/controllers/projects/settings/repository_controller.rb b/app/controllers/projects/settings/repository_controller.rb index b6ce4abca45..8fa65e83711 100644 --- a/app/controllers/projects/settings/repository_controller.rb +++ b/app/controllers/projects/settings/repository_controller.rb @@ -7,14 +7,16 @@ module Projects @deploy_keys = DeployKeysPresenter .new(@project, current_user: current_user) - define_protected_branches + define_protected_refs end private - def define_protected_branches + def define_protected_refs load_protected_branches + # load_protected_tags @protected_branch = @project.protected_branches.new + # @protected_tag = @project.protected_tags.new load_gon_index end @@ -22,7 +24,12 @@ module Projects @protected_branches = @project.protected_branches.order(:name).page(params[:page]) end + # def load_protected_tags + # @protected_tags = @project.protected_tags.order(:name).page(params[:page]) + # end + def access_levels_options + #TODO: consider protected tags { push_access_levels: { roles: ProtectedBranch::PushAccessLevel.human_access_levels.map do |id, text| @@ -43,6 +50,7 @@ module Projects end def load_gon_index + #TODO: consider protected tags gon.push(open_branches.merge(access_levels_options)) end end diff --git a/app/models/concerns/protected_ref_access.rb b/app/models/concerns/protected_ref_access.rb index 9dd4d9c6f24..42fa066b7cf 100644 --- a/app/models/concerns/protected_ref_access.rb +++ b/app/models/concerns/protected_ref_access.rb @@ -1,9 +1,9 @@ -module ProtectedBranchAccess +module ProtectedRefAccess extend ActiveSupport::Concern included do - belongs_to :protected_branch - delegate :project, to: :protected_branch + # belongs_to :protected_branch + # delegate :project, to: :protected_branch scope :master, -> { where(access_level: Gitlab::Access::MASTER) } scope :developer, -> { where(access_level: Gitlab::Access::DEVELOPER) } |