mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-24 21:48:46 +00:00
feat(console): machine user accesstoken type (#5196)
Set machine user Access Token type
This commit is contained in:
+8
@@ -21,6 +21,14 @@
|
||||
<cnsl-label>{{ 'USER.MACHINE.DESCRIPTION' | translate }}</cnsl-label>
|
||||
<input cnslInput formControlName="description" />
|
||||
</cnsl-form-field>
|
||||
<cnsl-form-field class="formfield">
|
||||
<cnsl-label>{{ 'USER.MACHINE.ACCESSTOKENTYPE' | translate }}</cnsl-label>
|
||||
<mat-select formControlName="accessTokenType" required>
|
||||
<mat-option *ngFor="let aTT of accessTokenTypes" [value]="aTT">
|
||||
{{ 'USER.MACHINE.ACCESSTOKENTYPES.' + aTT | translate }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</cnsl-form-field>
|
||||
</div>
|
||||
<div class="btn-container">
|
||||
<button type="submit" color="primary" mat-raised-button>{{ 'ACTIONS.SAVE' | translate }}</button>
|
||||
|
||||
+7
-5
@@ -1,7 +1,7 @@
|
||||
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
|
||||
import { AbstractControl, UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { Human, Machine } from 'src/app/proto/generated/zitadel/user_pb';
|
||||
import { AccessTokenType, Human, Machine } from 'src/app/proto/generated/zitadel/user_pb';
|
||||
|
||||
@Component({
|
||||
selector: 'cnsl-detail-form-machine',
|
||||
@@ -16,6 +16,11 @@ export class DetailFormMachineComponent implements OnInit, OnDestroy {
|
||||
|
||||
public machineForm!: UntypedFormGroup;
|
||||
|
||||
public accessTokenTypes: AccessTokenType[] = [
|
||||
AccessTokenType.ACCESS_TOKEN_TYPE_BEARER,
|
||||
AccessTokenType.ACCESS_TOKEN_TYPE_JWT,
|
||||
];
|
||||
|
||||
private sub: Subscription = new Subscription();
|
||||
|
||||
constructor(private fb: UntypedFormBuilder) {
|
||||
@@ -23,6 +28,7 @@ export class DetailFormMachineComponent implements OnInit, OnDestroy {
|
||||
userName: [{ value: '', disabled: true }, [Validators.required]],
|
||||
name: [{ value: '', disabled: this.disabled }, Validators.required],
|
||||
description: [{ value: '', disabled: this.disabled }],
|
||||
accessTokenType: [AccessTokenType.ACCESS_TOKEN_TYPE_BEARER, [Validators.required]],
|
||||
});
|
||||
}
|
||||
|
||||
@@ -42,10 +48,6 @@ export class DetailFormMachineComponent implements OnInit, OnDestroy {
|
||||
return this.machineForm.get('name');
|
||||
}
|
||||
|
||||
public get description(): AbstractControl | null {
|
||||
return this.machineForm.get('description');
|
||||
}
|
||||
|
||||
public get userName(): AbstractControl | null {
|
||||
return this.machineForm.get('userName');
|
||||
}
|
||||
|
||||
@@ -274,9 +274,15 @@ export class UserDetailComponent implements OnInit {
|
||||
if (this.user.machine) {
|
||||
this.user.machine.name = machineData.name;
|
||||
this.user.machine.description = machineData.description;
|
||||
this.user.machine.accessTokenType = machineData.accessTokenType;
|
||||
|
||||
this.mgmtUserService
|
||||
.updateMachine(this.user.id, this.user.machine.name, this.user.machine.description)
|
||||
.updateMachine(
|
||||
this.user.id,
|
||||
this.user.machine.name,
|
||||
this.user.machine.description,
|
||||
this.user.machine.accessTokenType,
|
||||
)
|
||||
.then(() => {
|
||||
this.toast.showInfo('USER.TOAST.SAVED', true);
|
||||
this.refreshChanges$.emit();
|
||||
|
||||
Reference in New Issue
Block a user