authz: utilize expired_at and last_valid_at columns of user_external_accounts
Created by: unknwon
This PR does two things in the PermsSyncer:
- When successfully used a token from
user_external_accounts
, we update thelast_valid_at
column. - Otherwise, update the
expired_at
column.
Part of #14899
TODOs
-
Implements errcode.IsUnauthorized
for GitHub and GitLab errors -
Add tests for db.ExternalAccounts
-
Add tests for PermsSyncer
Merge request reports
Activity
Created by: codecov[bot]
Codecov Report
Merging #16067 (0678605) into main (8423eb5) will increase coverage by
0.03%
. The diff coverage is86.48%
.@@ Coverage Diff @@ ## main #16067 +/- ## ========================================== + Coverage 52.82% 52.85% +0.03% ========================================== Files 1641 1641 Lines 82267 82333 +66 Branches 7280 7280 ========================================== + Hits 43457 43521 +64 + Misses 34960 34956 -4 - Partials 3850 3856 +6
Flag Coverage Δ *Carryforward flag go 52.69% <86.48%> (+0.04%)
integration 28.65% <ø> (ø)
Carriedforward from f8146b9 storybook 27.89% <ø> (ø)
Carriedforward from f8146b9 typescript 53.26% <ø> (ø)
Carriedforward from f8146b9 unit 35.38% <ø> (ø)
Carriedforward from f8146b9 *This pull request uses carry forward flags. Click here to find out more.
Impacted Files Coverage Δ internal/extsvc/github/v3.go 78.00% <0.00%> (-1.60%)
internal/extsvc/gitlab/client.go 30.90% <0.00%> (-0.29%)
enterprise/cmd/repo-updater/authz/perms_syncer.go 42.26% <60.00%> (+0.46%)
internal/db/external_accounts.go 56.54% <93.44%> (+16.79%)
enterprise/internal/db/perms_store.go 79.10% <100.00%> (+0.02%)
Created by: sourcegraph-bot
Notifying subscribers in CODENOTIFY files for diff 8423eb5d64dde2927b08b8597b7d9cd2aa6393e2...067860594d7695b449a3f5567662d715b85ede87.
Notify File(s) @LawnGnome internal/db/external_accounts.go
internal/db/external_accounts_test.go
internal/extsvc/github/v3.go
internal/extsvc/gitlab/client.go
Please register or sign in to reply