mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
list volumes/permissions on startup
This commit is contained in:
parent
806e7b5530
commit
279c9d706a
|
@ -290,6 +290,7 @@ def run_argparse(argv, formatter):
|
|||
ap2 = ap.add_argument_group('logging options')
|
||||
ap2.add_argument("-q", action="store_true", help="quiet")
|
||||
ap2.add_argument("-lo", metavar="PATH", type=u, help="logfile, example: cpp-%%Y-%%m%%d-%%H%%M%%S.txt.xz")
|
||||
ap2.add_argument("--no-voldump", action="store_true", help="do not list volumes and permissions on startup")
|
||||
ap2.add_argument("--log-conn", action="store_true", help="print tcp-server msgs")
|
||||
ap2.add_argument("--log-htp", action="store_true", help="print http-server threadpool scaling")
|
||||
ap2.add_argument("--ihead", metavar="HEADER", type=u, action='append', help="dump incoming header")
|
||||
|
|
|
@ -440,8 +440,13 @@ class AuthSrv(object):
|
|||
|
||||
if self.args.a:
|
||||
# list of username:password
|
||||
for u, p in [x.split(":", 1) for x in self.args.a]:
|
||||
acct[u] = p
|
||||
for x in self.args.a:
|
||||
try:
|
||||
u, p = x.split(":", 1)
|
||||
acct[u] = p
|
||||
except:
|
||||
m = '\n invalid value "{}" for argument -a, must be username:password'
|
||||
raise Exception(m.format(x))
|
||||
|
||||
if self.args.v:
|
||||
# list of src:dst:permset:permset:...
|
||||
|
@ -689,6 +694,27 @@ class AuthSrv(object):
|
|||
|
||||
vfs.bubble_flags()
|
||||
|
||||
m = "volumes and permissions:\n"
|
||||
for v in vfs.all_vols.values():
|
||||
if not self.warn_anonwrite:
|
||||
break
|
||||
|
||||
m += '\n\033[36m"/{}" \033[33m{}\033[0m'.format(v.vpath, v.realpath)
|
||||
for txt, attr in [
|
||||
[" read", "uread"],
|
||||
[" write", "uwrite"],
|
||||
[" move", "umove"],
|
||||
["delete", "udel"],
|
||||
]:
|
||||
u = list(sorted(getattr(v.axs, attr).keys()))
|
||||
u = ", ".join("\033[35meverybody\033[0m" if x == "*" else x for x in u)
|
||||
u = u if u else "\033[36m--none--\033[0m"
|
||||
m += "\n {}: {}".format(txt, u)
|
||||
m += "\n"
|
||||
|
||||
if self.warn_anonwrite and not self.args.no_voldump:
|
||||
self.log(m)
|
||||
|
||||
try:
|
||||
v, _ = vfs.get("/", "*", False, True)
|
||||
if self.warn_anonwrite and os.getcwd() == v.realpath:
|
||||
|
|
Loading…
Reference in a new issue