Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: allow dynamic parameters without requiring org membership#18531

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

Merged
Emyrk merged 4 commits intomainfromstevenmasley/fix_owner_fetch
Jun 24, 2025

Conversation

Emyrk
Copy link
Member

@EmyrkEmyrk commentedJun 24, 2025
edited
Loading

Test failure onmain

POST http://localhost:36481/api/v2/users/e27d2233-85fb-4c8d-b063-f69da3cbb07c/workspaces: unexpected status code 400: Unable to validate parameters                    Error: Failed to fetch workspace owner; Please check your permissions or the user may not exist.

@johnstcnjohnstcn changed the titlefix: dynamic parameters to not require org membershipfix: allow dynamic parameters without requiring org membershipJun 24, 2025
@EmyrkEmyrkforce-pushed thestevenmasley/fix_owner_fetch branch from153faf8 tofb9664eCompareJune 24, 2025 15:15
Comment on lines +246 to +269
user, err := r.db.GetUserByID(ctx, ownerID)
if err != nil {
return err
}
// If the user failed to read, we also try to read the user from their
// organization member. You only need to be able to read the organization member
// to get the owner data.
//
// Only the terraform files can therefore leak more information than the
// caller should have access to. All this info should be public assuming you can
// read the user though.
mem, err := database.ExpectOne(r.db.OrganizationMembers(ctx, database.OrganizationMembersParams{
OrganizationID: r.data.templateVersion.OrganizationID,
UserID: ownerID,
IncludeSystem: true,
}))
if err != nil {
return xerrors.Errorf("fetch user: %w", err)
}

// User data is required for the form. Org member is checked above
// nolint:gocritic
user, err := r.db.GetUserByID(dbauthz.AsProvisionerd(ctx), mem.OrganizationMember.UserID)
if err != nil {
return xerrors.Errorf("fetch user: %w", err)
// Org member fetched, so use the provisioner context to fetch the user.
//nolint:gocritic // Has the correct permissions, and matches the provisioning flow.
user, err = r.db.GetUserByID(dbauthz.AsProvisionerd(ctx), mem.OrganizationMember.UserID)
if err != nil {
return xerrors.Errorf("fetch user: %w", err)
}
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

If the Renderer had the authz object, we could fetch the user with elevated perms, then check the user's perms. Removing 1 sql query round trip 😢

@Emyrk
Copy link
MemberAuthor

Follow up issue made:#18536

@EmyrkEmyrk merged commit341b54e intomainJun 24, 2025
34 checks passed
@EmyrkEmyrk deleted the stevenmasley/fix_owner_fetch branchJune 24, 2025 15:33
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsJun 24, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@johnstcnjohnstcnjohnstcn approved these changes

@SasSwartSasSwartAwaiting requested review from SasSwart

Assignees

@EmyrkEmyrk

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@Emyrk@johnstcn

[8]ページ先頭

©2009-2025 Movatter.jp