- Notifications
You must be signed in to change notification settings - Fork927
feat: add oauth2 codes and tokens to database#11779
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Might have no match, and a -1 will panic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
In the interest of avoiding later rework, would it be possible to add test coverage for the newly added methods in this PR?
q.oauth2ProviderAppCodes[index] = q.oauth2ProviderAppCodes[len(q.oauth2ProviderAppCodes)-1] | ||
q.oauth2ProviderAppCodes = q.oauth2ProviderAppCodes[:len(q.oauth2ProviderAppCodes)-1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
The thing about this is that it does change the slice order. If we care about order from a test assertion perspective, this will fail that assumption.
Testsshould be written such that if the order is required, they should specify in the query though, so we can leave this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Good point! I think we will probably not have to worry about it since we do not rely on ordering of authentication codes (there is no method to get multiple codes right now either) but seems worth keeping in mind.
I lazily copied these lines from other implementations in this file but I think it might be better to add aremove
and change all of these:
func remove[T any](slice []T, i int) []T { return append(slice[:i], slice[i+1:]...)}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
The way I have been doing it (for apps and secrets which do need ordering) is to sort them before returning in theirGet*
calls so the underlying slice can be in any order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Ooo 1.21 has aDelete
for slices apparently.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
code-asher commentedJan 24, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Good question, do the dbauthz tests look insufficient? They test all the methods and that they return the right thing, I think (I might have the wrong impression on some of the things it does though.) There are also the coderd tests added in the next PR (#11778) that end up hitting these methods, maybe I made the wrong call to split the PR here. I can hold off merging this until both are good to merge. |
johnstcn commentedJan 24, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Those just test authz assertions but don't necessarily call the actual SQL queries.
That might not be a bad idea in case you need to make some changes here. |
Ohhhh I had the wrong impression, good to know. |
186 exists in main now.
5a662d0
to7d10b9e
Compare7d10b9e
to29a9e26
Compare
Uh oh!
There was an error while loading.Please reload this page.
Split out to hopefully make reviewing and merging easier. Works in tandom with#11778.
Blocks: