Skip to content

Commit

Permalink
Add option to set group write permissions after stage
Browse files Browse the repository at this point in the history
  • Loading branch information
JBorrow committed Feb 8, 2024
1 parent 5a94937 commit 89d710d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions librarian_server/stores/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ class LocalStore(CoreStore):
staging_path: Path
store_path: Path

group_write_after_stage: bool = False
"If true, the user running the server will chmod the stage directories to 775 after creating."
own_after_commit: bool = False
"If true, the user running the server will chown the files after committing."
readonly_after_commit: bool = False
"If true, the user running the server will chmod the files to 444 after commit."
"If true, the user running the server will chmod the files to 444 and folders to 555 after commit."

@property
def available(self) -> bool:
Expand Down Expand Up @@ -77,7 +79,10 @@ def stage(self, file_size: int, file_name: Path) -> tuple[Path]:

# Create the empty directory.
resolved_path = self._resolved_path_staging(stage_path)
resolved_path.mkdir()
if self.group_write_after_stage:
resolved_path.mkdir(mode=0o775)
else:
resolved_path.mkdir()

return stage_path, resolved_path / file_name

Expand Down

0 comments on commit 89d710d

Please sign in to comment.