mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-13 17:35:12 +00:00
# Which Problems Are Solved # How the Problems Are Solved # Additional Changes # Additional Context - Closes #10690
This commit is contained in:
@@ -3,6 +3,7 @@ import { Condition } from '@zitadel/proto/zitadel/action/v2beta/execution_pb';
|
||||
|
||||
@Pipe({
|
||||
name: 'condition',
|
||||
standalone: false,
|
||||
})
|
||||
export class ActionConditionPipe implements PipeTransform {
|
||||
transform(condition?: Condition): string {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Duration } from 'google-protobuf/google/protobuf/duration_pb';
|
||||
|
||||
@Pipe({
|
||||
name: 'durationToSeconds',
|
||||
standalone: false,
|
||||
})
|
||||
export class DurationToSecondsPipe implements PipeTransform {
|
||||
transform(value?: Duration.AsObject, ...args: unknown[]): unknown {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { computed, Injector, Pipe, PipeTransform } from '@angular/core';
|
||||
import { delay, Observable } from 'rxjs';
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
import { delay, map, Observable } from 'rxjs';
|
||||
import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
|
||||
import { NewAuthService } from '../../services/new-auth.service';
|
||||
import { toObservable } from '@angular/core/rxjs-interop';
|
||||
@@ -7,28 +7,24 @@ import { filter } from 'rxjs/operators';
|
||||
|
||||
@Pipe({
|
||||
name: 'hasRole',
|
||||
standalone: false,
|
||||
})
|
||||
export class HasRolePipe implements PipeTransform {
|
||||
private readonly permissions = this.newAuthService.listMyZitadelPermissionsQuery();
|
||||
private readonly permissions$ = toObservable(this.newAuthService.listMyZitadelPermissionsQuery().data);
|
||||
|
||||
constructor(
|
||||
private readonly authService: GrpcAuthService,
|
||||
private readonly newAuthService: NewAuthService,
|
||||
private readonly injector: Injector,
|
||||
) {}
|
||||
|
||||
public transform(values: string[], requiresAll: boolean = false): Observable<boolean> {
|
||||
const signal = computed(() => {
|
||||
const permissions = this.permissions.data();
|
||||
if (!permissions) {
|
||||
return undefined;
|
||||
}
|
||||
return this.authService.hasRoles(permissions, values, requiresAll);
|
||||
});
|
||||
|
||||
return toObservable(signal, {
|
||||
injector: this.injector,
|
||||
}).pipe(
|
||||
return this.permissions$.pipe(
|
||||
map((permissions) => {
|
||||
if (!permissions) {
|
||||
return undefined;
|
||||
}
|
||||
return this.authService.hasRoles(permissions, values, requiresAll);
|
||||
}),
|
||||
filter((hasRole): hasRole is Exclude<typeof hasRole, undefined> => hasRole !== undefined),
|
||||
delay(0),
|
||||
);
|
||||
|
||||
@@ -6,6 +6,7 @@ import { supportedLanguages } from 'src/app/utils/language';
|
||||
|
||||
@Pipe({
|
||||
name: 'localizedDate',
|
||||
standalone: false,
|
||||
})
|
||||
export class LocalizedDatePipe implements PipeTransform {
|
||||
constructor(private translateService: TranslateService) {}
|
||||
|
||||
@@ -6,6 +6,7 @@ import { Milestone } from '../../proto/generated/zitadel/milestone/v1/milestone_
|
||||
|
||||
@Pipe({
|
||||
name: 'milestone',
|
||||
standalone: false,
|
||||
})
|
||||
export class MilestonePipe implements PipeTransform {
|
||||
constructor(private translateService: TranslateService) {}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({
|
||||
name: 'origin',
|
||||
standalone: false,
|
||||
})
|
||||
export class OriginPipe implements PipeTransform {
|
||||
public transform(value: string): boolean {
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({
|
||||
name: 'redirect',
|
||||
standalone: false,
|
||||
})
|
||||
export class RedirectPipe implements PipeTransform {
|
||||
public transform(uri: string, isNative: boolean): boolean {
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({
|
||||
name: 'roletransform',
|
||||
standalone: false,
|
||||
})
|
||||
export class RoleTransformPipe implements PipeTransform {
|
||||
public transform(value: string | string[]): string {
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Timestamp } from 'src/app/proto/generated/google/protobuf/timestamp_pb'
|
||||
|
||||
@Pipe({
|
||||
name: 'timestampToDate',
|
||||
standalone: false,
|
||||
})
|
||||
export class TimestampToDatePipe implements PipeTransform {
|
||||
transform(date: BufTimestamp | Timestamp.AsObject | undefined): Date | undefined {
|
||||
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
|
||||
import { TimestampToRetentionPipe } from './timestamp-to-retention.pipe';
|
||||
|
||||
@NgModule({
|
||||
declarations: [TimestampToRetentionPipe],
|
||||
imports: [CommonModule],
|
||||
exports: [TimestampToRetentionPipe],
|
||||
})
|
||||
export class TimestampToRetentionPipeModule {}
|
||||
@@ -4,6 +4,7 @@ import { Event } from 'src/app/proto/generated/zitadel/event_pb';
|
||||
|
||||
@Pipe({
|
||||
name: 'toobject',
|
||||
standalone: false,
|
||||
})
|
||||
export class ToObjectPipe implements PipeTransform {
|
||||
public transform(value: Event | Struct): any {
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Event } from 'src/app/proto/generated/zitadel/event_pb';
|
||||
|
||||
@Pipe({
|
||||
name: 'topayload',
|
||||
standalone: false,
|
||||
})
|
||||
export class ToPayloadPipe implements PipeTransform {
|
||||
public transform(value: Event): JavaScriptValue | string {
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({
|
||||
name: 'truncate',
|
||||
standalone: false,
|
||||
})
|
||||
export class TruncatePipePipe implements PipeTransform {
|
||||
transform(value: string, ...args: unknown[]): unknown {
|
||||
|
||||
Reference in New Issue
Block a user