fix: simplify call for adoption workflow#9964
fix: simplify call for adoption workflow#9964rjsparks merged 3 commits intoietf-tools:feat/issuewglcfrom
Conversation
jennifer-richards
left a comment
There was a problem hiding this comment.
oops - I think I have a question about authorization. See inline
| doc.type_id != "draft", | ||
| group is None, | ||
| not is_doc_ietf_adoptable(doc), | ||
| doc.group.acronym == "none" and acronym is None, | ||
| doc.group.acronym == "none" and not can_adopt_draft(request.user, doc), | ||
| doc.group.acronym != "none" | ||
| and not is_authorized_in_doc_stream(request.user, doc), |
There was a problem hiding this comment.
The doc may not be in the "ietf" stream at this point - is there a check that the user is authorized to issue the adoption in that stream? It looks to me like it checks its current stream, but that might be a different stream. Am I missing something?
There was a problem hiding this comment.
If the document is not in any stream, it will be attached to the group with acronym 'none' and can_adopt_draft does the checking you are looking for.
If the document is in some stream that is not the ietf stream, the group will not be of type wg and the query at L2080 will return None, so L2084 will reject access.
If the document is in the ietf stream, the awkwardly named is_authorized_in_doc_stream will perform the check you are looking for.
There was a problem hiding this comment.
I restructured the condition to hopefully make this easier to follow.
The differences between can_adopt_draft and is_authorized_in_draft_stream could probably use further refactoring, but I don't think that's a job for this PR.
jennifer-richards
left a comment
There was a problem hiding this comment.
thx for the explanation, refactor makes the logic a lot clearer
No description provided.