Only owner can remove project

This commit is contained in:
Dmitriy Zaporozhets 2012-12-05 06:14:05 +03:00
parent 6ea6ab7c8d
commit cc0295b789
6 changed files with 13 additions and 5 deletions

View file

@ -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

View file

@ -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)