= new Subject();
+ public form: FormGroup = new FormGroup({
+ avatarUrlAttribute: new FormControl('', []),
+ displayNameAttribute: new FormControl('', []),
+ emailAttribute: new FormControl('', []),
+ emailVerifiedAttribute: new FormControl('', []),
+ firstNameAttribute: new FormControl('', []),
+ idAttribute: new FormControl('', [requiredValidator]),
+ lastNameAttribute: new FormControl('', []),
+ nickNameAttribute: new FormControl('', []),
+ phoneAttribute: new FormControl('', []),
+ phoneVerifiedAttribute: new FormControl('', []),
+ preferredLanguageAttribute: new FormControl('', []),
+ preferredUsernameAttribute: new FormControl('', []),
+ profileAttribute: new FormControl('', []),
+ });
+
+ constructor() {
+ this.form.valueChanges.pipe(takeUntil(this.destroy$)).subscribe((value) => {
+ if (value) {
+ const attr = new LDAPAttributes();
+ attr.setAvatarUrlAttribute(value.avatarUrlAttribute);
+ attr.setDisplayNameAttribute(value.displayNameAttribute);
+ attr.setEmailAttribute(value.emailAttribute);
+ attr.setEmailVerifiedAttribute(value.emailVerifiedAttribute);
+ attr.setFirstNameAttribute(value.firstNameAttribute);
+ attr.setIdAttribute(value.idAttribute);
+ attr.setLastNameAttribute(value.lastNameAttribute);
+ attr.setNickNameAttribute(value.nickNameAttribute);
+ attr.setPhoneAttribute(value.phoneAttribute);
+ attr.setPhoneVerifiedAttribute(value.phoneVerifiedAttribute);
+ attr.setPreferredLanguageAttribute(value.preferredLanguageAttribute);
+ attr.setPreferredUsernameAttribute(value.preferredUsernameAttribute);
+ attr.setProfileAttribute(value.profileAttribute);
+ this.attributesChanged.emit(attr);
+ }
+ });
+ }
+
+ ngOnChanges(): void {
+ if (this.initialAttributes) {
+ this.form.patchValue(this.initialAttributes);
+ }
+ }
+
+ ngOnDestroy(): void {
+ this.destroy$.next();
+ this.destroy$.complete();
+ }
+}
diff --git a/console/src/app/modules/providers/provider-azure-ad/provider-azure-ad-routing.module.ts b/console/src/app/modules/providers/provider-azure-ad/provider-azure-ad-routing.module.ts
deleted file mode 100644
index 0769a1481..000000000
--- a/console/src/app/modules/providers/provider-azure-ad/provider-azure-ad-routing.module.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { NgModule } from '@angular/core';
-import { RouterModule, Routes } from '@angular/router';
-
-import { ProviderAzureADComponent } from './provider-azure-ad.component';
-
-const routes: Routes = [
- {
- path: '',
- component: ProviderAzureADComponent,
- data: { animation: 'DetailPage' },
- },
-];
-
-@NgModule({
- imports: [RouterModule.forChild(routes)],
- exports: [RouterModule],
-})
-export class ProviderAzureADRoutingModule {}
diff --git a/console/src/app/modules/providers/provider-azure-ad/provider-azure-ad.component.html b/console/src/app/modules/providers/provider-azure-ad/provider-azure-ad.component.html
index 49756c241..a10621d0e 100644
--- a/console/src/app/modules/providers/provider-azure-ad/provider-azure-ad.component.html
+++ b/console/src/app/modules/providers/provider-azure-ad/provider-azure-ad.component.html
@@ -98,7 +98,13 @@
-
-
+
{{ 'ACTIONS.SAVE' | translate }}
{{ 'ACTIONS.CREATE' | translate }}
diff --git a/console/src/app/modules/providers/provider-github-es/provider-github-es.component.ts b/console/src/app/modules/providers/provider-github-es/provider-github-es.component.ts
index 1e26d5e28..3264f0b29 100644
--- a/console/src/app/modules/providers/provider-github-es/provider-github-es.component.ts
+++ b/console/src/app/modules/providers/provider-github-es/provider-github-es.component.ts
@@ -18,6 +18,7 @@ import {
} from 'src/app/proto/generated/zitadel/management_pb';
import { AdminService } from 'src/app/services/admin.service';
import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/breadcrumb.service';
+import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
import { ManagementService } from 'src/app/services/mgmt.service';
import { ToastService } from 'src/app/services/toast.service';
import { requiredValidator } from '../../form-field/validators/validators';
@@ -44,6 +45,7 @@ export class ProviderGithubESComponent {
public provider?: Provider.AsObject;
constructor(
+ private authService: GrpcAuthService,
private route: ActivatedRoute,
private toast: ToastService,
private injector: Injector,
@@ -60,6 +62,23 @@ export class ProviderGithubESComponent {
scopesList: new UntypedFormControl(['openid', 'profile', 'email'], []),
});
+ this.authService
+ .isAllowed(
+ this.serviceType === PolicyComponentServiceType.ADMIN
+ ? ['iam.idp.write']
+ : this.serviceType === PolicyComponentServiceType.MGMT
+ ? ['org.idp.write']
+ : [],
+ )
+ .pipe(take(1))
+ .subscribe((allowed) => {
+ if (allowed) {
+ this.form.enable();
+ } else {
+ this.form.disable();
+ }
+ });
+
this.route.data.pipe(take(1)).subscribe((data) => {
this.serviceType = data.serviceType;
diff --git a/console/src/app/modules/providers/provider-github-es/provider-github-es.module.ts b/console/src/app/modules/providers/provider-github-es/provider-github-es.module.ts
deleted file mode 100644
index b334a531f..000000000
--- a/console/src/app/modules/providers/provider-github-es/provider-github-es.module.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import { CommonModule } from '@angular/common';
-import { NgModule } from '@angular/core';
-import { FormsModule, ReactiveFormsModule } from '@angular/forms';
-import { MatIconModule } from '@angular/material/icon';
-import { MatLegacyButtonModule as MatButtonModule } from '@angular/material/legacy-button';
-import { MatLegacyCheckboxModule as MatCheckboxModule } from '@angular/material/legacy-checkbox';
-import { MatLegacyChipsModule as MatChipsModule } from '@angular/material/legacy-chips';
-import { MatLegacyProgressSpinnerModule } from '@angular/material/legacy-progress-spinner';
-import { MatLegacySelectModule as MatSelectModule } from '@angular/material/legacy-select';
-import { MatLegacyTooltipModule as MatTooltipModule } from '@angular/material/legacy-tooltip';
-import { TranslateModule } from '@ngx-translate/core';
-import { InputModule } from 'src/app/modules/input/input.module';
-
-import { CardModule } from '../../card/card.module';
-import { CreateLayoutModule } from '../../create-layout/create-layout.module';
-import { InfoSectionModule } from '../../info-section/info-section.module';
-import { ProviderOptionsModule } from '../../provider-options/provider-options.module';
-import { ProviderGithubESRoutingModule } from './provider-github-es-routing.module';
-import { ProviderGithubESComponent } from './provider-github-es.component';
-
-@NgModule({
- declarations: [ProviderGithubESComponent],
- imports: [
- ProviderGithubESRoutingModule,
- CommonModule,
- FormsModule,
- ReactiveFormsModule,
- CreateLayoutModule,
- InfoSectionModule,
- InputModule,
- MatButtonModule,
- MatSelectModule,
- MatIconModule,
- MatChipsModule,
- CardModule,
- MatCheckboxModule,
- MatTooltipModule,
- TranslateModule,
- ProviderOptionsModule,
- MatLegacyProgressSpinnerModule,
- ],
-})
-export default class ProviderGithubESModule {}
diff --git a/console/src/app/modules/providers/provider-github/provider-github-routing.module.ts b/console/src/app/modules/providers/provider-github/provider-github-routing.module.ts
deleted file mode 100644
index d5014162d..000000000
--- a/console/src/app/modules/providers/provider-github/provider-github-routing.module.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { NgModule } from '@angular/core';
-import { RouterModule, Routes } from '@angular/router';
-
-import { ProviderGithubComponent } from './provider-github.component';
-
-const routes: Routes = [
- {
- path: '',
- component: ProviderGithubComponent,
- data: { animation: 'DetailPage' },
- },
-];
-
-@NgModule({
- imports: [RouterModule.forChild(routes)],
- exports: [RouterModule],
-})
-export class ProviderGithubRoutingModule {}
diff --git a/console/src/app/modules/providers/provider-github/provider-github.component.html b/console/src/app/modules/providers/provider-github/provider-github.component.html
index f2248b740..8b40a2070 100644
--- a/console/src/app/modules/providers/provider-github/provider-github.component.html
+++ b/console/src/app/modules/providers/provider-github/provider-github.component.html
@@ -84,7 +84,13 @@
-
+
{{ 'ACTIONS.SAVE' | translate }}
{{ 'ACTIONS.CREATE' | translate }}
diff --git a/console/src/app/modules/providers/provider-github/provider-github.component.ts b/console/src/app/modules/providers/provider-github/provider-github.component.ts
index 28f4757f4..975b255d1 100644
--- a/console/src/app/modules/providers/provider-github/provider-github.component.ts
+++ b/console/src/app/modules/providers/provider-github/provider-github.component.ts
@@ -18,6 +18,7 @@ import {
} from 'src/app/proto/generated/zitadel/management_pb';
import { AdminService } from 'src/app/services/admin.service';
import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/breadcrumb.service';
+import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
import { ManagementService } from 'src/app/services/mgmt.service';
import { ToastService } from 'src/app/services/toast.service';
import { requiredValidator } from '../../form-field/validators/validators';
@@ -45,6 +46,7 @@ export class ProviderGithubComponent {
public updateClientSecret: boolean = false;
constructor(
+ private authService: GrpcAuthService,
private route: ActivatedRoute,
private toast: ToastService,
private injector: Injector,
@@ -58,6 +60,23 @@ export class ProviderGithubComponent {
scopesList: new FormControl(['openid', 'profile', 'email'], []),
});
+ this.authService
+ .isAllowed(
+ this.serviceType === PolicyComponentServiceType.ADMIN
+ ? ['iam.idp.write']
+ : this.serviceType === PolicyComponentServiceType.MGMT
+ ? ['org.idp.write']
+ : [],
+ )
+ .pipe(take(1))
+ .subscribe((allowed) => {
+ if (allowed) {
+ this.form.enable();
+ } else {
+ this.form.disable();
+ }
+ });
+
this.route.data.pipe(take(1)).subscribe((data) => {
this.serviceType = data.serviceType;
diff --git a/console/src/app/modules/providers/provider-github/provider-github.module.ts b/console/src/app/modules/providers/provider-github/provider-github.module.ts
deleted file mode 100644
index 8a617b069..000000000
--- a/console/src/app/modules/providers/provider-github/provider-github.module.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import { CommonModule } from '@angular/common';
-import { NgModule } from '@angular/core';
-import { FormsModule, ReactiveFormsModule } from '@angular/forms';
-import { MatIconModule } from '@angular/material/icon';
-import { MatLegacyButtonModule as MatButtonModule } from '@angular/material/legacy-button';
-import { MatLegacyCheckboxModule as MatCheckboxModule } from '@angular/material/legacy-checkbox';
-import { MatLegacyChipsModule as MatChipsModule } from '@angular/material/legacy-chips';
-import { MatLegacyProgressSpinnerModule } from '@angular/material/legacy-progress-spinner';
-import { MatLegacySelectModule as MatSelectModule } from '@angular/material/legacy-select';
-import { MatLegacyTooltipModule as MatTooltipModule } from '@angular/material/legacy-tooltip';
-import { TranslateModule } from '@ngx-translate/core';
-import { InputModule } from 'src/app/modules/input/input.module';
-
-import { CardModule } from '../../card/card.module';
-import { CreateLayoutModule } from '../../create-layout/create-layout.module';
-import { InfoSectionModule } from '../../info-section/info-section.module';
-import { ProviderOptionsModule } from '../../provider-options/provider-options.module';
-import { ProviderGithubRoutingModule } from './provider-github-routing.module';
-import { ProviderGithubComponent } from './provider-github.component';
-
-@NgModule({
- declarations: [ProviderGithubComponent],
- imports: [
- ProviderGithubRoutingModule,
- CommonModule,
- FormsModule,
- ReactiveFormsModule,
- CreateLayoutModule,
- InfoSectionModule,
- InputModule,
- MatButtonModule,
- MatSelectModule,
- MatIconModule,
- MatChipsModule,
- CardModule,
- MatCheckboxModule,
- MatTooltipModule,
- TranslateModule,
- ProviderOptionsModule,
- MatLegacyProgressSpinnerModule,
- ],
-})
-export default class ProviderGithubModule {}
diff --git a/console/src/app/modules/providers/provider-gitlab-self-hosted/provider-gitlab-self-hosted-routing.module.ts b/console/src/app/modules/providers/provider-gitlab-self-hosted/provider-gitlab-self-hosted-routing.module.ts
deleted file mode 100644
index bc8f9c753..000000000
--- a/console/src/app/modules/providers/provider-gitlab-self-hosted/provider-gitlab-self-hosted-routing.module.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { NgModule } from '@angular/core';
-import { RouterModule, Routes } from '@angular/router';
-import { ProviderGitlabSelfHostedComponent } from './provider-gitlab-self-hosted.component';
-
-const routes: Routes = [
- {
- path: '',
- component: ProviderGitlabSelfHostedComponent,
- data: { animation: 'DetailPage' },
- },
-];
-
-@NgModule({
- imports: [RouterModule.forChild(routes)],
- exports: [RouterModule],
-})
-export class ProviderGitlabSelfHostedRoutingModule {}
diff --git a/console/src/app/modules/providers/provider-gitlab-self-hosted/provider-gitlab-self-hosted.component.html b/console/src/app/modules/providers/provider-gitlab-self-hosted/provider-gitlab-self-hosted.component.html
index a4346256a..194e9dbed 100644
--- a/console/src/app/modules/providers/provider-gitlab-self-hosted/provider-gitlab-self-hosted.component.html
+++ b/console/src/app/modules/providers/provider-gitlab-self-hosted/provider-gitlab-self-hosted.component.html
@@ -87,7 +87,13 @@
-
+
{{ 'ACTIONS.SAVE' | translate }}
{{ 'ACTIONS.CREATE' | translate }}
diff --git a/console/src/app/modules/providers/provider-gitlab-self-hosted/provider-gitlab-self-hosted.component.ts b/console/src/app/modules/providers/provider-gitlab-self-hosted/provider-gitlab-self-hosted.component.ts
index 1b5ea437b..72610d03a 100644
--- a/console/src/app/modules/providers/provider-gitlab-self-hosted/provider-gitlab-self-hosted.component.ts
+++ b/console/src/app/modules/providers/provider-gitlab-self-hosted/provider-gitlab-self-hosted.component.ts
@@ -18,6 +18,7 @@ import {
} from 'src/app/proto/generated/zitadel/management_pb';
import { AdminService } from 'src/app/services/admin.service';
import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/breadcrumb.service';
+import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
import { ManagementService } from 'src/app/services/mgmt.service';
import { ToastService } from 'src/app/services/toast.service';
import { requiredValidator } from '../../form-field/validators/validators';
@@ -45,6 +46,7 @@ export class ProviderGitlabSelfHostedComponent {
public updateClientSecret: boolean = false;
constructor(
+ private authService: GrpcAuthService,
private route: ActivatedRoute,
private toast: ToastService,
private injector: Injector,
@@ -59,6 +61,23 @@ export class ProviderGitlabSelfHostedComponent {
scopesList: new FormControl(['openid', 'profile', 'email'], []),
});
+ this.authService
+ .isAllowed(
+ this.serviceType === PolicyComponentServiceType.ADMIN
+ ? ['iam.idp.write']
+ : this.serviceType === PolicyComponentServiceType.MGMT
+ ? ['org.idp.write']
+ : [],
+ )
+ .pipe(take(1))
+ .subscribe((allowed) => {
+ if (allowed) {
+ this.form.enable();
+ } else {
+ this.form.disable();
+ }
+ });
+
this.route.data.pipe(take(1)).subscribe((data) => {
this.serviceType = data.serviceType;
diff --git a/console/src/app/modules/providers/provider-gitlab-self-hosted/provider-gitlab-self-hosted.module.ts b/console/src/app/modules/providers/provider-gitlab-self-hosted/provider-gitlab-self-hosted.module.ts
deleted file mode 100644
index f516dddfe..000000000
--- a/console/src/app/modules/providers/provider-gitlab-self-hosted/provider-gitlab-self-hosted.module.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import { CommonModule } from '@angular/common';
-import { NgModule } from '@angular/core';
-import { FormsModule, ReactiveFormsModule } from '@angular/forms';
-import { MatIconModule } from '@angular/material/icon';
-import { MatLegacyButtonModule as MatButtonModule } from '@angular/material/legacy-button';
-import { MatLegacyCheckboxModule as MatCheckboxModule } from '@angular/material/legacy-checkbox';
-import { MatLegacyChipsModule as MatChipsModule } from '@angular/material/legacy-chips';
-import { MatLegacyProgressSpinnerModule } from '@angular/material/legacy-progress-spinner';
-import { MatLegacySelectModule as MatSelectModule } from '@angular/material/legacy-select';
-import { MatLegacyTooltipModule as MatTooltipModule } from '@angular/material/legacy-tooltip';
-import { TranslateModule } from '@ngx-translate/core';
-import { InputModule } from 'src/app/modules/input/input.module';
-
-import { CardModule } from '../../card/card.module';
-import { CreateLayoutModule } from '../../create-layout/create-layout.module';
-import { InfoSectionModule } from '../../info-section/info-section.module';
-import { ProviderOptionsModule } from '../../provider-options/provider-options.module';
-import { ProviderGitlabSelfHostedRoutingModule } from './provider-gitlab-self-hosted-routing.module';
-import { ProviderGitlabSelfHostedComponent } from './provider-gitlab-self-hosted.component';
-
-@NgModule({
- declarations: [ProviderGitlabSelfHostedComponent],
- imports: [
- ProviderGitlabSelfHostedRoutingModule,
- CommonModule,
- FormsModule,
- ReactiveFormsModule,
- CreateLayoutModule,
- InfoSectionModule,
- InputModule,
- MatButtonModule,
- MatSelectModule,
- MatIconModule,
- MatChipsModule,
- CardModule,
- MatCheckboxModule,
- MatTooltipModule,
- TranslateModule,
- ProviderOptionsModule,
- MatLegacyProgressSpinnerModule,
- ],
-})
-export default class ProviderGitlabSelfHostedModule {}
diff --git a/console/src/app/modules/providers/provider-gitlab/provider-gitlab-routing.module.ts b/console/src/app/modules/providers/provider-gitlab/provider-gitlab-routing.module.ts
deleted file mode 100644
index ccc9aa76d..000000000
--- a/console/src/app/modules/providers/provider-gitlab/provider-gitlab-routing.module.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { NgModule } from '@angular/core';
-import { RouterModule, Routes } from '@angular/router';
-import { ProviderGitlabComponent } from './provider-gitlab.component';
-
-const routes: Routes = [
- {
- path: '',
- component: ProviderGitlabComponent,
- data: { animation: 'DetailPage' },
- },
-];
-
-@NgModule({
- imports: [RouterModule.forChild(routes)],
- exports: [RouterModule],
-})
-export class ProviderGitlabRoutingModule {}
diff --git a/console/src/app/modules/providers/provider-gitlab/provider-gitlab.component.html b/console/src/app/modules/providers/provider-gitlab/provider-gitlab.component.html
index 6d8802a6a..0ef22147d 100644
--- a/console/src/app/modules/providers/provider-gitlab/provider-gitlab.component.html
+++ b/console/src/app/modules/providers/provider-gitlab/provider-gitlab.component.html
@@ -83,7 +83,13 @@
-
+
{{ 'ACTIONS.SAVE' | translate }}
{{ 'ACTIONS.CREATE' | translate }}
diff --git a/console/src/app/modules/providers/provider-gitlab/provider-gitlab.component.ts b/console/src/app/modules/providers/provider-gitlab/provider-gitlab.component.ts
index 295c77acd..dd3c2976e 100644
--- a/console/src/app/modules/providers/provider-gitlab/provider-gitlab.component.ts
+++ b/console/src/app/modules/providers/provider-gitlab/provider-gitlab.component.ts
@@ -18,6 +18,7 @@ import {
} from 'src/app/proto/generated/zitadel/management_pb';
import { AdminService } from 'src/app/services/admin.service';
import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/breadcrumb.service';
+import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
import { ManagementService } from 'src/app/services/mgmt.service';
import { ToastService } from 'src/app/services/toast.service';
import { requiredValidator } from '../../form-field/validators/validators';
@@ -45,6 +46,7 @@ export class ProviderGitlabComponent {
public updateClientSecret: boolean = false;
constructor(
+ private authService: GrpcAuthService,
private route: ActivatedRoute,
private toast: ToastService,
private injector: Injector,
@@ -58,6 +60,23 @@ export class ProviderGitlabComponent {
scopesList: new FormControl(['openid', 'profile', 'email'], []),
});
+ this.authService
+ .isAllowed(
+ this.serviceType === PolicyComponentServiceType.ADMIN
+ ? ['iam.idp.write']
+ : this.serviceType === PolicyComponentServiceType.MGMT
+ ? ['org.idp.write']
+ : [],
+ )
+ .pipe(take(1))
+ .subscribe((allowed) => {
+ if (allowed) {
+ this.form.enable();
+ } else {
+ this.form.disable();
+ }
+ });
+
this.route.data.pipe(take(1)).subscribe((data) => {
this.serviceType = data.serviceType;
diff --git a/console/src/app/modules/providers/provider-gitlab/provider-gitlab.module.ts b/console/src/app/modules/providers/provider-gitlab/provider-gitlab.module.ts
deleted file mode 100644
index 328f23136..000000000
--- a/console/src/app/modules/providers/provider-gitlab/provider-gitlab.module.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import { CommonModule } from '@angular/common';
-import { NgModule } from '@angular/core';
-import { FormsModule, ReactiveFormsModule } from '@angular/forms';
-import { MatIconModule } from '@angular/material/icon';
-import { MatLegacyButtonModule as MatButtonModule } from '@angular/material/legacy-button';
-import { MatLegacyCheckboxModule as MatCheckboxModule } from '@angular/material/legacy-checkbox';
-import { MatLegacyChipsModule as MatChipsModule } from '@angular/material/legacy-chips';
-import { MatLegacyProgressSpinnerModule } from '@angular/material/legacy-progress-spinner';
-import { MatLegacySelectModule as MatSelectModule } from '@angular/material/legacy-select';
-import { MatLegacyTooltipModule as MatTooltipModule } from '@angular/material/legacy-tooltip';
-import { TranslateModule } from '@ngx-translate/core';
-import { InputModule } from 'src/app/modules/input/input.module';
-
-import { CardModule } from '../../card/card.module';
-import { CreateLayoutModule } from '../../create-layout/create-layout.module';
-import { InfoSectionModule } from '../../info-section/info-section.module';
-import { ProviderOptionsModule } from '../../provider-options/provider-options.module';
-import { ProviderGitlabRoutingModule } from './provider-gitlab-routing.module';
-import { ProviderGitlabComponent } from './provider-gitlab.component';
-
-@NgModule({
- declarations: [ProviderGitlabComponent],
- imports: [
- ProviderGitlabRoutingModule,
- CommonModule,
- FormsModule,
- ReactiveFormsModule,
- CreateLayoutModule,
- InfoSectionModule,
- InputModule,
- MatButtonModule,
- MatSelectModule,
- MatIconModule,
- MatChipsModule,
- CardModule,
- MatCheckboxModule,
- MatTooltipModule,
- TranslateModule,
- ProviderOptionsModule,
- MatLegacyProgressSpinnerModule,
- ],
-})
-export default class ProviderGitlabModule {}
diff --git a/console/src/app/modules/providers/provider-google/provider-google-routing.module.ts b/console/src/app/modules/providers/provider-google/provider-google-routing.module.ts
deleted file mode 100644
index aa03e3bb9..000000000
--- a/console/src/app/modules/providers/provider-google/provider-google-routing.module.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { NgModule } from '@angular/core';
-import { RouterModule, Routes } from '@angular/router';
-
-import { ProviderGoogleComponent } from './provider-google.component';
-
-const routes: Routes = [
- {
- path: '',
- component: ProviderGoogleComponent,
- data: { animation: 'DetailPage' },
- },
-];
-
-@NgModule({
- imports: [RouterModule.forChild(routes)],
- exports: [RouterModule],
-})
-export class ProviderGoogleRoutingModule {}
diff --git a/console/src/app/modules/providers/provider-google/provider-google.component.html b/console/src/app/modules/providers/provider-google/provider-google.component.html
index 32643471a..912d4fd8b 100644
--- a/console/src/app/modules/providers/provider-google/provider-google.component.html
+++ b/console/src/app/modules/providers/provider-google/provider-google.component.html
@@ -83,7 +83,13 @@
-
+
{{ 'ACTIONS.SAVE' | translate }}
{{ 'ACTIONS.CREATE' | translate }}
diff --git a/console/src/app/modules/providers/provider-google/provider-google.component.ts b/console/src/app/modules/providers/provider-google/provider-google.component.ts
index 3515c0553..e606e2655 100644
--- a/console/src/app/modules/providers/provider-google/provider-google.component.ts
+++ b/console/src/app/modules/providers/provider-google/provider-google.component.ts
@@ -18,6 +18,7 @@ import {
} from 'src/app/proto/generated/zitadel/management_pb';
import { AdminService } from 'src/app/services/admin.service';
import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/breadcrumb.service';
+import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
import { ManagementService } from 'src/app/services/mgmt.service';
import { ToastService } from 'src/app/services/toast.service';
import { requiredValidator } from '../../form-field/validators/validators';
@@ -45,6 +46,7 @@ export class ProviderGoogleComponent {
public updateClientSecret: boolean = false;
constructor(
+ private authService: GrpcAuthService,
private route: ActivatedRoute,
private toast: ToastService,
private injector: Injector,
@@ -58,6 +60,23 @@ export class ProviderGoogleComponent {
scopesList: new FormControl(['openid', 'profile', 'email'], []),
});
+ this.authService
+ .isAllowed(
+ this.serviceType === PolicyComponentServiceType.ADMIN
+ ? ['iam.idp.write']
+ : this.serviceType === PolicyComponentServiceType.MGMT
+ ? ['org.idp.write']
+ : [],
+ )
+ .pipe(take(1))
+ .subscribe((allowed) => {
+ if (allowed) {
+ this.form.enable();
+ } else {
+ this.form.disable();
+ }
+ });
+
this.route.data.pipe(take(1)).subscribe((data) => {
this.serviceType = data.serviceType;
diff --git a/console/src/app/modules/providers/provider-google/provider-google.module.ts b/console/src/app/modules/providers/provider-google/provider-google.module.ts
deleted file mode 100644
index e0af1a803..000000000
--- a/console/src/app/modules/providers/provider-google/provider-google.module.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import { CommonModule } from '@angular/common';
-import { NgModule } from '@angular/core';
-import { FormsModule, ReactiveFormsModule } from '@angular/forms';
-import { MatIconModule } from '@angular/material/icon';
-import { MatLegacyButtonModule as MatButtonModule } from '@angular/material/legacy-button';
-import { MatLegacyCheckboxModule as MatCheckboxModule } from '@angular/material/legacy-checkbox';
-import { MatLegacyChipsModule as MatChipsModule } from '@angular/material/legacy-chips';
-import { MatLegacyProgressSpinnerModule } from '@angular/material/legacy-progress-spinner';
-import { MatLegacySelectModule as MatSelectModule } from '@angular/material/legacy-select';
-import { MatLegacyTooltipModule as MatTooltipModule } from '@angular/material/legacy-tooltip';
-import { TranslateModule } from '@ngx-translate/core';
-import { InputModule } from 'src/app/modules/input/input.module';
-
-import { CardModule } from '../../card/card.module';
-import { CreateLayoutModule } from '../../create-layout/create-layout.module';
-import { InfoSectionModule } from '../../info-section/info-section.module';
-import { ProviderOptionsModule } from '../../provider-options/provider-options.module';
-import { ProviderGoogleRoutingModule } from './provider-google-routing.module';
-import { ProviderGoogleComponent } from './provider-google.component';
-
-@NgModule({
- declarations: [ProviderGoogleComponent],
- imports: [
- ProviderGoogleRoutingModule,
- CommonModule,
- FormsModule,
- ReactiveFormsModule,
- CreateLayoutModule,
- InfoSectionModule,
- InputModule,
- MatButtonModule,
- MatSelectModule,
- MatIconModule,
- MatChipsModule,
- CardModule,
- MatCheckboxModule,
- MatTooltipModule,
- TranslateModule,
- ProviderOptionsModule,
- MatLegacyProgressSpinnerModule,
- ],
-})
-export default class ProviderGoogleModule {}
diff --git a/console/src/app/modules/providers/provider-jwt/provider-jwt-routing.module.ts b/console/src/app/modules/providers/provider-jwt/provider-jwt-routing.module.ts
deleted file mode 100644
index 35f580044..000000000
--- a/console/src/app/modules/providers/provider-jwt/provider-jwt-routing.module.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { NgModule } from '@angular/core';
-import { RouterModule, Routes } from '@angular/router';
-import { ProviderJWTComponent } from './provider-jwt.component';
-
-const routes: Routes = [
- {
- path: '',
- component: ProviderJWTComponent,
- data: { animation: 'DetailPage' },
- },
-];
-
-@NgModule({
- imports: [RouterModule.forChild(routes)],
- exports: [RouterModule],
-})
-export class ProviderJWTCreateRoutingModule {}
diff --git a/console/src/app/modules/providers/provider-jwt/provider-jwt.component.html b/console/src/app/modules/providers/provider-jwt/provider-jwt.component.html
index 853bb3e80..151599c0f 100644
--- a/console/src/app/modules/providers/provider-jwt/provider-jwt.component.html
+++ b/console/src/app/modules/providers/provider-jwt/provider-jwt.component.html
@@ -50,7 +50,13 @@
-
+
{{ 'ACTIONS.SAVE' | translate }}
{{ 'ACTIONS.CREATE' | translate }}
diff --git a/console/src/app/modules/providers/provider-jwt/provider-jwt.component.ts b/console/src/app/modules/providers/provider-jwt/provider-jwt.component.ts
index cf82a3289..ed77f4460 100644
--- a/console/src/app/modules/providers/provider-jwt/provider-jwt.component.ts
+++ b/console/src/app/modules/providers/provider-jwt/provider-jwt.component.ts
@@ -17,6 +17,7 @@ import {
} from 'src/app/proto/generated/zitadel/management_pb';
import { AdminService } from 'src/app/services/admin.service';
import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/breadcrumb.service';
+import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
import { ManagementService } from 'src/app/services/mgmt.service';
import { ToastService } from 'src/app/services/toast.service';
import { requiredValidator } from '../../form-field/validators/validators';
@@ -42,6 +43,7 @@ export class ProviderJWTComponent {
public provider?: Provider.AsObject;
constructor(
+ private authService: GrpcAuthService,
private route: ActivatedRoute,
private toast: ToastService,
private injector: Injector,
@@ -87,6 +89,23 @@ export class ProviderJWTComponent {
jwtEndpoint: new UntypedFormControl('', [requiredValidator]),
keysEndpoint: new UntypedFormControl('', [requiredValidator]),
});
+
+ this.authService
+ .isAllowed(
+ this.serviceType === PolicyComponentServiceType.ADMIN
+ ? ['iam.idp.write']
+ : this.serviceType === PolicyComponentServiceType.MGMT
+ ? ['org.idp.write']
+ : [],
+ )
+ .pipe(take(1))
+ .subscribe((allowed) => {
+ if (allowed) {
+ this.form.enable();
+ } else {
+ this.form.disable();
+ }
+ });
}
private getData(id: string): void {
diff --git a/console/src/app/modules/providers/provider-jwt/provider-jwt.module.ts b/console/src/app/modules/providers/provider-jwt/provider-jwt.module.ts
deleted file mode 100644
index 2231cf807..000000000
--- a/console/src/app/modules/providers/provider-jwt/provider-jwt.module.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import { CommonModule } from '@angular/common';
-import { NgModule } from '@angular/core';
-import { FormsModule, ReactiveFormsModule } from '@angular/forms';
-import { MatIconModule } from '@angular/material/icon';
-import { MatLegacyButtonModule as MatButtonModule } from '@angular/material/legacy-button';
-import { MatLegacyCheckboxModule as MatCheckboxModule } from '@angular/material/legacy-checkbox';
-import { MatLegacyChipsModule as MatChipsModule } from '@angular/material/legacy-chips';
-import { MatLegacyProgressSpinnerModule } from '@angular/material/legacy-progress-spinner';
-import { MatLegacySelectModule as MatSelectModule } from '@angular/material/legacy-select';
-import { MatLegacyTooltipModule as MatTooltipModule } from '@angular/material/legacy-tooltip';
-import { TranslateModule } from '@ngx-translate/core';
-import { InputModule } from 'src/app/modules/input/input.module';
-
-import { CardModule } from '../../card/card.module';
-import { CreateLayoutModule } from '../../create-layout/create-layout.module';
-import { InfoSectionModule } from '../../info-section/info-section.module';
-import { ProviderOptionsModule } from '../../provider-options/provider-options.module';
-import { ProviderJWTCreateRoutingModule } from './provider-jwt-routing.module';
-import { ProviderJWTComponent } from './provider-jwt.component';
-
-@NgModule({
- declarations: [ProviderJWTComponent],
- imports: [
- ProviderJWTCreateRoutingModule,
- CommonModule,
- FormsModule,
- ReactiveFormsModule,
- CreateLayoutModule,
- InfoSectionModule,
- InputModule,
- MatButtonModule,
- MatSelectModule,
- MatIconModule,
- MatChipsModule,
- CardModule,
- MatCheckboxModule,
- MatTooltipModule,
- TranslateModule,
- ProviderOptionsModule,
- MatLegacyProgressSpinnerModule,
- ],
-})
-export default class ProviderJWTModule {}
diff --git a/console/src/app/modules/providers/provider-ldap/provider-ldap.component.html b/console/src/app/modules/providers/provider-ldap/provider-ldap.component.html
new file mode 100644
index 000000000..ee4994934
--- /dev/null
+++ b/console/src/app/modules/providers/provider-ldap/provider-ldap.component.html
@@ -0,0 +1,125 @@
+
+
+
+
+
{{ 'IDP.CREATE.LDAP.TITLE' | translate }}
+
+
+
+
+ {{ !provider ? ('IDP.CREATE.LDAP.DESCRIPTION' | translate) : ('IDP.DETAIL.DESCRIPTION' | translate) }}
+
+
+
+
+
diff --git a/console/src/app/modules/providers/provider-ldap/provider-ldap.component.spec.ts b/console/src/app/modules/providers/provider-ldap/provider-ldap.component.spec.ts
new file mode 100644
index 000000000..ac5c30e67
--- /dev/null
+++ b/console/src/app/modules/providers/provider-ldap/provider-ldap.component.spec.ts
@@ -0,0 +1,24 @@
+import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
+
+import { ProviderLDAPComponent } from './provider-ldap.component';
+
+describe('ProviderLDAPComponent', () => {
+ let component: ProviderLDAPComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(waitForAsync(() => {
+ TestBed.configureTestingModule({
+ declarations: [ProviderLDAPComponent],
+ }).compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(ProviderLDAPComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/console/src/app/modules/providers/provider-ldap/provider-ldap.component.ts b/console/src/app/modules/providers/provider-ldap/provider-ldap.component.ts
new file mode 100644
index 000000000..98df95ad9
--- /dev/null
+++ b/console/src/app/modules/providers/provider-ldap/provider-ldap.component.ts
@@ -0,0 +1,264 @@
+import { Location } from '@angular/common';
+import { Component, Injector, Type } from '@angular/core';
+import { AbstractControl, FormControl, FormGroup } from '@angular/forms';
+import { ActivatedRoute } from '@angular/router';
+import { Duration } from 'google-protobuf/google/protobuf/duration_pb';
+import { take } from 'rxjs';
+import {
+ AddLDAPProviderRequest as AdminAddLDAPProviderRequest,
+ GetProviderByIDRequest as AdminGetProviderByIDRequest,
+ UpdateLDAPProviderRequest as AdminUpdateLDAPProviderRequest,
+} from 'src/app/proto/generated/zitadel/admin_pb';
+import { LDAPAttributes, Options, Provider } from 'src/app/proto/generated/zitadel/idp_pb';
+import {
+ AddLDAPProviderRequest as MgmtAddLDAPProviderRequest,
+ GetProviderByIDRequest as MgmtGetProviderByIDRequest,
+ UpdateLDAPProviderRequest as MgmtUpdateLDAPProviderRequest,
+} from 'src/app/proto/generated/zitadel/management_pb';
+import { AdminService } from 'src/app/services/admin.service';
+import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/breadcrumb.service';
+import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
+import { ManagementService } from 'src/app/services/mgmt.service';
+import { ToastService } from 'src/app/services/toast.service';
+import { requiredValidator } from '../../form-field/validators/validators';
+
+import { PolicyComponentServiceType } from '../../policies/policy-component-types.enum';
+
+@Component({
+ selector: 'cnsl-provider-ldap',
+ templateUrl: './provider-ldap.component.html',
+})
+export class ProviderLDAPComponent {
+ public updateBindPassword: boolean = false;
+ public showAttributes: boolean = false;
+ public showOptional: boolean = false;
+ public options: Options = new Options().setIsCreationAllowed(true).setIsLinkingAllowed(true);
+ public attributes: LDAPAttributes = new LDAPAttributes();
+ public id: string | null = '';
+ public serviceType: PolicyComponentServiceType = PolicyComponentServiceType.MGMT;
+ private service!: ManagementService | AdminService;
+
+ public form!: FormGroup;
+
+ public loading: boolean = false;
+
+ public provider?: Provider.AsObject;
+
+ constructor(
+ private authService: GrpcAuthService,
+ private route: ActivatedRoute,
+ private toast: ToastService,
+ private injector: Injector,
+ private _location: Location,
+ private breadcrumbService: BreadcrumbService,
+ ) {
+ this.form = new FormGroup({
+ name: new FormControl('', [requiredValidator]),
+ serversList: new FormControl('', [requiredValidator]),
+ baseDn: new FormControl('', [requiredValidator]),
+ bindDn: new FormControl('', [requiredValidator]),
+ bindPassword: new FormControl('', [requiredValidator]),
+ userBase: new FormControl('', [requiredValidator]),
+ userFiltersList: new FormControl('', [requiredValidator]),
+ userObjectClassesList: new FormControl('', [requiredValidator]),
+ timeout: new FormControl(0),
+ startTls: new FormControl(false),
+ });
+
+ this.authService
+ .isAllowed(
+ this.serviceType === PolicyComponentServiceType.ADMIN
+ ? ['iam.idp.write']
+ : this.serviceType === PolicyComponentServiceType.MGMT
+ ? ['org.idp.write']
+ : [],
+ )
+ .pipe(take(1))
+ .subscribe((allowed) => {
+ if (allowed) {
+ this.form.enable();
+ } else {
+ this.form.disable();
+ }
+ });
+
+ this.route.data.pipe(take(1)).subscribe((data) => {
+ this.serviceType = data.serviceType;
+
+ switch (this.serviceType) {
+ case PolicyComponentServiceType.MGMT:
+ this.service = this.injector.get(ManagementService as Type);
+
+ const bread: Breadcrumb = {
+ type: BreadcrumbType.ORG,
+ routerLink: ['/org'],
+ };
+
+ this.breadcrumbService.setBreadcrumb([bread]);
+ break;
+ case PolicyComponentServiceType.ADMIN:
+ this.service = this.injector.get(AdminService as Type);
+
+ const iamBread = new Breadcrumb({
+ type: BreadcrumbType.ORG,
+ name: 'Instance',
+ routerLink: ['/instance'],
+ });
+ this.breadcrumbService.setBreadcrumb([iamBread]);
+ break;
+ }
+
+ this.id = this.route.snapshot.paramMap.get('id');
+ if (this.id) {
+ this.getData(this.id);
+ this.bindPassword?.setValidators([]);
+ }
+ });
+ }
+
+ private getData(id: string): void {
+ const req =
+ this.serviceType === PolicyComponentServiceType.ADMIN
+ ? new AdminGetProviderByIDRequest()
+ : new MgmtGetProviderByIDRequest();
+ req.setId(id);
+ this.service
+ .getProviderByID(req)
+ .then((resp) => {
+ this.provider = resp.idp;
+ this.loading = false;
+ if (this.provider?.config?.ldap) {
+ this.form.patchValue(this.provider.config.ldap);
+ this.name?.setValue(this.provider.name);
+ this.timeout?.setValue(this.provider.config.ldap.timeout?.seconds);
+ }
+ })
+ .catch((error) => {
+ this.toast.showError(error);
+ this.loading = false;
+ });
+ }
+
+ public submitForm(): void {
+ this.provider ? this.updateLDAPProvider() : this.addLDAPProvider();
+ }
+
+ public addLDAPProvider(): void {
+ const req =
+ this.serviceType === PolicyComponentServiceType.MGMT
+ ? new MgmtAddLDAPProviderRequest()
+ : new AdminAddLDAPProviderRequest();
+
+ req.setName(this.name?.value);
+ req.setProviderOptions(this.options);
+ req.setAttributes(this.attributes);
+
+ req.setBaseDn(this.baseDn?.value);
+ req.setBindDn(this.bindDn?.value);
+ req.setBindPassword(this.bindPassword?.value);
+ req.setServersList(this.serversList?.value); // list
+ req.setStartTls(this.startTls?.value);
+ req.setTimeout(new Duration().setSeconds(this.timeout?.value ?? 0));
+ req.setUserBase(this.userBase?.value);
+ req.setUserFiltersList(this.userFiltersList?.value); // list
+ req.setUserObjectClassesList(this.userObjectClassesList?.value); // list
+
+ this.loading = true;
+ (this.service as ManagementService)
+ .addLDAPProvider(req)
+ .then((idp) => {
+ setTimeout(() => {
+ this.loading = false;
+ this.close();
+ }, 2000);
+ })
+ .catch((error) => {
+ this.toast.showError(error);
+ this.loading = false;
+ });
+ }
+
+ public updateLDAPProvider(): void {
+ if (this.provider) {
+ const req =
+ this.serviceType === PolicyComponentServiceType.MGMT
+ ? new MgmtUpdateLDAPProviderRequest()
+ : new AdminUpdateLDAPProviderRequest();
+ req.setId(this.provider.id);
+ req.setName(this.name?.value);
+ req.setProviderOptions(this.options);
+
+ req.setAttributes(this.attributes);
+
+ req.setBaseDn(this.baseDn?.value);
+ req.setBindDn(this.bindDn?.value);
+ if (this.updateBindPassword) {
+ req.setBindPassword(this.bindPassword?.value);
+ }
+ req.setServersList(this.serversList?.value);
+ req.setStartTls(this.startTls?.value);
+ req.setTimeout(new Duration().setSeconds(this.timeout?.value ?? 0));
+ req.setUserBase(this.userBase?.value);
+ req.setUserFiltersList(this.userFiltersList?.value);
+ req.setUserObjectClassesList(this.userObjectClassesList?.value);
+
+ this.loading = true;
+ (this.service as ManagementService)
+ .updateLDAPProvider(req)
+ .then((idp) => {
+ setTimeout(() => {
+ this.loading = false;
+ this.close();
+ }, 2000);
+ })
+ .catch((error) => {
+ this.toast.showError(error);
+ this.loading = false;
+ });
+ }
+ }
+
+ public close(): void {
+ this._location.back();
+ }
+
+ public get name(): AbstractControl | null {
+ return this.form.get('name');
+ }
+
+ public get baseDn(): AbstractControl | null {
+ return this.form.get('baseDn');
+ }
+
+ public get bindDn(): AbstractControl | null {
+ return this.form.get('bindDn');
+ }
+
+ public get bindPassword(): AbstractControl | null {
+ return this.form.get('bindPassword');
+ }
+
+ public get serversList(): AbstractControl | null {
+ return this.form.get('serversList');
+ }
+
+ public get startTls(): AbstractControl | null {
+ return this.form.get('startTls');
+ }
+
+ public get timeout(): AbstractControl | null {
+ return this.form.get('timeout');
+ }
+
+ public get userBase(): AbstractControl | null {
+ return this.form.get('userBase');
+ }
+
+ public get userFiltersList(): AbstractControl | null {
+ return this.form.get('userFiltersList');
+ }
+
+ public get userObjectClassesList(): AbstractControl | null {
+ return this.form.get('userObjectClassesList');
+ }
+}
diff --git a/console/src/app/modules/providers/provider-oauth/provider-oauth-routing.module.ts b/console/src/app/modules/providers/provider-oauth/provider-oauth-routing.module.ts
deleted file mode 100644
index 326108faf..000000000
--- a/console/src/app/modules/providers/provider-oauth/provider-oauth-routing.module.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { NgModule } from '@angular/core';
-import { RouterModule, Routes } from '@angular/router';
-
-import { ProviderOAuthComponent } from './provider-oauth.component';
-
-const routes: Routes = [
- {
- path: '',
- component: ProviderOAuthComponent,
- data: { animation: 'DetailPage' },
- },
-];
-
-@NgModule({
- imports: [RouterModule.forChild(routes)],
- exports: [RouterModule],
-})
-export class ProviderOAuthRoutingModule {}
diff --git a/console/src/app/modules/providers/provider-oauth/provider-oauth.component.html b/console/src/app/modules/providers/provider-oauth/provider-oauth.component.html
index c18544ae0..b88aece27 100644
--- a/console/src/app/modules/providers/provider-oauth/provider-oauth.component.html
+++ b/console/src/app/modules/providers/provider-oauth/provider-oauth.component.html
@@ -101,7 +101,13 @@
-
+
{{ 'ACTIONS.SAVE' | translate }}
{{ 'ACTIONS.CREATE' | translate }}
diff --git a/console/src/app/modules/providers/provider-oauth/provider-oauth.component.ts b/console/src/app/modules/providers/provider-oauth/provider-oauth.component.ts
index 598b84573..e789e89eb 100644
--- a/console/src/app/modules/providers/provider-oauth/provider-oauth.component.ts
+++ b/console/src/app/modules/providers/provider-oauth/provider-oauth.component.ts
@@ -3,7 +3,7 @@ import { Location } from '@angular/common';
import { Component, Injector, Type } from '@angular/core';
import { AbstractControl, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
import { MatLegacyChipInputEvent as MatChipInputEvent } from '@angular/material/legacy-chips';
-import { ActivatedRoute, Router } from '@angular/router';
+import { ActivatedRoute } from '@angular/router';
import { take } from 'rxjs';
import {
AddGenericOAuthProviderRequest as AdminAddGenericOAuthProviderRequest,
@@ -18,6 +18,7 @@ import {
} from 'src/app/proto/generated/zitadel/management_pb';
import { AdminService } from 'src/app/services/admin.service';
import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/breadcrumb.service';
+import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
import { ManagementService } from 'src/app/services/mgmt.service';
import { ToastService } from 'src/app/services/toast.service';
import { requiredValidator } from '../../form-field/validators/validators';
@@ -44,7 +45,7 @@ export class ProviderOAuthComponent {
public provider?: Provider.AsObject;
constructor(
- private router: Router,
+ private authService: GrpcAuthService,
private route: ActivatedRoute,
private toast: ToastService,
private injector: Injector,
@@ -62,6 +63,23 @@ export class ProviderOAuthComponent {
scopesList: new UntypedFormControl(['openid', 'profile', 'email'], []),
});
+ this.authService
+ .isAllowed(
+ this.serviceType === PolicyComponentServiceType.ADMIN
+ ? ['iam.idp.write']
+ : this.serviceType === PolicyComponentServiceType.MGMT
+ ? ['org.idp.write']
+ : [],
+ )
+ .pipe(take(1))
+ .subscribe((allowed) => {
+ if (allowed) {
+ this.form.enable();
+ } else {
+ this.form.disable();
+ }
+ });
+
this.route.data.pipe(take(1)).subscribe((data) => {
this.serviceType = data.serviceType;
diff --git a/console/src/app/modules/providers/provider-oauth/provider-oauth.module.ts b/console/src/app/modules/providers/provider-oauth/provider-oauth.module.ts
deleted file mode 100644
index 0cbe33470..000000000
--- a/console/src/app/modules/providers/provider-oauth/provider-oauth.module.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import { CommonModule } from '@angular/common';
-import { NgModule } from '@angular/core';
-import { FormsModule, ReactiveFormsModule } from '@angular/forms';
-import { MatIconModule } from '@angular/material/icon';
-import { MatLegacyButtonModule as MatButtonModule } from '@angular/material/legacy-button';
-import { MatLegacyCheckboxModule as MatCheckboxModule } from '@angular/material/legacy-checkbox';
-import { MatLegacyChipsModule as MatChipsModule } from '@angular/material/legacy-chips';
-import { MatLegacyProgressSpinnerModule } from '@angular/material/legacy-progress-spinner';
-import { MatLegacySelectModule as MatSelectModule } from '@angular/material/legacy-select';
-import { MatLegacyTooltipModule as MatTooltipModule } from '@angular/material/legacy-tooltip';
-import { TranslateModule } from '@ngx-translate/core';
-import { InputModule } from 'src/app/modules/input/input.module';
-
-import { CardModule } from '../../card/card.module';
-import { CreateLayoutModule } from '../../create-layout/create-layout.module';
-import { InfoSectionModule } from '../../info-section/info-section.module';
-import { ProviderOptionsModule } from '../../provider-options/provider-options.module';
-import { ProviderOAuthRoutingModule } from './provider-oauth-routing.module';
-import { ProviderOAuthComponent } from './provider-oauth.component';
-
-@NgModule({
- declarations: [ProviderOAuthComponent],
- imports: [
- ProviderOAuthRoutingModule,
- CommonModule,
- FormsModule,
- ReactiveFormsModule,
- CreateLayoutModule,
- InfoSectionModule,
- InputModule,
- MatButtonModule,
- MatSelectModule,
- MatIconModule,
- MatChipsModule,
- CardModule,
- MatCheckboxModule,
- MatTooltipModule,
- TranslateModule,
- ProviderOptionsModule,
- MatLegacyProgressSpinnerModule,
- ],
-})
-export default class ProviderOAuthModule {}
diff --git a/console/src/app/modules/providers/provider-oidc/provider-oidc-routing.module.ts b/console/src/app/modules/providers/provider-oidc/provider-oidc-routing.module.ts
deleted file mode 100644
index c42248bd3..000000000
--- a/console/src/app/modules/providers/provider-oidc/provider-oidc-routing.module.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { NgModule } from '@angular/core';
-import { RouterModule, Routes } from '@angular/router';
-
-import { ProviderOIDCComponent } from './provider-oidc.component';
-
-const routes: Routes = [
- {
- path: '',
- component: ProviderOIDCComponent,
- data: { animation: 'DetailPage' },
- },
-];
-
-@NgModule({
- imports: [RouterModule.forChild(routes)],
- exports: [RouterModule],
-})
-export class ProviderOIDCRoutingModule {}
diff --git a/console/src/app/modules/providers/provider-oidc/provider-oidc.component.html b/console/src/app/modules/providers/provider-oidc/provider-oidc.component.html
index 49805f440..a33b4aa3d 100644
--- a/console/src/app/modules/providers/provider-oidc/provider-oidc.component.html
+++ b/console/src/app/modules/providers/provider-oidc/provider-oidc.component.html
@@ -11,7 +11,7 @@
{{ 'IDP.CREATE.OIDC.DESCRIPTION' | translate }}
-