-
Notifications
You must be signed in to change notification settings - Fork 55
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
get project's owners and permissions of various users #101
Conversation
This comment has been minimized.
This comment has been minimized.
Congratulations! The build has finished successfully. 🍾 You can install the built RPMs by following these steps:
Please note that the RPMs should be used only in a testing environment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
Just a few notes.
ogr/services/github.py
Outdated
owners = [] | ||
owner = self.github_repo.owner | ||
owners.append(owner.login) | ||
return owners |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be done in one line, but leave it as is if you think it is more clear now.
return [self.github_repo.owner]
ogr/services/github.py
Outdated
for username, persmission in collaborators.items(): | ||
if persmission == "admin" or persmission == "write": | ||
usernames.append(username) | ||
return usernames |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it possible to close an issue created by myself even if I cannot do that on other issues?
(In that case, we need this method also in the Issue
class as it is issue-related.)
Do it in the way it is useful for you in the release-bot..;-)
ogr/services/github.py
Outdated
usernames = [] | ||
collaborators = self._get_collaborators_with_permission() | ||
for username, persmission in collaborators.items(): | ||
if persmission == "admin" or persmission == "write": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if persmission == "admin" or persmission == "write": | |
if persmission in ["admin", "write"]: |
ogr/services/github.py
Outdated
def who_can_close_issue(self) -> List[str]: | ||
usernames = [] | ||
collaborators = self._get_collaborators_with_permission() | ||
for username, persmission in collaborators.items(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just typo: s/persmission/permission
ogr/services/github.py
Outdated
for user in users: | ||
permission = self.github_repo.get_collaborator_permission(user) | ||
collaborators[user.login] = permission | ||
# collaborators.append(user.login) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# collaborators.append(user.login) |
return project["access_users"]["owner"] | ||
|
||
def who_can_close_issue(self) -> List[str]: | ||
users: Set[str] = set() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about returning set
for all methods (github/pagure/abstract)?
Congratulations! The build has finished successfully. 🍾 You can install the built RPMs by following these steps:
Please note that the RPMs should be used only in a testing environment. |
@lachmanfrantisek I completely changed the approach from the previous commit how to get user permissions. For example, I changed fnc I also change tests from previous commit and their yaml files. |
Congratulations! The build has finished successfully. 🍾 You can install the built RPMs by following these steps:
Please note that the RPMs should be used only in a testing environment. |
) | ||
return False | ||
|
||
for login, permission in collaborators.items(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I would like to see also the list/set of allowed users. (Since you are going through all of the collaborators and we are not saving any time with that.)
We have following possibilities:
who_can_close_issues
andcan_close_issue
(which will usewho_can_close_issues
and checks the author of the issue) (We can move thecan_close_issue
to the Issue object later.)who_can_close_issue
with the optional parameter for specifying the issue id- leave it in the current state
I vote for the second one but make your own decision...;-)
(Same for the pull-requests.)
b5f070a
to
171f1fc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! I am going to merge, but feel free to continue the discussion if you find something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rado was quicker than me but I have only two notes.
I've not tested that but we have tests for it and you will realise possible problems in the ReleaseBot.
|
||
for allowed_user in allowed_users: | ||
if username == allowed_user: | ||
return True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about this:
if username in allowed_users:
return True
|
||
for allowed_user in allowed_users: | ||
if username == allowed_user: | ||
return True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
Implementation of getting project owners related to #88.
And getting users with permission for closing Issues and merging PR based on Github permissions and Pagure permissions related to issue #100.