-
Notifications
You must be signed in to change notification settings - Fork 76
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
[Bug] Settings
tab not available for organisation-owned projects which I administer
#1445
Comments
I closed this issue because I believe that #1521 is enough to resolve it.
I remember that we tried that a few years ago but it did not work because we could not get all the repositories the user can access.
That's a nice idea. However, I am pretty sure it would slow down the response time of the project page too much. |
Ah, fair enough - I just retried a few repos, and got better results:
I'll try again in half an hour to see if I can get access to that Scanamo one too...! |
Just to be sure, have you tried unlogging and logging again? If yes and it is not working, it is probably not going to work better in half an hour. |
Ah, yes - still don't have access to settings on https://index.scala-lang.org/scanamo/scanamo after logging out & in again: Screen.Recording.2025-01-03.at.12.47.44.mov |
Current behavior
Although the
Settings
tab is displayed for projects which I directly own, eg:...it is not showing on projects which are owned by organisations, and are administered by me, eg:
The
guardian
organisation is very large, holding over 2000 public repos (I have write access to extensive numbers of these), but thescanamo
organisation is much smaller, holding just 2 repos.Based off @adpi2's comment I've logged in to Scaladex, then waited half an hour before re-checking my access to the settings tab, which has not changed.
Expected Behavior
I should be able to access the
Settings
tab for all repos which I administer, including ones that are organisation owned.The Scaladex codebase regards any permission of
WRITE
,MAINTAIN
,ADMIN
as conferring sufficient permission to access theSettings
:scaladex/modules/infra/src/main/scala/scaladex/infra/GithubClientImpl.scala
Line 335 in 1d02a3b
...and I do have that level of permission on those repos.
Extra comments
Access to the
Settings
tab is controlled by thescaladex.core.model.UserState.canEdit()
method:scaladex/modules/core/shared/src/main/scala/scaladex/core/model/UserInfo.scala
Lines 14 to 17 in 7b1e2d0
It looks like there are missing
repos
that I should have in theUserState
returned from the DB byscaladex.infra.SqlDatabase.getUser()
:scaladex/modules/infra/src/main/scala/scaladex/infra/SqlDatabase.scala
Lines 195 to 196 in 1d02a3b
This data, stored in the database, is fetched lazily (as per #1170) with information from
scaladex.infra.GithubClientImpl.getUserState()
:scaladex/modules/infra/src/main/scala/scaladex/infra/GithubClientImpl.scala
Lines 334 to 342 in 1d02a3b
...which calls
getOrganizationRepositories()
:scaladex/modules/infra/src/main/scala/scaladex/infra/GithubClientImpl.scala
Lines 227 to 238 in 1d02a3b
At the moment, the Scaladex is doing a GraphQL query per user-organisation. I don't know if it might be simpler/faster to use the REST API and hit the https://api.github.com/user/repos endpoint?
https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#list-repositories-for-the-authenticated-user
Is it necessary for the Scaladex to maintain its own datastore of repository admins?
So far as I can see, there are 3 places where the
repos
ofUserState
are used:Settings
pagescaladex/modules/server/src/main/scala/scaladex/server/route/SearchPages.scala
Line 47 in abf2e20
scaladex/modules/server/src/main/scala/scaladex/server/service/PublishProcess.scala
Line 77 in df444f4
...only the middle one, providing the search list, really requires a full list of all repos the user administrates? If that feature was sacrificed, it's possible that the other two could be furnished by solely querying the users permissions on the repository in question - ie, if I'm visiting
Search terms
authentication
The text was updated successfully, but these errors were encountered: