Commit 2e47ca65 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'fix-git-annex' into 'master'

Fix broken user_allowed check in Git Annex push

https://gitlab.com/gitlab-org/gitlab-ee/commit/3e4934cea6e2909fe978e5e38a659e4e6f818430 seems to have moved`user_allowed` into the `UserAccess` class, but since no specs tested `git_annex_access_check` a push from Git Annex would fail with an undefined method.

Closes #816

See merge request !597
parents 8a3cc2f2 4e5fd5ad
......@@ -3,8 +3,9 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.11.0 (unreleased)
v 8.10.2 (unreleased)
- Dicouple an ES index update from RepositoryUpdateMirrorWorker
- Fix pagination on search result page when ES search is enabled
- Decouple an ES index update from RepositoryUpdateMirrorWorker
- Fix broken user_allowed check in Git Annex push
- Fix pagination on search result page when ES search is enabled
v 8.10.1
- No EE-specific changes
......
......@@ -253,7 +253,7 @@ module Gitlab
end
def git_annex_access_check(project, changes)
unless user && user_allowed?
unless user && user_access.allowed?
return build_status_object(false, "You don't have access")
end
......@@ -265,7 +265,7 @@ module Gitlab
return build_status_object(false, "You can't use git-annex with a secondary GitLab Geo node.")
end
if user.can?(:push_code, project)
if user.can?(:push_code, project) && git_annex_branch_sync?(changes)
build_status_object(true)
else
build_status_object(false, "You don't have permission")
......
......@@ -363,12 +363,14 @@ describe Gitlab::GitAccess, lib: true do
describe 'git annex enabled' do
before { allow(Gitlab.config.gitlab_shell).to receive(:git_annex_enabled).and_return(true) }
it { expect(access.check('git-annex-shell', git_annex_changes).allowed?).to be_truthy }
it { expect(access.push_access_check(git_annex_changes)).to be_allowed }
end
describe 'git annex disabled' do
before { allow(Gitlab.config.gitlab_shell).to receive(:git_annex_enabled).and_return(false) }
it { expect(access.check('git-annex-shell', git_annex_changes).allowed?).to be_falsey }
it { expect(access.push_access_check(git_annex_changes)).not_to be_allowed }
end
end
......
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