class UpdateContext < BaseContext
def execute(role = :default)
params[:project].delete(:namespace_id)
- params[:project].delete(:public) unless can?(current_user, :change_public_mode, project)
+ # check that user is allowed to set specified visibility_level
+ unless can?(current_user, :change_visibility_level, project) && Gitlab::VisibilityLevel.allowed_for?(current_user, params[:project][:visibility_level])
+ params[:project].delete(:visibility_level)
+ end
+
new_branch = params[:project].delete(:default_branch)
- if project.repository.exists? && new_branch != project.repository.root_ref
+ if project.repository.exists? && new_branch != project.default_branch
GitlabShellWorker.perform_async(
:update_repository_head,
project.path_with_namespace,
class Project < ActiveRecord::Base
include Gitlab::ShellAdapter
+ include Gitlab::VisibilityLevel
extend Enumerize
-
+
ActsAsTaggableOn.strict_case_match = true
attr_accessible :name, :path, :description, :issues_tracker, :label_list,
where(path: id, namespace_id: nil).last
end
end
-
++
+ def visibility_levels
+ Gitlab::VisibilityLevel.options
+ end
end
def team
def default_branch
@default_branch ||= repository.root_ref if repository.exists?
end
-
+
+ def reload_default_branch
+ @default_branch = nil
+ default_branch
+ end
++
+ def visibility_level_field
+ visibility_level
+ end
end