[Bug] Settings
tab not available for organisation-owned projects which I administer
#1445
Labels
Settings
tab not available for organisation-owned projects which I administer
#1445
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: