Skip to content

feat: audit addition and removal of licenses #6125

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

Merged
merged 11 commits into from
Feb 14, 2023
Merged

Conversation

Kira-Pilot
Copy link
Member

@Kira-Pilot Kira-Pilot commented Feb 8, 2023

resolves #6029
Screen Shot 2023-02-14 at 3 41 25 PM

case database.License:
// TODO: return a valid ID here when the below ticket is completed:
// https://github.com/coder/coder/pull/6012
return uuid.New()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idk that we can merge this up with this line the way it is.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason we can't just use the numerical id?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coadler Do you mean the the License.ID field? That is type int32 - if we used that that, how would we get the AuditLog model to accept it, given it only takes UUIDs?
Another issue: for some reason, License.ID changes. Like if I delete 'license 4' in the CLI, the License.ID will change from 4 to 0. IDK why we're doing this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coadler fixed with the merge of #6012!

@Kira-Pilot Kira-Pilot requested review from coadler and Emyrk February 9, 2023 18:22
case database.License:
// TODO: return a valid ID here when the below ticket is completed:
// https://github.com/coder/coder/pull/6012
return uuid.New()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason we can't just use the numerical id?

@@ -71,6 +71,8 @@ func ResourceTarget[T Auditable](tgt T) string {
case database.APIKey:
// this isn't used
return ""
case database.License:
return typed.UUID.String()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the numerical ID might make more sense as the target, rather than just having the UUID for both.

Suggested change
return typed.UUID.String()
return strconv.Itoa(typed.ID)

@Kira-Pilot Kira-Pilot merged commit 5e60879 into main Feb 14, 2023
@Kira-Pilot Kira-Pilot deleted the audit-licenses/kira-pilot branch February 14, 2023 21:34
@github-actions github-actions bot locked and limited conversation to collaborators Feb 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Audit the addition and removal of licenses
2 participants