Commit 64aa9e21 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Rename user_can_admin? because it's more accurate

Also fix the test because we no longer have :empty_project,
just use :project is the same as before
parent fa5575cf
...@@ -104,7 +104,7 @@ module Auth ...@@ -104,7 +104,7 @@ module Auth
when 'push' when 'push'
build_can_push?(requested_project) || user_can_push?(requested_project) build_can_push?(requested_project) || user_can_push?(requested_project)
when '*' when '*'
user_can_delete?(requested_project) user_can_admin?(requested_project)
else else
false false
end end
...@@ -122,7 +122,7 @@ module Auth ...@@ -122,7 +122,7 @@ module Auth
(requested_project == project || can?(current_user, :build_read_container_image, requested_project)) (requested_project == project || can?(current_user, :build_read_container_image, requested_project))
end end
def user_can_delete?(requested_project) def user_can_admin?(requested_project)
has_authentication_ability?(:admin_container_image) && has_authentication_ability?(:admin_container_image) &&
can?(current_user, :admin_container_image, requested_project) can?(current_user, :admin_container_image, requested_project)
end end
......
...@@ -315,7 +315,7 @@ describe Auth::ContainerRegistryAuthenticationService do ...@@ -315,7 +315,7 @@ describe Auth::ContainerRegistryAuthenticationService do
end end
context 'delete authorized as master' do context 'delete authorized as master' do
let(:current_project) { create(:empty_project) } let(:current_project) { create(:project) }
let(:current_user) { create(:user) } let(:current_user) { create(:user) }
let(:authentication_abilities) do let(:authentication_abilities) do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment