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

user's permissions on Issues/PRs #100

Open
7 tasks
marusinm opened this issue Jul 5, 2019 · 17 comments · May be fixed by #914
Open
7 tasks

user's permissions on Issues/PRs #100

marusinm opened this issue Jul 5, 2019 · 17 comments · May be fixed by #914
Labels
area/github Related to GitHub implementation. area/gitlab Related to GitLab implementation. good-first-issue Good for newcomers. Hacktoberfest Participate in https://hacktoberfest.digitalocean.com kind/feature New feature or a request for enhancement. kind/technical-debt The code needs love. Refactoring. pagure Related to Pagure implementation.

Comments

@marusinm
Copy link
Contributor

marusinm commented Jul 5, 2019

Updated by @lachmanfrantisek :

We have a lot of methods related to the permissions (e.g. who can merge/close,..)

It's not consistent, let's clean that!

Feel free to solve this in smaller parts. Just write on what you are going to work...

AC:

The progress is tracked in the following tables. (Any update in the comments is appreciated.)

Project who_can_close_issue() -> Set[str] who_can_merge_pr() -> Set[str] can_close_issue(username: str) -> bool can_merge_pr(username: str) -> bool
abstract 👍 👍 ❗ deprecate the Issue argument
base nothing nothing implement here implement here
Github ? ? ? ?
GitLab ? ? ? ?
Pagure ? ? ? ?
Issue who_can_close() -> Set[str] can_close(username: str) -> bool
abstract implement here 👍
base nothing 👍
Github ? nothing
GitLab ? nothing
Pagure ? nothing
PullRequest who_can_close() -> Set[str] who_can_merge() -> Set[str] can_close(username: str) -> bool can_merge(username: str) -> bool
abstract ? ? ? ?
base nothing nothing implement here implement here
Github ? ? ? ?
GitLab ? ? ? ?
Pagure ? ? ? ?
@lachmanfrantisek lachmanfrantisek added kind/feature New feature or a request for enhancement. area/github Related to GitHub implementation. pagure Related to Pagure implementation. triaged labels Jul 10, 2019
@lachmanfrantisek

This comment has been minimized.

@lachmanfrantisek lachmanfrantisek added area/gitlab Related to GitLab implementation. and removed area/github Related to GitHub implementation. pagure Related to Pagure implementation. labels Sep 18, 2019
@stale

This comment has been minimized.

@stale stale bot added the stale Is the issue still valid? label Dec 31, 2019
@lachmanfrantisek

This comment has been minimized.

@stale stale bot removed the stale Is the issue still valid? label Jan 2, 2020
@lachmanfrantisek lachmanfrantisek added area/github Related to GitHub implementation. good-first-issue Good for newcomers. pagure Related to Pagure implementation. labels Feb 14, 2020
@lachmanfrantisek
Copy link
Member

I've updated the description. This issue is now about cleaning the methods and add the missing parts. Please, check if I don't forget anything.

@lachmanfrantisek lachmanfrantisek added the kind/technical-debt The code needs love. Refactoring. label Feb 14, 2020
@stale

This comment has been minimized.

@stale stale bot added the stale Is the issue still valid? label May 26, 2020
@lachmanfrantisek lachmanfrantisek added pinned and removed stale Is the issue still valid? labels Jun 1, 2020
@lachmanfrantisek lachmanfrantisek added the Hacktoberfest Participate in https://hacktoberfest.digitalocean.com label Sep 30, 2020
@lachmanfrantisek lachmanfrantisek moved this to 📋 Backlog 🔟 in Packit Kanban Board Sep 6, 2022
@pranav33317
Copy link

Yes ma'am , I am working on it , will draft a PR ASAP . Had a question about the unimplemented functions , a lot of the functions are missing return statements and thus giving error . Should I just return default value or raise some error ?
Thanks

@lbarcziova
Copy link
Member

@pranav33317 hello and thanks!

a lot of the functions are missing return statements and thus giving error .

Could you please provide some examples?

@pranav33317
Copy link

pranav33317 commented Mar 21, 2025

@indirect(GithubIssue.get)
def get_issue(self, issue_id: int) -> Issue:
    pass

@indirect(GithubIssue.create)
def create_issue(
    self,
    title: str,
    body: str,
    private: Optional[bool] = None,
    labels: Optional[list[str]] = None,
    assignees: Optional[list[str]] = None,
) -> Issue:
    pass , @indirect(GithubPullRequest.get_list)
def get_pr_list(self, status: PRStatus = PRStatus.open) -> list[PullRequest]:
    pass
 def get_issue_list(
          self,
          status: IssueStatus = IssueStatus.open,
          author: Optional[str] = None,
          assignee: Optional[str] = None,
          labels: Optional[list[str]] = None,
      ) -> list[Issue]:
            pass

@indirect(GithubPullRequest.get)
def get_pr(self, pr_id: int) -> PullRequest:
    pass , def create_pr(
    self,
    title: str,
    body: str,
    target_branch: str,
    source_branch: str,
    fork_username: Optional[str] = None,
) -> PullRequest:
    pass, def set_commit_status(
    self,
    commit: str,
    state: Union[CommitStatus, str],
    target_url: str,
    description: str,
    context: str,
    trim: bool = False,
):
    pass

@indirect(GithubCommitFlag.get)
def get_commit_statuses(self, commit: str) -> list[CommitFlag]:
    pass

@indirect(GithubCheckRun.get)
def get_check_run(
    self,
    check_run_id: Optional[int] = None,
    commit_sha: Optional[str] = None,
) -> Optional["GithubCheckRun"]:
    pass

@indirect(GithubCheckRun.create)
def create_check_run(
    self,
    name: str,
    commit_sha: str,
    url: Optional[str] = None,
    external_id: Optional[str] = None,
    status: GithubCheckRunStatus = GithubCheckRunStatus.queued,
    started_at: Optional[datetime.datetime] = None,
    conclusion: Optional[GithubCheckRunResult] = None,
    completed_at: Optional[datetime.datetime] = None,
    output: Optional[GithubCheckRunOutput] = None,
    actions: Optional[list[dict[str, str]]] = None,
) -> "GithubCheckRun":
    pass

@indirect(GithubCheckRun.get_list)
def get_check_runs(
    self,
    commit_sha: str,
    name: Optional[str] = None,
    status: Optional[GithubCheckRunStatus] = None,
) -> list["GithubCheckRun"]:
    pass

, these are some of the examples of unimplemented functions missing return statements , they are mostly in the following files : ogr/services/github/project.py and ogr/services/gitlab/project.py

@lbarcziova
Copy link
Member

and where do you see these causing errors? From what you posted I would say the methods are implemented, just not directly, but using the @indirect decorator, with methods on the particular objects.

@pranav33317
Copy link

All of them have empty bodies and require a return statement so they are returning error :

Image Image

@pranav33317
Copy link

Hi , I'm sorry I commented on the wrong issue . This is related to #696 , I will repost it there.
I'm working on this issue parallely as well.

@Gauravpadam
Copy link

The description is helpful. I'm looking into this @lachmanfrantisek

@Gauravpadam
Copy link

If I understand this correctly:

  • abstract.py contains all the abstractions for the class methods. We are supposed to have all the mentioned methods as abstract methods first.
  • Once that is done, We can actually start implementing these methods into their respective SubClasses in github.py, gitlab.py and pagure.py.
  • We will write some unit tests for these changes.

Am I thinking in the right direction @lachmanfrantisek @lbarcziova?

If yes, I'll draft a PR for this ticket

@lbarcziova
Copy link
Member

hi @Gauravpadam, yes what you wrote is mostly correct. The implementation itself should be in subclasses, where it is possible (supported by forge) and abstract.py should just contain the signatures. And the base class can serve for common logic. Also, sticking to the description and link can help; only the tables might be a bit outdated. But let us know if anything else is unclear.

@pranav33317
Copy link

Ma'am I was waiting for a response , could you please clear up my doubt , I was working on this

@lbarcziova
Copy link
Member

@pranav33317 sorry, I got confused since you were mentioning #696 in the last comment. So what's the current status for this issue, are you blocked on anything at the moment? (I understood #100 (comment) is related to #696)

@Gauravpadam Gauravpadam linked a pull request Apr 1, 2025 that will close this issue
@pranav33317
Copy link

Yes ma'am still working on both . Could you please answer my query in #696 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/github Related to GitHub implementation. area/gitlab Related to GitLab implementation. good-first-issue Good for newcomers. Hacktoberfest Participate in https://hacktoberfest.digitalocean.com kind/feature New feature or a request for enhancement. kind/technical-debt The code needs love. Refactoring. pagure Related to Pagure implementation.
Projects
Status: backlog
Development

Successfully merging a pull request may close this issue.

6 participants