Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pori_python/ipr/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ def upload_report(

projects = self.get("project")
project_names = [item["name"] for item in projects]
project_users = {
item["name"]: [user["username"] for user in item.get("users", [])]
Comment thread
sshugsc marked this conversation as resolved.
Outdated
for item in projects
}

# if project is not exist, create one
if content["project"] not in project_names:
Expand All @@ -118,6 +122,11 @@ def upload_report(
except Exception as err:
raise Exception(f"Project creation failed due to {err}")

if self.username not in project_users[content["project"]]:
raise Exception(
Comment thread
sshugsc marked this conversation as resolved.
Outdated
f"User have no permission to create report in project {content['project']}"
)

if ignore_extra_fields:
initial_result = self.post("reports-async?ignore_extra_fields=true", content)
else:
Expand Down