config-files can extend groups

This commit is contained in:
ed
2026-01-02 01:39:51 +00:00
parent f81d80bcad
commit 5b89a2e3b2
4 changed files with 39 additions and 2 deletions

View File

@@ -1467,7 +1467,10 @@ class AuthSrv(object):
t = "group [%s] = " % (gn,)
t += ", ".join("user [%s]" % (x,) for x in uns)
self._l(ln, 5, t)
grps[gn] = uns
if gn in grps:
grps[gn].extend(uns)
else:
grps[gn] = uns
except:
t = 'lines inside the [groups] section must be "groupname: user1, user2, user..."'
raise Exception(t + SBADCFG)

View File

@@ -0,0 +1,8 @@
[accounts]
david: letmein
[groups]
friends: david
# the "friends" group was already created in ../some.conf,
# so we are just adding david into it

View File

@@ -0,0 +1,8 @@
[accounts]
james: metooplease
[groups]
friends: james
# the "friends" group was already created in ../some.conf,
# so we are just adding james into it

View File

@@ -6,7 +6,7 @@
# first declare the accounts just once:
[accounts]
usr1: passw0rd
usr2: letmein
usr2: touhou
[global]
i: 127.0.0.1 # listen on 127.0.0.1 only,
@@ -31,3 +31,21 @@
#
# because another.conf sets the read/write permissions before it
# includes sibling.conf which adds the move permission
# ----------------------------------------------------------------------
# we can also create a group here;
[groups]
friends: usr1, usr2
# and a volume which the group "friends" can read/write;
[/friends]
/srv/pub/friends
accs:
rw: @friends
# then we include all the config-files in the folder "more-users",
# which can define more users, and maybe even add them to the "friends" group
# (spoiler: the users "usr1", "usr2", "david", and "james" will have access)
% more-users/