Skip to content

Commit 215762f

Browse files
commands: after ensuring share dirs, handle permissions
In the setup function and the config update function we had been ensuring the path for the share exists. Now, we add the ability to check/set that the share dirs also have appropriate permissions. Signed-off-by: John Mulligan <[email protected]>
1 parent 9a14037 commit 215762f

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

sambacc/commands/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
best_leader_locator,
3535
best_waiter,
3636
commands,
37+
perms_handler,
3738
setup_steps,
3839
)
3940

@@ -95,6 +96,8 @@ def _update_config(
9596
continue
9697
_logger.info(f"Ensuring share path: {path}")
9798
paths.ensure_share_dirs(path)
99+
_logger.info(f"Updating permissions if needed: {path}")
100+
perms_handler(share.permissions_config(), path).update()
98101
# update smb config
99102
if changed:
100103
_logger.info("Updating samba configuration")

sambacc/commands/initialize.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
from . import config # noqa: F401
2626
from . import users # noqa: F401
27-
from .cli import commands, setup_steps, Context
27+
from .cli import commands, perms_handler, setup_steps, Context
2828

2929

3030
_logger = logging.getLogger(__name__)
@@ -86,7 +86,8 @@ def ensure_share_paths(ctx: Context) -> None:
8686
continue
8787
_logger.info(f"Ensuring share path: {path}")
8888
paths.ensure_share_dirs(path)
89-
# TODO: set proper perms/acls for a "share root"
89+
_logger.info(f"Updating permissions if needed: {path}")
90+
perms_handler(share.permissions_config(), path).update()
9091

9192

9293
_default_setup_steps = [

0 commit comments

Comments
 (0)