mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 20:47:32 +00:00
fix(console): org context for V2 user creation (#9971)
# Which Problems Are Solved
This PR addresses a bug in Console V2 APIs, specifically when the
feature toggle is enabled, which caused incorrect organization context
assignment during new user creation.
Co-authored-by: Ramon <mail@conblem.me>
(cherry picked from commit 1a80e26502
)
This commit is contained in:

committed by
Livio Spring

parent
3022ca9e76
commit
88d90424cb
@@ -32,6 +32,7 @@ import { withLatestFromSynchronousFix } from 'src/app/utils/withLatestFromSynchr
|
|||||||
import { PasswordComplexityValidatorFactoryService } from 'src/app/services/password-complexity-validator-factory.service';
|
import { PasswordComplexityValidatorFactoryService } from 'src/app/services/password-complexity-validator-factory.service';
|
||||||
import { NewFeatureService } from 'src/app/services/new-feature.service';
|
import { NewFeatureService } from 'src/app/services/new-feature.service';
|
||||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||||
|
import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
|
||||||
|
|
||||||
type PwdForm = ReturnType<UserCreateV2Component['buildPwdForm']>;
|
type PwdForm = ReturnType<UserCreateV2Component['buildPwdForm']>;
|
||||||
type AuthenticationFactor =
|
type AuthenticationFactor =
|
||||||
@@ -65,6 +66,7 @@ export class UserCreateV2Component implements OnInit {
|
|||||||
private readonly destroyRef: DestroyRef,
|
private readonly destroyRef: DestroyRef,
|
||||||
private readonly route: ActivatedRoute,
|
private readonly route: ActivatedRoute,
|
||||||
protected readonly location: Location,
|
protected readonly location: Location,
|
||||||
|
private readonly authService: GrpcAuthService,
|
||||||
) {
|
) {
|
||||||
this.userForm = this.buildUserForm();
|
this.userForm = this.buildUserForm();
|
||||||
|
|
||||||
@@ -180,9 +182,12 @@ export class UserCreateV2Component implements OnInit {
|
|||||||
private async createUserV2Try(authenticationFactor: AuthenticationFactor) {
|
private async createUserV2Try(authenticationFactor: AuthenticationFactor) {
|
||||||
this.loading.set(true);
|
this.loading.set(true);
|
||||||
|
|
||||||
|
const org = await this.authService.getActiveOrg();
|
||||||
|
|
||||||
const userValues = this.userForm.getRawValue();
|
const userValues = this.userForm.getRawValue();
|
||||||
|
|
||||||
const humanReq: MessageInitShape<typeof AddHumanUserRequestSchema> = {
|
const humanReq: MessageInitShape<typeof AddHumanUserRequestSchema> = {
|
||||||
|
organization: { org: { case: 'orgId', value: org.id } },
|
||||||
username: userValues.username,
|
username: userValues.username,
|
||||||
profile: {
|
profile: {
|
||||||
givenName: userValues.givenName,
|
givenName: userValues.givenName,
|
||||||
|
Reference in New Issue
Block a user