mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
gitweb: Don't use privileged action feature to run as different user
- Instead implement running specific commands inside the privileged action as a specific user. Tests: - Gitweb functional tests and unit tests work. - Running various operations such as clone, create, set branch, rename, etc. all result in repositories (and all their contents) owned by www-data:www-data. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Joseph Nuthalapati <njoseph@riseup.net>
This commit is contained in:
1 parent
7a4fb9d9f6
commit
87331e7c97
5 files changed
+31
-18
No files matched your search
@@ -16,16 +16,16 @@ REPO_DATA = {
|
||||
'access': 'private',
|
||||
}
|
||||
|
||||
pytestmark = pytest.mark.usefixtures('mock_privileged')
|
||||
pytestmark = pytest.mark.usefixtures('mock_privileged', 'mock_run_as_user')
|
||||
privileged_modules_to_mock = ['plinth.modules.gitweb.privileged']
|
||||
git_installed = pytest.mark.skipif(not pathlib.Path('/usr/bin/git').exists(),
|
||||
reason='git is not installed')
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def fixture_set_repo_path(tmpdir):
|
||||
def fixture_set_repo_path(tmp_path):
|
||||
"""Set a repository path in the actions module."""
|
||||
privileged.GIT_REPO_PATH = tmpdir
|
||||
privileged.GIT_REPO_PATH = tmp_path
|
||||
|
||||
|
||||
@pytest.fixture(name='existing_repo')
|
||||
|
||||
Reference in new issue
Block a user