mirror of
https://github.com/9001/copyparty.git
synced 2025-09-28 12:42:26 -06:00
warn on invalid idp-volume mapping
This commit is contained in:
parent
c03b332ec0
commit
83bd197438
|
@ -99,6 +99,8 @@ SBADCFG = " ({})".format(BAD_CFG)
|
|||
|
||||
PTN_U_GRP = re.compile(r"\$\{u(%[+-][^}]+)\}")
|
||||
PTN_G_GRP = re.compile(r"\$\{g(%[+-][^}]+)\}")
|
||||
PTN_U_ANY = re.compile(r"(\${[u][}%])")
|
||||
PTN_G_ANY = re.compile(r"(\${[g][}%])")
|
||||
PTN_SIGIL = re.compile(r"(\${[ug][}%])")
|
||||
|
||||
|
||||
|
@ -1131,6 +1133,16 @@ class AuthSrv(object):
|
|||
src0 = src # abspath
|
||||
dst0 = dst # vpath
|
||||
|
||||
zsl = []
|
||||
for ptn, sigil in ((PTN_U_ANY, "${u}"), (PTN_G_ANY, "${g}")):
|
||||
if bool(ptn.search(src)) != bool(ptn.search(dst)):
|
||||
zsl.append(sigil)
|
||||
if zsl:
|
||||
t = "ERROR: if %s is mentioned in a volume definition, it must be included in both the filesystem-path [%s] and the volume-url [/%s]"
|
||||
t = "\n".join([t % (x, src, dst) for x in zsl])
|
||||
self.log(t, 1)
|
||||
raise Exception(t)
|
||||
|
||||
un_gn = [(un, gn) for un, gns in un_gns.items() for gn in gns]
|
||||
if not un_gn:
|
||||
# ensure volume creation if there's no users
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
idp-h-grp: x-idp-group
|
||||
|
||||
[/vu/${u}]
|
||||
/
|
||||
/u${u}
|
||||
accs:
|
||||
r: ${u}
|
||||
|
||||
[/vg/${g}]
|
||||
/b
|
||||
/g${g}
|
||||
accs:
|
||||
r: @${g}
|
||||
|
|
|
@ -121,6 +121,8 @@ class TestVFS(unittest.TestCase):
|
|||
self.assertNodes(au.vfs.nodes["vg"], ["iga"])
|
||||
self.assertApEq(au.vfs.nodes["vu"].realpath, "")
|
||||
self.assertApEq(au.vfs.nodes["vg"].realpath, "")
|
||||
self.assertApEq(au.vfs.nodes["vu"].nodes["iua"].realpath, "/uiua")
|
||||
self.assertApEq(au.vfs.nodes["vg"].nodes["iga"].realpath, "/giga")
|
||||
self.assertAxs(au.vfs.axs, [])
|
||||
self.assertAxsAt(au, "vu/iua", [["iua"]]) # same as:
|
||||
self.assertAxs(self.nav(au, "vu/iua").axs, [["iua"]])
|
||||
|
|
Loading…
Reference in a new issue