fix(admin): fix import user with csv with no group assigned

darta 2022-02-06 19:29:24 +01:00
parent 304d8e8724
commit cc8bdc8554
1 changed files with 12 additions and 11 deletions

View File

@ -584,8 +584,8 @@ class Admin:
+ ") uploaded user: "
+ u["username"]
)
user_groups = [g.strip() for g in u["groups"].split(",")]
user_groups = [g.strip() for g in u["groups"].split(",") if g !=""]
if not len(user_groups): user_groups = ["/"+u["role"].strip()]
pathslist = []
for group in user_groups:
pathpart = ""
@ -637,15 +637,16 @@ class Admin:
groups = list(dict.fromkeys(groups))
sysgroups = []
for g in groups:
sysgroups.append(
{
"provider": "external",
"id": g,
"name": kpath2gid(g),
"path": g,
"description": "Imported with csv",
}
)
if g != "":
sysgroups.append(
{
"provider": "external",
"id": g,
"name": kpath2gid(g),
"path": g,
"description": "Imported with csv",
}
)
self.external["groups"] = sysgroups
return True