Only owner can remove project
This commit is contained in:
parent
6ea6ab7c8d
commit
cc0295b789
6 changed files with 13 additions and 5 deletions
|
@ -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
|
||||
|
|
|
@ -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…
Add table
Add a link
Reference in a new issue