Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(groups): dsp-tools should not allow group creation if group name already in use (DEV-798) #183

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions knora/dsplib/utils/onto_create_ontology.py
Expand Up @@ -123,13 +123,13 @@ def create_groups(con: Connection, groups: list[dict[str, str]], project: Projec

# check if the group already exists, skip if so
all_groups: Optional[list[Group]] = Group.getAllGroups(con)

group_exists: bool = False
if all_groups:
for group_item in all_groups:
if group_item.project == project.id and group_item.name == group_name:
group_exists = True
group_exists = any(group_item.name == group_name for group_item in all_groups)

if group_exists:
print(f"WARN Group '{group_name}' already exists. Skipping...")
print(f"WARN Group name '{group_name}' already in use. Skipping...")
continue

# check if status is defined, set default value if not
Expand Down