Skip to content
Snippets Groups Projects
Commit cc0295b7 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Only owner can remove project

parent 6ea6ab7c
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -112,6 +112,10 @@ class ApplicationController < ActionController::Base
render file: Rails.root.join("public", "404"), layout: false, status: "404"
end
 
def render_403
render file: Rails.root.join("public", "403"), layout: false, status: "403"
end
def require_non_empty_project
redirect_to @project if @project.empty_repo?
end
Loading
Loading
Loading
Loading
@@ -89,6 +89,8 @@ class ProjectsController < ProjectResourceController
end
 
def destroy
return access_denied! unless can?(current_user, :remove_project, project)
# Disable the UsersProject update_repository call, otherwise it will be
# called once for every person removed from the project
UsersProject.skip_callback(:destroy, :after, :update_repository)
Loading
Loading
Loading
Loading
@@ -66,3 +66,4 @@
%legend Owner
%ul
%li Transfer project to another namespace
%li Remove project
Loading
Loading
@@ -26,7 +26,7 @@
&nbsp;
%span.cred Be careful. Changing project namespace can have unintended side effects
- else
%a.btn.btn-small.disabled= @project.namespace.try(:human_name) || "/"
%a.btn.disabled= @project.namespace.try(:human_name) || "/"
&nbsp;
%span.cred Only owner can change project namespace.
 
Loading
Loading
@@ -69,5 +69,6 @@
= f.submit 'Save', class: "btn save-btn"
= link_to 'Cancel', @project, class: "btn"
- unless @project.new_record?
.right
= link_to 'Remove', @project, confirm: 'Are you sure?', method: :delete, class: "btn danger"
- if can?(current_user, :remove_project, @project)
.right
= link_to 'Remove', @project, confirm: 'Removed project can not be restored! Are you sure?', method: :delete, class: "btn danger"
Loading
Loading
@@ -5,7 +5,7 @@
- if @service.active
%small.cgreen Enabled
- else
%small.btn Disabled
%small.cgray Disabled
 
 
 
Loading
Loading
Loading
Loading
@@ -12,7 +12,7 @@
- if @gitlab_ci_service.active
%small.cgreen Enabled
- else
%small.btn Disabled
%small.cgray Disabled
%li.wll
%h4
Jenkins CI
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment