Skip to content

Search repos with keyword in homepage of organization should work for private organization and sysadmin #6670

Closed
@yyjdelete

Description

@yyjdelete
  • Gitea version (or commit ref):1.8.0+rc3
  • Git version: 2.21.0
  • Operating system: Windows 10
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

Related to the func added in #5986, #1763.

  1. Run an gitea server at local, and login as sysadmin;
  2. Create an private organization;
  3. Create an repo in the organization;
  4. Search the repo at homepage of the organization;
    See No matching repositories found.

http://gitea.xxx/orag1?q=rep&tab=&sort=recentupdate
a. Search repos in an private organization should return repos if I'm sysadmin(even if I'm also owner or member of the organization), like it does without keyword or it does for normal members.

b. And found "user.id" shouldn't be use as parameter of sql here in sql log.
https://github.com/go-gitea/gitea/blob/v1.8.0-rc3/models/repo_list.go#L208

c.orderBy not work when ctx.IsSigned && !ctx.User.IsAdmin
https://github.com/go-gitea/gitea/blob/v1.8.0-rc3/routers/user/home.go#L438-L481

d. SearchRepositoryByName use the same param OwnerID for search target and access check for org, and may not work well if they should be different.(Not the same as a, since sysadmin should simply skip all access check)

Screenshots

image
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions