Move VCS-specific Gitea OAuth2 scopes to the call site

The adapter class defaulted to the full repo/org/issue scope set, so any
future "sign in with Gitea" feature reusing this OAuth2 class would force
that same scope set on a plain login, which it doesn't need. Mirrors
OAuth2\Github, whose adapter only defaults to 'user:email' -- the VCS
authorize flow now passes its own required scopes via the constructor's
existing $scopes parameter instead of the adapter hardcoding them.
This commit is contained in:
harsh mahajan committed 2026-07-14 19:05:24 +05:30
1 parent 315325fdef
commit c9273ac19c
2 files changed
+10 -6

No files matched your search

-5
View File
@@ -14,11 +14,6 @@ class Gitea extends OAuth2
protected array $scopes = [
'read:user',
'read:repository',
'write:repository',
'read:organization',
'read:issue',
'write:issue',
];
public function setEndpoint(string $endpoint): void
@@ -30,7 +30,16 @@ class Get extends Base
System::getEnv('_APP_VCS_GITEA_CLIENT_ID', ''),
System::getEnv('_APP_VCS_GITEA_CLIENT_SECRET', ''),
$callback,
$state
$state,
// VCS-specific scopes -- the adapter's own default is just
// read:user, enough for a plain "sign in with Gitea".
[
'read:repository',
'write:repository',
'read:organization',
'read:issue',
'write:issue',
]
);
// The login page is opened by the browser, which may reach Gitea on a