mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-13 19:02:15 +00:00
feat(console): grpc web interceptors, cleanup services (#631)
* managementservice, authservice, change all refs * refactor grpc auth * fix references * interceptor logic * new interceptor * appinitializers, environment loader, interceptors * remove circular dep * init authconfig in grpc service * authconfig * lint * update mgmt service * fix references * update clientid, fix interceptor * rm unused authconfig * todo auth interceptor
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
@@ -8,9 +8,8 @@ import { AuthService } from 'src/app/services/auth.service';
|
||||
})
|
||||
export class HomeComponent {
|
||||
public dark: boolean = true;
|
||||
constructor(public authService: AuthService) {
|
||||
constructor(public authService: GrpcAuthService) {
|
||||
const theme = localStorage.getItem('theme');
|
||||
this.dark = theme === 'dark-theme' ? true : theme === 'light-theme' ? false : true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ import { lowerCaseValidator, numberValidator, symbolValidator, upperCaseValidato
|
||||
import { CreateOrgRequest, CreateUserRequest, Gender, OrgSetUpResponse } from 'src/app/proto/generated/admin_pb';
|
||||
import { PasswordComplexityPolicy } from 'src/app/proto/generated/auth_pb';
|
||||
import { AdminService } from 'src/app/services/admin.service';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { OrgService } from 'src/app/services/org.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';
|
||||
|
||||
function passwordConfirmValidator(c: AbstractControl): any {
|
||||
@@ -67,8 +67,8 @@ export class OrgCreateComponent {
|
||||
private adminService: AdminService,
|
||||
private _location: Location,
|
||||
private fb: FormBuilder,
|
||||
private orgService: OrgService,
|
||||
private authService: AuthService,
|
||||
private mgmtService: ManagementService,
|
||||
private authService: GrpcAuthService,
|
||||
) {
|
||||
this.authService.isAllowed(['iam.write']).pipe(take(1)).subscribe((allowed) => {
|
||||
if (allowed) {
|
||||
@@ -139,7 +139,7 @@ export class OrgCreateComponent {
|
||||
const validators: Validators[] = [Validators.required];
|
||||
|
||||
if (this.usePassword) {
|
||||
this.orgService.GetDefaultPasswordComplexityPolicy().then(data => {
|
||||
this.mgmtService.GetDefaultPasswordComplexityPolicy().then(data => {
|
||||
this.policy = data.toObject();
|
||||
|
||||
if (this.policy.minLength) {
|
||||
@@ -194,7 +194,7 @@ export class OrgCreateComponent {
|
||||
|
||||
public createOrgForSelf(): void {
|
||||
if (this.name && this.name.value) {
|
||||
this.orgService.CreateOrg(this.name.value).then((org) => {
|
||||
this.mgmtService.CreateOrg(this.name.value).then((org) => {
|
||||
this.router.navigate(['orgs', org.toObject().id]);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Component, Inject } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { saveAs } from 'file-saver';
|
||||
import { OrgDomainValidationResponse, OrgDomainValidationType, OrgDomainView } from 'src/app/proto/generated/management_pb';
|
||||
import { OrgService } from 'src/app/services/org.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
@@ -23,19 +23,19 @@ export class DomainVerificationComponent {
|
||||
private toast: ToastService,
|
||||
public dialogRef: MatDialogRef<DomainVerificationComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
private orgService: OrgService,
|
||||
private mgmtService: ManagementService,
|
||||
) {
|
||||
this.domain = data.domain;
|
||||
}
|
||||
|
||||
async loadHttpToken(): Promise<void> {
|
||||
this.http = (await this.orgService.GenerateMyOrgDomainValidation(
|
||||
this.http = (await this.mgmtService.GenerateMyOrgDomainValidation(
|
||||
this.domain.domain,
|
||||
OrgDomainValidationType.ORGDOMAINVALIDATIONTYPE_HTTP)).toObject();
|
||||
}
|
||||
|
||||
async loadDnsToken(): Promise<void> {
|
||||
this.dns = (await this.orgService.GenerateMyOrgDomainValidation(
|
||||
this.dns = (await this.mgmtService.GenerateMyOrgDomainValidation(
|
||||
this.domain.domain,
|
||||
OrgDomainValidationType.ORGDOMAINVALIDATIONTYPE_DNS)).toObject();
|
||||
}
|
||||
@@ -45,7 +45,7 @@ export class DomainVerificationComponent {
|
||||
}
|
||||
|
||||
public validate(): void {
|
||||
this.orgService.ValidateMyOrgDomain(this.domain.domain).then(() => {
|
||||
this.mgmtService.ValidateMyOrgDomain(this.domain.domain).then(() => {
|
||||
this.dialogRef.close(false);
|
||||
}).catch((error) => {
|
||||
this.toast.showError(error);
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
OrgState,
|
||||
User,
|
||||
} from 'src/app/proto/generated/management_pb';
|
||||
import { OrgService } from 'src/app/services/org.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
import { AddDomainDialogComponent } from './add-domain-dialog/add-domain-dialog.component';
|
||||
@@ -56,7 +56,7 @@ export class OrgDetailComponent implements OnInit, OnDestroy {
|
||||
constructor(
|
||||
private dialog: MatDialog,
|
||||
public translate: TranslateService,
|
||||
private orgService: OrgService,
|
||||
private mgmtService: ManagementService,
|
||||
private toast: ToastService,
|
||||
private router: Router,
|
||||
) { }
|
||||
@@ -70,14 +70,14 @@ export class OrgDetailComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
private async getData(): Promise<void> {
|
||||
this.orgService.GetMyOrg().then((org: Org) => {
|
||||
this.mgmtService.GetMyOrg().then((org: Org) => {
|
||||
this.org = org.toObject();
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
|
||||
this.loadingSubject.next(true);
|
||||
from(this.orgService.SearchMyOrgMembers(100, 0)).pipe(
|
||||
from(this.mgmtService.SearchMyOrgMembers(100, 0)).pipe(
|
||||
map(resp => {
|
||||
this.totalMemberResult = resp.toObject().totalResult;
|
||||
return resp.toObject().resultList;
|
||||
@@ -88,7 +88,7 @@ export class OrgDetailComponent implements OnInit, OnDestroy {
|
||||
this.membersSubject.next(members);
|
||||
});
|
||||
|
||||
this.orgService.SearchMyOrgDomains(0, 100).then(result => {
|
||||
this.mgmtService.SearchMyOrgDomains(0, 100).then(result => {
|
||||
this.domains = result.toObject().resultList;
|
||||
this.primaryDomain = this.domains.find(domain => domain.primary)?.domain ?? '';
|
||||
});
|
||||
@@ -96,13 +96,13 @@ export class OrgDetailComponent implements OnInit, OnDestroy {
|
||||
|
||||
public changeState(event: MatButtonToggleChange | any): void {
|
||||
if (event.value === OrgState.ORGSTATE_ACTIVE) {
|
||||
this.orgService.ReactivateMyOrg().then(() => {
|
||||
this.mgmtService.ReactivateMyOrg().then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.REACTIVATED', true);
|
||||
}).catch((error) => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
} else if (event.value === OrgState.ORGSTATE_INACTIVE) {
|
||||
this.orgService.DeactivateMyOrg().then(() => {
|
||||
this.mgmtService.DeactivateMyOrg().then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.DEACTIVATED', true);
|
||||
}).catch((error) => {
|
||||
this.toast.showError(error);
|
||||
@@ -118,7 +118,7 @@ export class OrgDetailComponent implements OnInit, OnDestroy {
|
||||
|
||||
dialogRef.afterClosed().subscribe(resp => {
|
||||
if (resp) {
|
||||
this.orgService.AddMyOrgDomain(resp).then(domain => {
|
||||
this.mgmtService.AddMyOrgDomain(resp).then(domain => {
|
||||
const newDomain = domain;
|
||||
|
||||
const newDomainView = new OrgDomainView();
|
||||
@@ -150,7 +150,7 @@ export class OrgDetailComponent implements OnInit, OnDestroy {
|
||||
|
||||
dialogRef.afterClosed().subscribe(resp => {
|
||||
if (resp) {
|
||||
this.orgService.RemoveMyOrgDomain(domain).then(() => {
|
||||
this.mgmtService.RemoveMyOrgDomain(domain).then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.DOMAINREMOVED', true);
|
||||
const index = this.domains.findIndex(d => d.domain === domain);
|
||||
if (index > -1) {
|
||||
@@ -178,7 +178,7 @@ export class OrgDetailComponent implements OnInit, OnDestroy {
|
||||
|
||||
if (users && users.length && roles && roles.length) {
|
||||
Promise.all(users.map(user => {
|
||||
return this.orgService.AddMyOrgMember(user.id, roles);
|
||||
return this.mgmtService.AddMyOrgMember(user.id, roles);
|
||||
})).then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.MEMBERADDED', true);
|
||||
}).catch(error => {
|
||||
|
||||
@@ -4,8 +4,7 @@ import { Router } from '@angular/router';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { switchMap, take } from 'rxjs/operators';
|
||||
import { Org } from 'src/app/proto/generated/auth_pb';
|
||||
import { AuthUserService } from 'src/app/services/auth-user.service';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
@@ -24,15 +23,14 @@ export class OrgGridComponent {
|
||||
public notPinned: Array<Org.AsObject> = [];
|
||||
|
||||
constructor(
|
||||
public authService: AuthService,
|
||||
private userService: AuthUserService,
|
||||
private userService: GrpcAuthService,
|
||||
private toast: ToastService,
|
||||
private router: Router,
|
||||
) {
|
||||
this.loading = true;
|
||||
this.getData(10, 0);
|
||||
|
||||
this.authService.GetActiveOrg().then(org => this.activeOrg = org);
|
||||
this.userService.GetActiveOrg().then(org => this.activeOrg = org);
|
||||
|
||||
this.selection.changed.subscribe(selection => {
|
||||
this.setPrefixedItem('pinned-orgs', JSON.stringify(
|
||||
@@ -71,7 +69,7 @@ export class OrgGridComponent {
|
||||
}
|
||||
|
||||
private getPrefixedItem(key: string): Observable<string | null> {
|
||||
return this.authService.user.pipe(
|
||||
return this.userService.user.pipe(
|
||||
take(1),
|
||||
switchMap(user => {
|
||||
return of(localStorage.getItem(`${user.id}:${key}`));
|
||||
@@ -80,7 +78,7 @@ export class OrgGridComponent {
|
||||
}
|
||||
|
||||
private setPrefixedItem(key: string, value: any): Observable<void> {
|
||||
return this.authService.user.pipe(
|
||||
return this.userService.user.pipe(
|
||||
take(1),
|
||||
switchMap(user => {
|
||||
return of(localStorage.setItem(`${user.id}:${key}`, value));
|
||||
@@ -103,7 +101,7 @@ export class OrgGridComponent {
|
||||
|
||||
public selectOrg(item: Org.AsObject, event?: any): void {
|
||||
if (event && !event.target.classList.contains('mat-icon')) {
|
||||
this.authService.setActiveOrg(item);
|
||||
this.userService.setActiveOrg(item);
|
||||
this.routeToOrg(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Component, ElementRef, EventEmitter, Output, ViewChild } from '@angular/core';
|
||||
import { FormControl } from '@angular/forms';
|
||||
import { MatAutocomplete } from '@angular/material/autocomplete';
|
||||
import { OrgService } from 'src/app/services/org.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
@@ -18,8 +18,8 @@ export class OrgMemberRolesAutocompleteComponent {
|
||||
@ViewChild('nameInput') public nameInput!: ElementRef<HTMLInputElement>;
|
||||
@ViewChild('auto') public matAutocomplete!: MatAutocomplete;
|
||||
@Output() public selectionChanged: EventEmitter<string[]> = new EventEmitter();
|
||||
constructor(private orgService: OrgService, private toast: ToastService) {
|
||||
this.orgService.GetOrgMemberRoles().then(resp => {
|
||||
constructor(private mgmtService: ManagementService, private toast: ToastService) {
|
||||
this.mgmtService.GetOrgMemberRoles().then(resp => {
|
||||
this.allRoles = resp.toObject().rolesList;
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Timestamp } from 'google-protobuf/google/protobuf/timestamp_pb';
|
||||
import { BehaviorSubject, from, Observable, of } from 'rxjs';
|
||||
import { catchError, finalize, map } from 'rxjs/operators';
|
||||
import { OrgMemberView } from 'src/app/proto/generated/management_pb';
|
||||
import { OrgService } from 'src/app/services/org.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
|
||||
export class OrgMembersDataSource extends DataSource<OrgMemberView.AsObject> {
|
||||
public totalResult: number = 0;
|
||||
@@ -12,7 +12,7 @@ export class OrgMembersDataSource extends DataSource<OrgMemberView.AsObject> {
|
||||
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
||||
|
||||
constructor(private orgService: OrgService) {
|
||||
constructor(private mgmtService: ManagementService) {
|
||||
super();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ export class OrgMembersDataSource extends DataSource<OrgMemberView.AsObject> {
|
||||
const offset = pageIndex * pageSize;
|
||||
|
||||
this.loadingSubject.next(true);
|
||||
from(this.orgService.SearchMyOrgMembers(pageSize, offset)).pipe(
|
||||
from(this.mgmtService.SearchMyOrgMembers(pageSize, offset)).pipe(
|
||||
map(resp => {
|
||||
const response = resp.toObject();
|
||||
this.totalResult = response.totalResult;
|
||||
|
||||
@@ -6,7 +6,7 @@ import { MatSelectChange } from '@angular/material/select';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { CreationType, MemberCreateDialogComponent } from 'src/app/modules/add-member-dialog/member-create-dialog.component';
|
||||
import { Org, OrgMemberView, ProjectType, User } from 'src/app/proto/generated/management_pb';
|
||||
import { OrgService } from 'src/app/services/org.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
import { OrgMembersDataSource } from './org-members-datasource';
|
||||
@@ -30,13 +30,13 @@ export class OrgMembersComponent implements AfterViewInit {
|
||||
public displayedColumns: string[] = ['select', 'firstname', 'lastname', 'username', 'email', 'roles'];
|
||||
|
||||
constructor(
|
||||
private orgService: OrgService,
|
||||
private mgmtService: ManagementService,
|
||||
private dialog: MatDialog,
|
||||
private toast: ToastService,
|
||||
) {
|
||||
this.orgService.GetMyOrg().then(org => {
|
||||
this.mgmtService.GetMyOrg().then(org => {
|
||||
this.org = org.toObject();
|
||||
this.dataSource = new OrgMembersDataSource(this.orgService);
|
||||
this.dataSource = new OrgMembersDataSource(this.mgmtService);
|
||||
this.dataSource.loadMembers(0, 25);
|
||||
});
|
||||
|
||||
@@ -52,7 +52,7 @@ export class OrgMembersComponent implements AfterViewInit {
|
||||
}
|
||||
|
||||
public getRoleOptions(): void {
|
||||
this.orgService.GetOrgMemberRoles().then(resp => {
|
||||
this.mgmtService.GetOrgMemberRoles().then(resp => {
|
||||
this.memberRoleOptions = resp.toObject().rolesList;
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
@@ -60,7 +60,7 @@ export class OrgMembersComponent implements AfterViewInit {
|
||||
}
|
||||
|
||||
updateRoles(member: OrgMemberView.AsObject, selectionChange: MatSelectChange): void {
|
||||
this.orgService.ChangeMyOrgMember(member.userId, selectionChange.value)
|
||||
this.mgmtService.ChangeMyOrgMember(member.userId, selectionChange.value)
|
||||
.then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.MEMBERCHANGED', true);
|
||||
}).catch(error => {
|
||||
@@ -77,7 +77,7 @@ export class OrgMembersComponent implements AfterViewInit {
|
||||
|
||||
public removeProjectMemberSelection(): void {
|
||||
Promise.all(this.selection.selected.map(member => {
|
||||
return this.orgService.RemoveMyOrgMember(member.userId).then(() => {
|
||||
return this.mgmtService.RemoveMyOrgMember(member.userId).then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.MEMBERREMOVED', true);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
@@ -112,7 +112,7 @@ export class OrgMembersComponent implements AfterViewInit {
|
||||
|
||||
if (users && users.length && roles && roles.length) {
|
||||
Promise.all(users.map(user => {
|
||||
return this.orgService.AddMyOrgMember(user.id, roles);
|
||||
return this.mgmtService.AddMyOrgMember(user.id, roles);
|
||||
})).then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.MEMBERADDED', true);
|
||||
}).catch(error => {
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
PasswordLockoutPolicy,
|
||||
} from 'src/app/proto/generated/management_pb';
|
||||
import { AdminService } from 'src/app/services/admin.service';
|
||||
import { OrgService } from 'src/app/services/org.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { StorageService } from 'src/app/services/storage.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@@ -55,7 +55,7 @@ export class PasswordPolicyComponent implements OnInit, OnDestroy {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private adminService: AdminService,
|
||||
private orgService: OrgService,
|
||||
private mgmtService: ManagementService,
|
||||
private router: Router,
|
||||
private toast: ToastService,
|
||||
private sessionStorage: StorageService,
|
||||
@@ -121,40 +121,40 @@ export class PasswordPolicyComponent implements OnInit, OnDestroy {
|
||||
case PolicyComponentType.LOCKOUT:
|
||||
this.title = 'ORG.POLICY.PWD_LOCKOUT.TITLE';
|
||||
this.desc = 'ORG.POLICY.PWD_LOCKOUT.DESCRIPTION';
|
||||
return this.orgService.GetPasswordLockoutPolicy();
|
||||
return this.mgmtService.GetPasswordLockoutPolicy();
|
||||
case PolicyComponentType.AGE:
|
||||
this.title = 'ORG.POLICY.PWD_AGE.TITLE';
|
||||
this.desc = 'ORG.POLICY.PWD_AGE.DESCRIPTION';
|
||||
return this.orgService.GetPasswordAgePolicy();
|
||||
return this.mgmtService.GetPasswordAgePolicy();
|
||||
case PolicyComponentType.COMPLEXITY:
|
||||
this.title = 'ORG.POLICY.PWD_COMPLEXITY.TITLE';
|
||||
this.desc = 'ORG.POLICY.PWD_COMPLEXITY.DESCRIPTION';
|
||||
return this.orgService.GetPasswordComplexityPolicy();
|
||||
return this.mgmtService.GetPasswordComplexityPolicy();
|
||||
case PolicyComponentType.IAM_POLICY:
|
||||
this.title = 'ORG.POLICY.IAM_POLICY.TITLECREATE';
|
||||
this.desc = 'ORG.POLICY.IAM_POLICY.DESCRIPTIONCREATE';
|
||||
return this.orgService.GetMyOrgIamPolicy();
|
||||
return this.mgmtService.GetMyOrgIamPolicy();
|
||||
}
|
||||
}
|
||||
|
||||
public deletePolicy(): void {
|
||||
switch (this.policyType) {
|
||||
case PolicyComponentType.LOCKOUT:
|
||||
this.orgService.DeletePasswordLockoutPolicy(this.lockoutData.id).then(() => {
|
||||
this.mgmtService.DeletePasswordLockoutPolicy(this.lockoutData.id).then(() => {
|
||||
this.toast.showInfo('Successfully deleted');
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
break;
|
||||
case PolicyComponentType.AGE:
|
||||
this.orgService.DeletePasswordAgePolicy(this.ageData.id).then(() => {
|
||||
this.mgmtService.DeletePasswordAgePolicy(this.ageData.id).then(() => {
|
||||
this.toast.showInfo('Successfully deleted');
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
break;
|
||||
case PolicyComponentType.COMPLEXITY:
|
||||
this.orgService.DeletePasswordComplexityPolicy(this.complexityData.id).then(() => {
|
||||
this.mgmtService.DeletePasswordComplexityPolicy(this.complexityData.id).then(() => {
|
||||
this.toast.showInfo('Successfully deleted');
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
@@ -215,7 +215,7 @@ export class PasswordPolicyComponent implements OnInit, OnDestroy {
|
||||
if (this.componentAction === PolicyComponentAction.CREATE) {
|
||||
switch (this.policyType) {
|
||||
case PolicyComponentType.LOCKOUT:
|
||||
this.orgService.CreatePasswordLockoutPolicy(
|
||||
this.mgmtService.CreatePasswordLockoutPolicy(
|
||||
this.lockoutData.description,
|
||||
this.lockoutData.maxAttempts,
|
||||
this.lockoutData.showLockOutFailures,
|
||||
@@ -227,7 +227,7 @@ export class PasswordPolicyComponent implements OnInit, OnDestroy {
|
||||
|
||||
break;
|
||||
case PolicyComponentType.AGE:
|
||||
this.orgService.CreatePasswordAgePolicy(
|
||||
this.mgmtService.CreatePasswordAgePolicy(
|
||||
this.ageData.description,
|
||||
this.ageData.maxAgeDays,
|
||||
this.ageData.expireWarnDays,
|
||||
@@ -239,7 +239,7 @@ export class PasswordPolicyComponent implements OnInit, OnDestroy {
|
||||
|
||||
break;
|
||||
case PolicyComponentType.COMPLEXITY:
|
||||
this.orgService.CreatePasswordComplexityPolicy(
|
||||
this.mgmtService.CreatePasswordComplexityPolicy(
|
||||
this.complexityData.description,
|
||||
this.complexityData.hasLowercase,
|
||||
this.complexityData.hasUppercase,
|
||||
@@ -271,7 +271,7 @@ export class PasswordPolicyComponent implements OnInit, OnDestroy {
|
||||
} else if (this.componentAction === PolicyComponentAction.MODIFY) {
|
||||
switch (this.policyType) {
|
||||
case PolicyComponentType.LOCKOUT:
|
||||
this.orgService.UpdatePasswordLockoutPolicy(
|
||||
this.mgmtService.UpdatePasswordLockoutPolicy(
|
||||
this.lockoutData.description,
|
||||
this.lockoutData.maxAttempts,
|
||||
this.lockoutData.showLockOutFailures,
|
||||
@@ -283,7 +283,7 @@ export class PasswordPolicyComponent implements OnInit, OnDestroy {
|
||||
|
||||
break;
|
||||
case PolicyComponentType.AGE:
|
||||
this.orgService.UpdatePasswordAgePolicy(
|
||||
this.mgmtService.UpdatePasswordAgePolicy(
|
||||
this.ageData.description,
|
||||
this.ageData.maxAgeDays,
|
||||
this.ageData.expireWarnDays,
|
||||
@@ -295,7 +295,7 @@ export class PasswordPolicyComponent implements OnInit, OnDestroy {
|
||||
|
||||
break;
|
||||
case PolicyComponentType.COMPLEXITY:
|
||||
this.orgService.UpdatePasswordComplexityPolicy(
|
||||
this.mgmtService.UpdatePasswordComplexityPolicy(
|
||||
this.complexityData.description,
|
||||
this.complexityData.hasLowercase,
|
||||
this.complexityData.hasUppercase,
|
||||
|
||||
@@ -6,8 +6,8 @@ import {
|
||||
PasswordLockoutPolicy,
|
||||
PolicyState,
|
||||
} from 'src/app/proto/generated/management_pb';
|
||||
import { AuthUserService } from 'src/app/services/auth-user.service';
|
||||
import { OrgService } from 'src/app/services/org.service';
|
||||
import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
|
||||
import { PolicyComponentType } from '../password-policy/password-policy.component';
|
||||
|
||||
@@ -26,14 +26,14 @@ export class PolicyGridComponent {
|
||||
public PolicyComponentType: any = PolicyComponentType;
|
||||
|
||||
constructor(
|
||||
private orgService: OrgService,
|
||||
public authUserService: AuthUserService,
|
||||
private mgmtService: ManagementService,
|
||||
public authUserService: GrpcAuthService,
|
||||
) {
|
||||
this.getData();
|
||||
}
|
||||
|
||||
private getData(): void {
|
||||
this.orgService.GetPasswordComplexityPolicy().then(data => this.complexityPolicy = data.toObject());
|
||||
this.orgService.GetMyOrgIamPolicy().then(data => this.iamPolicy = data.toObject());
|
||||
this.mgmtService.GetPasswordComplexityPolicy().then(data => this.complexityPolicy = data.toObject());
|
||||
this.mgmtService.GetMyOrgIamPolicy().then(data => this.iamPolicy = data.toObject());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { MatAutocomplete, MatAutocompleteSelectedEvent } from '@angular/material
|
||||
import { MatChipInputEvent } from '@angular/material/chips';
|
||||
import { debounceTime, tap } from 'rxjs/operators';
|
||||
import { Org } from 'src/app/proto/generated/management_pb';
|
||||
import { OrgService } from 'src/app/services/org.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
@@ -27,9 +27,9 @@ export class SearchOrgAutocompleteComponent {
|
||||
@ViewChild('auto') public matAutocomplete!: MatAutocomplete;
|
||||
@Input() public singleOutput: boolean = false;
|
||||
@Output() public selectionChanged: EventEmitter<Org.AsObject | Org.AsObject[]> = new EventEmitter();
|
||||
constructor(private orgService: OrgService, private toast: ToastService) {
|
||||
constructor(private mgmtService: ManagementService, private toast: ToastService) {
|
||||
this.myControl.valueChanges.pipe(debounceTime(200), tap(() => this.isLoading = true)).subscribe(value => {
|
||||
return this.orgService.getOrgByDomainGlobal(value).then((org) => {
|
||||
return this.mgmtService.getOrgByDomainGlobal(value).then((org) => {
|
||||
this.isLoading = false;
|
||||
if (org) {
|
||||
this.filteredOrgs = [org.toObject()];
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
OIDCGrantType,
|
||||
OIDCResponseType,
|
||||
} from 'src/app/proto/generated/management_pb';
|
||||
import { ProjectService } from 'src/app/services/project.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
import { AppSecretDialogComponent } from '../app-secret-dialog/app-secret-dialog.component';
|
||||
@@ -84,7 +84,7 @@ export class AppCreateComponent implements OnInit, OnDestroy {
|
||||
private route: ActivatedRoute,
|
||||
private toast: ToastService,
|
||||
private dialog: MatDialog,
|
||||
private projectService: ProjectService,
|
||||
private mgmtService: ManagementService,
|
||||
private fb: FormBuilder,
|
||||
private _location: Location,
|
||||
) {
|
||||
@@ -186,7 +186,7 @@ export class AppCreateComponent implements OnInit, OnDestroy {
|
||||
|
||||
public saveOIDCApp(): void {
|
||||
this.loading = true;
|
||||
this.projectService
|
||||
this.mgmtService
|
||||
.CreateOIDCApp(this.oidcApp)
|
||||
.then((data: Application) => {
|
||||
this.loading = false;
|
||||
|
||||
@@ -18,8 +18,7 @@ import {
|
||||
OIDCResponseType,
|
||||
ZitadelDocs,
|
||||
} from 'src/app/proto/generated/management_pb';
|
||||
import { OrgService } from 'src/app/services/org.service';
|
||||
import { ProjectService } from 'src/app/services/project.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
import { AppSecretDialogComponent } from '../app-secret-dialog/app-secret-dialog.component';
|
||||
@@ -88,11 +87,10 @@ export class AppDetailComponent implements OnInit, OnDestroy {
|
||||
public translate: TranslateService,
|
||||
private route: ActivatedRoute,
|
||||
private toast: ToastService,
|
||||
private projectService: ProjectService,
|
||||
private fb: FormBuilder,
|
||||
private _location: Location,
|
||||
private dialog: MatDialog,
|
||||
private orgService: OrgService,
|
||||
private mgmtService: ManagementService,
|
||||
) {
|
||||
this.appNameForm = this.fb.group({
|
||||
state: ['', []],
|
||||
@@ -118,11 +116,11 @@ export class AppDetailComponent implements OnInit, OnDestroy {
|
||||
|
||||
private async getData({ projectid, id }: Params): Promise<void> {
|
||||
this.projectId = projectid;
|
||||
this.orgService.GetIam().then(iam => {
|
||||
this.mgmtService.GetIam().then(iam => {
|
||||
this.isZitadel = iam.toObject().iamProjectId === this.projectId;
|
||||
});
|
||||
|
||||
this.projectService.GetApplicationById(projectid, id).then(app => {
|
||||
this.mgmtService.GetApplicationById(projectid, id).then(app => {
|
||||
this.app = app.toObject();
|
||||
this.appNameForm.patchValue(this.app);
|
||||
|
||||
@@ -151,18 +149,18 @@ export class AppDetailComponent implements OnInit, OnDestroy {
|
||||
this.errorMessage = error.message;
|
||||
});
|
||||
|
||||
this.docs = (await this.projectService.GetZitadelDocs()).toObject();
|
||||
this.docs = (await this.mgmtService.GetZitadelDocs()).toObject();
|
||||
}
|
||||
|
||||
public changeState(event: MatButtonToggleChange): void {
|
||||
if (event.value === AppState.APPSTATE_ACTIVE) {
|
||||
this.projectService.ReactivateApplication(this.projectId, this.app.id).then(() => {
|
||||
this.mgmtService.ReactivateApplication(this.projectId, this.app.id).then(() => {
|
||||
this.toast.showInfo('APP.TOAST.REACTIVATED', true);
|
||||
}).catch((error: any) => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
} else if (event.value === AppState.APPSTATE_INACTIVE) {
|
||||
this.projectService.DeactivateApplication(this.projectId, this.app.id).then(() => {
|
||||
this.mgmtService.DeactivateApplication(this.projectId, this.app.id).then(() => {
|
||||
this.toast.showInfo('APP.TOAST.REACTIVATED', true);
|
||||
}).catch((error: any) => {
|
||||
this.toast.showError(error);
|
||||
@@ -230,7 +228,7 @@ export class AppDetailComponent implements OnInit, OnDestroy {
|
||||
this.app.oidcConfig.postLogoutRedirectUrisList = this.postLogoutRedirectUrisList;
|
||||
this.app.oidcConfig.devMode = this.devMode?.value;
|
||||
|
||||
this.projectService
|
||||
this.mgmtService
|
||||
.UpdateOIDCAppConfig(this.projectId, this.app.id, this.app.oidcConfig)
|
||||
.then(() => {
|
||||
this.toast.showInfo('APP.TOAST.OIDCUPDATED', true);
|
||||
@@ -243,7 +241,7 @@ export class AppDetailComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
public regenerateOIDCClientSecret(): void {
|
||||
this.projectService.RegenerateOIDCClientSecret(this.app.id, this.projectId).then((data: OIDCConfig) => {
|
||||
this.mgmtService.RegenerateOIDCClientSecret(this.app.id, this.projectId).then((data: OIDCConfig) => {
|
||||
this.toast.showInfo('APP.TOAST.OIDCCLIENTSECRETREGENERATED', true);
|
||||
this.dialog.open(AppSecretDialogComponent, {
|
||||
data: {
|
||||
|
||||
@@ -24,8 +24,7 @@ import {
|
||||
User,
|
||||
UserGrantSearchKey,
|
||||
} from 'src/app/proto/generated/management_pb';
|
||||
import { OrgService } from 'src/app/services/org.service';
|
||||
import { ProjectService } from 'src/app/services/project.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
@@ -78,9 +77,8 @@ export class GrantedProjectDetailComponent implements OnInit, OnDestroy {
|
||||
public translate: TranslateService,
|
||||
private route: ActivatedRoute,
|
||||
private toast: ToastService,
|
||||
private projectService: ProjectService,
|
||||
private mgmtService: ManagementService,
|
||||
private _location: Location,
|
||||
private orgService: OrgService,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
) {
|
||||
@@ -98,20 +96,18 @@ export class GrantedProjectDetailComponent implements OnInit, OnDestroy {
|
||||
this.projectId = id;
|
||||
this.grantId = grantId;
|
||||
|
||||
console.log(id, grantId);
|
||||
|
||||
this.orgService.GetIam().then(iam => {
|
||||
this.mgmtService.GetIam().then(iam => {
|
||||
this.isZitadel = iam.toObject().iamProjectId === this.projectId;
|
||||
});
|
||||
|
||||
if (this.projectId && this.grantId) {
|
||||
this.projectService.GetGrantedProjectByID(this.projectId, this.grantId).then(proj => {
|
||||
this.mgmtService.GetGrantedProjectByID(this.projectId, this.grantId).then(proj => {
|
||||
this.project = proj.toObject();
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
|
||||
from(this.projectService.SearchProjectGrantMembers(this.projectId,
|
||||
from(this.mgmtService.SearchProjectGrantMembers(this.projectId,
|
||||
this.grantId, 100, 0)).pipe(
|
||||
map(resp => {
|
||||
this.totalMemberResult = resp.toObject().totalResult;
|
||||
@@ -144,7 +140,7 @@ export class GrantedProjectDetailComponent implements OnInit, OnDestroy {
|
||||
|
||||
if (users && users.length && roles && roles.length) {
|
||||
users.forEach(user => {
|
||||
return this.projectService.AddProjectGrantMember(
|
||||
return this.mgmtService.AddProjectGrantMember(
|
||||
this.projectId,
|
||||
this.grantId,
|
||||
user.id,
|
||||
|
||||
@@ -8,7 +8,7 @@ import { TranslateService } from '@ngx-translate/core';
|
||||
import { Timestamp } from 'google-protobuf/google/protobuf/timestamp_pb';
|
||||
import { BehaviorSubject, Observable, Subscription } from 'rxjs';
|
||||
import { ProjectGrantView } from 'src/app/proto/generated/management_pb';
|
||||
import { ProjectService } from 'src/app/services/project.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
@@ -55,7 +55,7 @@ export class GrantedProjectListComponent implements OnInit, OnDestroy {
|
||||
|
||||
constructor(private router: Router,
|
||||
public translate: TranslateService,
|
||||
private projectService: ProjectService,
|
||||
private mgmtService: ManagementService,
|
||||
private toast: ToastService,
|
||||
) { }
|
||||
|
||||
@@ -89,7 +89,7 @@ export class GrantedProjectListComponent implements OnInit, OnDestroy {
|
||||
|
||||
private async getData(limit: number, offset: number): Promise<void> {
|
||||
this.loadingSubject.next(true);
|
||||
this.projectService.SearchGrantedProjects(limit, offset).then(res => {
|
||||
this.mgmtService.SearchGrantedProjects(limit, offset).then(res => {
|
||||
const response = res.toObject();
|
||||
this.grantedProjectList = response.resultList;
|
||||
this.totalResult = response.totalResult;
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { BehaviorSubject, from, Observable, of } from 'rxjs';
|
||||
import { catchError, finalize, map } from 'rxjs/operators';
|
||||
import { Application } from 'src/app/proto/generated/management_pb';
|
||||
import { ProjectService } from 'src/app/services/project.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-application-grid',
|
||||
@@ -17,14 +17,14 @@ export class ApplicationGridComponent implements OnInit {
|
||||
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(true);
|
||||
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
||||
|
||||
constructor(private projectService: ProjectService) { }
|
||||
constructor(private mgmtService: ManagementService) { }
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.loadApps();
|
||||
}
|
||||
|
||||
public loadApps(): void {
|
||||
from(this.projectService.SearchApplications(this.projectId, 100, 0)).pipe(
|
||||
from(this.mgmtService.SearchApplications(this.projectId, 100, 0)).pipe(
|
||||
map(resp => {
|
||||
return resp.toObject().resultList;
|
||||
}),
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Timestamp } from 'google-protobuf/google/protobuf/timestamp_pb';
|
||||
import { BehaviorSubject, from, Observable, of } from 'rxjs';
|
||||
import { catchError, finalize, map } from 'rxjs/operators';
|
||||
import { Application } from 'src/app/proto/generated/management_pb';
|
||||
import { ProjectService } from 'src/app/services/project.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
|
||||
/**
|
||||
* Data source for the ProjectMembers view. This class should
|
||||
@@ -18,7 +18,7 @@ export class ProjectApplicationsDataSource extends DataSource<Application.AsObje
|
||||
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
||||
|
||||
constructor(private projectService: ProjectService) {
|
||||
constructor(private mgmtService: ManagementService) {
|
||||
super();
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ export class ProjectApplicationsDataSource extends DataSource<Application.AsObje
|
||||
const offset = pageIndex * pageSize;
|
||||
|
||||
this.loadingSubject.next(true);
|
||||
from(this.projectService.SearchApplications(projectId, pageSize, offset)).pipe(
|
||||
from(this.mgmtService.SearchApplications(projectId, pageSize, offset)).pipe(
|
||||
map(resp => {
|
||||
const response = resp.toObject();
|
||||
this.totalResult = response.totalResult;
|
||||
|
||||
@@ -6,7 +6,7 @@ import { MatTable } from '@angular/material/table';
|
||||
import { merge, of } from 'rxjs';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { Application } from 'src/app/proto/generated/management_pb';
|
||||
import { ProjectService } from 'src/app/services/project.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
import { ProjectApplicationsDataSource } from './applications-datasource';
|
||||
@@ -28,10 +28,10 @@ export class ApplicationsComponent implements AfterViewInit, OnInit {
|
||||
|
||||
public displayedColumns: string[] = ['select', 'name'];
|
||||
|
||||
constructor(private projectService: ProjectService, private toast: ToastService) { }
|
||||
constructor(private mgmtService: ManagementService, private toast: ToastService) { }
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.dataSource = new ProjectApplicationsDataSource(this.projectService);
|
||||
this.dataSource = new ProjectApplicationsDataSource(this.mgmtService);
|
||||
this.dataSource.loadApps(this.projectId, 0, 25);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,7 @@ import {
|
||||
UserView,
|
||||
UserGrantSearchKey,
|
||||
} from 'src/app/proto/generated/management_pb';
|
||||
import { OrgService } from 'src/app/services/org.service';
|
||||
import { ProjectService } from 'src/app/services/project.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
@@ -79,9 +78,8 @@ export class OwnedProjectDetailComponent implements OnInit, OnDestroy {
|
||||
public translate: TranslateService,
|
||||
private route: ActivatedRoute,
|
||||
private toast: ToastService,
|
||||
private projectService: ProjectService,
|
||||
private mgmtService: ManagementService,
|
||||
private _location: Location,
|
||||
private orgService: OrgService,
|
||||
private dialog: MatDialog,
|
||||
private router: Router,
|
||||
) {
|
||||
@@ -98,18 +96,18 @@ export class OwnedProjectDetailComponent implements OnInit, OnDestroy {
|
||||
private async getData({ id }: Params): Promise<void> {
|
||||
this.projectId = id;
|
||||
|
||||
this.orgService.GetIam().then(iam => {
|
||||
this.mgmtService.GetIam().then(iam => {
|
||||
this.isZitadel = iam.toObject().iamProjectId === this.projectId;
|
||||
});
|
||||
|
||||
this.projectService.GetProjectById(id).then(proj => {
|
||||
this.mgmtService.GetProjectById(id).then(proj => {
|
||||
this.project = proj.toObject();
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
this.toast.showError(error);
|
||||
});
|
||||
|
||||
from(this.projectService.SearchProjectMembers(this.projectId, 100, 0)).pipe(
|
||||
from(this.mgmtService.SearchProjectMembers(this.projectId, 100, 0)).pipe(
|
||||
map(resp => {
|
||||
this.totalMemberResult = resp.toObject().totalResult;
|
||||
return resp.toObject().resultList;
|
||||
@@ -134,7 +132,7 @@ export class OwnedProjectDetailComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
dialogRef.afterClosed().subscribe(resp => {
|
||||
if (resp) {
|
||||
this.projectService.ReactivateProject(this.projectId).then(() => {
|
||||
this.mgmtService.ReactivateProject(this.projectId).then(() => {
|
||||
this.toast.showInfo('PROJECT.TOAST.REACTIVATED', true);
|
||||
this.project.state = ProjectState.PROJECTSTATE_ACTIVE;
|
||||
}).catch(error => {
|
||||
@@ -155,7 +153,7 @@ export class OwnedProjectDetailComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
dialogRef.afterClosed().subscribe(resp => {
|
||||
if (resp) {
|
||||
this.projectService.DeactivateProject(this.projectId).then(() => {
|
||||
this.mgmtService.DeactivateProject(this.projectId).then(() => {
|
||||
this.toast.showInfo('PROJECT.TOAST.DEACTIVATED', true);
|
||||
this.project.state = ProjectState.PROJECTSTATE_INACTIVE;
|
||||
}).catch(error => {
|
||||
@@ -178,7 +176,7 @@ export class OwnedProjectDetailComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
dialogRef.afterClosed().subscribe(resp => {
|
||||
if (resp) {
|
||||
this.projectService.RemoveProject(this.projectId).then(() => {
|
||||
this.mgmtService.RemoveProject(this.projectId).then(() => {
|
||||
this.toast.showInfo('PROJECT.TOAST.DELETED', true);
|
||||
this.router.navigate(['/projects']);
|
||||
}).catch(error => {
|
||||
@@ -189,7 +187,7 @@ export class OwnedProjectDetailComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
public saveProject(): void {
|
||||
this.projectService.UpdateProject(this.project.projectId, this.project.name).then(() => {
|
||||
this.mgmtService.UpdateProject(this.project.projectId, this.project.name).then(() => {
|
||||
this.toast.showInfo('PROJECT.TOAST.UPDATED', true);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
@@ -221,7 +219,7 @@ export class OwnedProjectDetailComponent implements OnInit, OnDestroy {
|
||||
|
||||
if (users && users.length && roles && roles.length) {
|
||||
users.forEach(user => {
|
||||
return this.projectService.AddProjectMember(this.projectId, user.id, roles)
|
||||
return this.mgmtService.AddProjectMember(this.projectId, user.id, roles)
|
||||
.then(() => {
|
||||
this.toast.showInfo('PROJECT.TOAST.MEMBERADDED', true);
|
||||
}).catch(error => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Timestamp } from 'google-protobuf/google/protobuf/timestamp_pb';
|
||||
import { BehaviorSubject, from, Observable, of } from 'rxjs';
|
||||
import { catchError, finalize, map } from 'rxjs/operators';
|
||||
import { ProjectGrant } from 'src/app/proto/generated/management_pb';
|
||||
import { ProjectService } from 'src/app/services/project.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
|
||||
/**
|
||||
* Data source for the ProjectMembers view. This class should
|
||||
@@ -17,7 +17,7 @@ export class ProjectGrantsDataSource extends DataSource<ProjectGrant.AsObject> {
|
||||
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
||||
|
||||
constructor(private projectService: ProjectService) {
|
||||
constructor(private mgmtService: ManagementService) {
|
||||
super();
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ export class ProjectGrantsDataSource extends DataSource<ProjectGrant.AsObject> {
|
||||
const offset = pageIndex * pageSize;
|
||||
|
||||
this.loadingSubject.next(true);
|
||||
from(this.projectService.SearchProjectGrants(projectId, pageSize, offset)).pipe(
|
||||
from(this.mgmtService.SearchProjectGrants(projectId, pageSize, offset)).pipe(
|
||||
map(resp => {
|
||||
const response = resp.toObject();
|
||||
this.totalResult = response.totalResult;
|
||||
|
||||
@@ -6,7 +6,7 @@ import { MatSelectChange } from '@angular/material/select';
|
||||
import { MatTable } from '@angular/material/table';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { ProjectGrant, ProjectRoleView } from 'src/app/proto/generated/management_pb';
|
||||
import { ProjectService } from 'src/app/services/project.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
import { ProjectGrantsDataSource } from './project-grants-datasource';
|
||||
@@ -35,10 +35,10 @@ export class ProjectGrantsComponent implements OnInit, AfterViewInit {
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
public displayedColumns: string[] = ['select', 'grantedOrgName', 'creationDate', 'changeDate', 'roleNamesList'];
|
||||
|
||||
constructor(private projectService: ProjectService, private toast: ToastService) { }
|
||||
constructor(private mgmtService: ManagementService, private toast: ToastService) { }
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.dataSource = new ProjectGrantsDataSource(this.projectService);
|
||||
this.dataSource = new ProjectGrantsDataSource(this.mgmtService);
|
||||
this.dataSource.loadGrants(this.projectId, 0, 25, 'asc');
|
||||
this.getRoleOptions(this.projectId);
|
||||
}
|
||||
@@ -73,13 +73,13 @@ export class ProjectGrantsComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
public getRoleOptions(projectId: string): void {
|
||||
this.projectService.SearchProjectRoles(projectId, 100, 0).then(resp => {
|
||||
this.mgmtService.SearchProjectRoles(projectId, 100, 0).then(resp => {
|
||||
this.memberRoleOptions = resp.toObject().resultList;
|
||||
});
|
||||
}
|
||||
|
||||
updateRoles(grant: ProjectGrant.AsObject, selectionChange: MatSelectChange): void {
|
||||
this.projectService.UpdateProjectGrant(grant.id, grant.projectId, selectionChange.value)
|
||||
this.mgmtService.UpdateProjectGrant(grant.id, grant.projectId, selectionChange.value)
|
||||
.then((newgrant: ProjectGrant) => {
|
||||
this.toast.showInfo('PROJECT.GRANT.TOAST.PROJECTGRANTCHANGED', true);
|
||||
}).catch(error => {
|
||||
@@ -89,7 +89,7 @@ export class ProjectGrantsComponent implements OnInit, AfterViewInit {
|
||||
|
||||
deleteSelectedGrants(): void {
|
||||
const promises = this.selection.selected.map(grant => {
|
||||
return this.projectService.RemoveProjectGrant(grant.id, grant.projectId);
|
||||
return this.mgmtService.RemoveProjectGrant(grant.id, grant.projectId);
|
||||
});
|
||||
|
||||
Promise.all(promises).then(() => {
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from
|
||||
import { Router } from '@angular/router';
|
||||
import { Org } from 'src/app/proto/generated/auth_pb';
|
||||
import { ProjectState, ProjectType, ProjectView } from 'src/app/proto/generated/management_pb';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { AuthenticationService } from 'src/app/services/authentication.service';
|
||||
import { StorageKey, StorageService } from 'src/app/services/storage.service';
|
||||
|
||||
@Component({
|
||||
@@ -49,7 +49,7 @@ export class OwnedProjectGridComponent implements OnChanges {
|
||||
public ProjectState: any = ProjectState;
|
||||
public ProjectType: any = ProjectType;
|
||||
|
||||
constructor(private router: Router, private authService: AuthService, private storage: StorageService) {
|
||||
constructor(private router: Router, private authService: AuthenticationService, private storage: StorageService) {
|
||||
this.selection.changed.subscribe(selection => {
|
||||
this.setPrefixedItem('pinned-projects', JSON.stringify(
|
||||
this.selection.selected.map(item => item.projectId),
|
||||
|
||||
@@ -8,7 +8,7 @@ import { TranslateService } from '@ngx-translate/core';
|
||||
import { Timestamp } from 'google-protobuf/google/protobuf/timestamp_pb';
|
||||
import { BehaviorSubject, Observable, Subscription } from 'rxjs';
|
||||
import { ProjectView } from 'src/app/proto/generated/management_pb';
|
||||
import { ProjectService } from 'src/app/services/project.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
@@ -56,7 +56,7 @@ export class OwnedProjectListComponent implements OnInit, OnDestroy {
|
||||
|
||||
constructor(private router: Router,
|
||||
public translate: TranslateService,
|
||||
private projectService: ProjectService,
|
||||
private mgmtService: ManagementService,
|
||||
private toast: ToastService,
|
||||
) { }
|
||||
|
||||
@@ -90,7 +90,7 @@ export class OwnedProjectListComponent implements OnInit, OnDestroy {
|
||||
|
||||
private async getData(limit: number, offset: number): Promise<void> {
|
||||
this.loadingSubject.next(true);
|
||||
this.projectService.SearchProjects(limit, offset).then(res => {
|
||||
this.mgmtService.SearchProjects(limit, offset).then(res => {
|
||||
const response = res.toObject();
|
||||
this.ownedProjectList = response.resultList;
|
||||
this.totalResult = response.totalResult;
|
||||
@@ -113,7 +113,7 @@ export class OwnedProjectListComponent implements OnInit, OnDestroy {
|
||||
|
||||
public reactivateSelectedProjects(): void {
|
||||
const promises = this.selection.selected.map(project => {
|
||||
this.projectService.ReactivateProject(project.projectId);
|
||||
this.mgmtService.ReactivateProject(project.projectId);
|
||||
});
|
||||
|
||||
Promise.all(promises).then(() => {
|
||||
@@ -126,7 +126,7 @@ export class OwnedProjectListComponent implements OnInit, OnDestroy {
|
||||
|
||||
public deactivateSelectedProjects(): void {
|
||||
const promises = this.selection.selected.map(project => {
|
||||
this.projectService.DeactivateProject(project.projectId);
|
||||
this.mgmtService.DeactivateProject(project.projectId);
|
||||
});
|
||||
|
||||
Promise.all(promises).then(() => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { DataSource } from '@angular/cdk/collections';
|
||||
import { BehaviorSubject, from, Observable, of } from 'rxjs';
|
||||
import { catchError, finalize, map } from 'rxjs/operators';
|
||||
import { ProjectMemberView } from 'src/app/proto/generated/management_pb';
|
||||
import { ProjectService } from 'src/app/services/project.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
|
||||
/**
|
||||
* Data source for the ProjectMembers view. This class should
|
||||
@@ -16,7 +16,7 @@ export class ProjectGrantDetailDataSource extends DataSource<ProjectMemberView.A
|
||||
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
||||
|
||||
constructor(private projectService: ProjectService) {
|
||||
constructor(private mgmtService: ManagementService) {
|
||||
super();
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ export class ProjectGrantDetailDataSource extends DataSource<ProjectMemberView.A
|
||||
|
||||
this.loadingSubject.next(true);
|
||||
|
||||
from(this.projectService.SearchProjectGrantMembers(projectId, grantId, pageSize, offset)).pipe(
|
||||
from(this.mgmtService.SearchProjectGrantMembers(projectId, grantId, pageSize, offset)).pipe(
|
||||
map(resp => {
|
||||
this.totalResult = resp.toObject().totalResult;
|
||||
return resp.toObject().resultList;
|
||||
|
||||
@@ -8,8 +8,7 @@ import {
|
||||
ProjectRoleView,
|
||||
ProjectType,
|
||||
} from 'src/app/proto/generated/management_pb';
|
||||
import { OrgService } from 'src/app/services/org.service';
|
||||
import { ProjectService } from 'src/app/services/project.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
@@ -31,8 +30,7 @@ export class ProjectGrantDetailComponent {
|
||||
public memberRoleOptions: ProjectRoleView.AsObject[] = [];
|
||||
|
||||
constructor(
|
||||
private orgService: OrgService,
|
||||
private projectService: ProjectService,
|
||||
private mgmtService: ManagementService,
|
||||
private route: ActivatedRoute,
|
||||
private toast: ToastService,
|
||||
) {
|
||||
@@ -40,13 +38,13 @@ export class ProjectGrantDetailComponent {
|
||||
this.projectid = params.projectid;
|
||||
this.grantid = params.grantid;
|
||||
|
||||
this.orgService.GetIam().then(iam => {
|
||||
this.mgmtService.GetIam().then(iam => {
|
||||
this.isZitadel = iam.toObject().iamProjectId === this.projectid;
|
||||
});
|
||||
|
||||
this.getRoleOptions(params.projectid);
|
||||
|
||||
this.projectService.ProjectGrantByID(this.grantid, this.projectid).then((grant) => {
|
||||
this.mgmtService.ProjectGrantByID(this.grantid, this.projectid).then((grant) => {
|
||||
this.grant = grant.toObject();
|
||||
});
|
||||
});
|
||||
@@ -54,14 +52,14 @@ export class ProjectGrantDetailComponent {
|
||||
|
||||
public changeState(newState: ProjectGrantState): void {
|
||||
if (newState === ProjectGrantState.PROJECTGRANTSTATE_ACTIVE) {
|
||||
this.projectService.ReactivateProjectGrant(this.grantid, this.projectid).then(() => {
|
||||
this.mgmtService.ReactivateProjectGrant(this.grantid, this.projectid).then(() => {
|
||||
this.toast.showInfo('PROJECT.TOAST.REACTIVATED', true);
|
||||
this.grant.state = newState;
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
} else if (newState === ProjectGrantState.PROJECTGRANTSTATE_INACTIVE) {
|
||||
this.projectService.DeactivateProjectGrant(this.grantid, this.projectid).then(() => {
|
||||
this.mgmtService.DeactivateProjectGrant(this.grantid, this.projectid).then(() => {
|
||||
this.toast.showInfo('PROJECT.TOAST.DEACTIVATED', true);
|
||||
this.grant.state = newState;
|
||||
}).catch(error => {
|
||||
@@ -71,13 +69,13 @@ export class ProjectGrantDetailComponent {
|
||||
}
|
||||
|
||||
public getRoleOptions(projectId: string): void {
|
||||
this.projectService.SearchProjectRoles(projectId, 100, 0).then(resp => {
|
||||
this.mgmtService.SearchProjectRoles(projectId, 100, 0).then(resp => {
|
||||
this.memberRoleOptions = resp.toObject().resultList;
|
||||
});
|
||||
}
|
||||
|
||||
updateRoles(selectionChange: MatSelectChange): void {
|
||||
this.projectService.UpdateProjectGrant(this.grant.id, this.grant.projectId, selectionChange.value)
|
||||
this.mgmtService.UpdateProjectGrant(this.grant.id, this.grant.projectId, selectionChange.value)
|
||||
.then((newgrant: ProjectGrant) => {
|
||||
this.toast.showInfo('PROJECT.TOAST.GRANTUPDATED');
|
||||
}).catch(error => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Timestamp } from 'google-protobuf/google/protobuf/timestamp_pb';
|
||||
import { BehaviorSubject, from, Observable, of } from 'rxjs';
|
||||
import { catchError, finalize, map } from 'rxjs/operators';
|
||||
import { ProjectMember } from 'src/app/proto/generated/management_pb';
|
||||
import { ProjectService } from 'src/app/services/project.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
|
||||
/**
|
||||
* Data source for the ProjectMembers view. This class should
|
||||
@@ -18,7 +18,7 @@ export class ProjectGrantMembersDataSource extends DataSource<ProjectMember.AsOb
|
||||
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
||||
|
||||
constructor(private projectService: ProjectService) {
|
||||
constructor(private mgmtService: ManagementService) {
|
||||
super();
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ export class ProjectGrantMembersDataSource extends DataSource<ProjectMember.AsOb
|
||||
|
||||
this.loadingSubject.next(true);
|
||||
|
||||
from(this.projectService.SearchProjectGrantMembers(projectId,
|
||||
from(this.mgmtService.SearchProjectGrantMembers(projectId,
|
||||
grantId, pageSize, offset)).pipe(
|
||||
map(resp => {
|
||||
const response = resp.toObject();
|
||||
|
||||
@@ -6,7 +6,7 @@ import { MatSelectChange } from '@angular/material/select';
|
||||
import { MatTable } from '@angular/material/table';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { ProjectMember, ProjectType } from 'src/app/proto/generated/management_pb';
|
||||
import { ProjectService } from 'src/app/services/project.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
import {
|
||||
@@ -39,11 +39,11 @@ export class ProjectGrantMembersComponent implements AfterViewInit, OnInit {
|
||||
public memberRoleOptions: string[] = [];
|
||||
|
||||
constructor(
|
||||
private projectService: ProjectService,
|
||||
private mgmtService: ManagementService,
|
||||
private dialog: MatDialog,
|
||||
private toast: ToastService,
|
||||
) {
|
||||
this.dataSource = new ProjectGrantMembersDataSource(this.projectService);
|
||||
this.dataSource = new ProjectGrantMembersDataSource(this.mgmtService);
|
||||
this.getRoleOptions();
|
||||
}
|
||||
|
||||
@@ -61,13 +61,13 @@ export class ProjectGrantMembersComponent implements AfterViewInit, OnInit {
|
||||
|
||||
public getRoleOptions(): void {
|
||||
if (this.type === ProjectType.PROJECTTYPE_GRANTED) {
|
||||
this.projectService.GetProjectGrantMemberRoles().then(resp => {
|
||||
this.mgmtService.GetProjectGrantMemberRoles().then(resp => {
|
||||
this.memberRoleOptions = resp.toObject().rolesList;
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
} else if (this.type === ProjectType.PROJECTTYPE_OWNED) {
|
||||
this.projectService.GetProjectMemberRoles().then(resp => {
|
||||
this.mgmtService.GetProjectMemberRoles().then(resp => {
|
||||
this.memberRoleOptions = resp.toObject().rolesList;
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
@@ -86,7 +86,7 @@ export class ProjectGrantMembersComponent implements AfterViewInit, OnInit {
|
||||
|
||||
public removeProjectMemberSelection(): void {
|
||||
Promise.all(this.selection.selected.map(member => {
|
||||
return this.projectService.RemoveProjectGrantMember(this.projectId, this.grantId, member.userId).then(() => {
|
||||
return this.mgmtService.RemoveProjectGrantMember(this.projectId, this.grantId, member.userId).then(() => {
|
||||
this.toast.showInfo('PROJECT.GRANT.TOAST.PROJECTGRANTMEMBERREMOVED', true);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
@@ -107,7 +107,7 @@ export class ProjectGrantMembersComponent implements AfterViewInit, OnInit {
|
||||
}
|
||||
|
||||
public async openAddMember(): Promise<any> {
|
||||
const keysList = (await this.projectService.GetProjectGrantMemberRoles()).toObject();
|
||||
const keysList = (await this.mgmtService.GetProjectGrantMemberRoles()).toObject();
|
||||
|
||||
const dialogRef = this.dialog.open(ProjectGrantMembersCreateDialogComponent, {
|
||||
data: {
|
||||
@@ -119,7 +119,7 @@ export class ProjectGrantMembersComponent implements AfterViewInit, OnInit {
|
||||
dialogRef.afterClosed().subscribe((dataToAdd: ProjectGrantMembersCreateDialogExportType) => {
|
||||
if (dataToAdd) {
|
||||
Promise.all(dataToAdd.userIds.map((userid: string) => {
|
||||
return this.projectService.AddProjectGrantMember(
|
||||
return this.mgmtService.AddProjectGrantMember(
|
||||
this.projectId,
|
||||
this.grantId,
|
||||
userid,
|
||||
@@ -135,7 +135,7 @@ export class ProjectGrantMembersComponent implements AfterViewInit, OnInit {
|
||||
}
|
||||
|
||||
updateRoles(member: ProjectMember.AsObject, selectionChange: MatSelectChange): void {
|
||||
this.projectService.ChangeProjectGrantMember(this.projectId, this.grantId, member.userId, selectionChange.value)
|
||||
this.mgmtService.ChangeProjectGrantMember(this.projectId, this.grantId, member.userId, selectionChange.value)
|
||||
.then((newmember: ProjectMember) => {
|
||||
this.toast.showInfo('PROJECT.GRANT.TOAST.PROJECTGRANTMEMBERCHANGED', true);
|
||||
}).catch(error => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Location } from '@angular/common';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { Project, ProjectCreateRequest } from 'src/app/proto/generated/management_pb';
|
||||
import { ProjectService } from 'src/app/services/project.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
@@ -16,7 +16,7 @@ export class ProjectCreateComponent implements OnInit {
|
||||
constructor(
|
||||
private router: Router,
|
||||
private toast: ToastService,
|
||||
private projectService: ProjectService,
|
||||
private mgmtService: ManagementService,
|
||||
private _location: Location,
|
||||
) { }
|
||||
|
||||
@@ -25,7 +25,7 @@ export class ProjectCreateComponent implements OnInit {
|
||||
public ngOnInit(): void { }
|
||||
|
||||
public saveProject(): void {
|
||||
this.projectService
|
||||
this.mgmtService
|
||||
.CreateProject(this.project)
|
||||
.then((data: Project) => {
|
||||
this.router.navigate(['projects', data.getId()]);
|
||||
|
||||
@@ -3,9 +3,8 @@ import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { Org, ProjectRole } from 'src/app/proto/generated/management_pb';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { OrgService } from 'src/app/services/org.service';
|
||||
import { ProjectService } from 'src/app/services/project.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';
|
||||
|
||||
@Component({
|
||||
@@ -24,11 +23,10 @@ export class ProjectGrantCreateComponent implements OnInit, OnDestroy {
|
||||
|
||||
private routeSubscription: Subscription = new Subscription();
|
||||
constructor(
|
||||
private orgService: OrgService,
|
||||
private route: ActivatedRoute,
|
||||
private toast: ToastService,
|
||||
private projectService: ProjectService,
|
||||
private authService: AuthService,
|
||||
private mgmtService: ManagementService,
|
||||
private authService: GrpcAuthService,
|
||||
private _location: Location,
|
||||
) { }
|
||||
|
||||
@@ -43,7 +41,7 @@ export class ProjectGrantCreateComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
public searchOrg(domain: string): void {
|
||||
this.orgService.getOrgByDomainGlobal(domain).then((ret) => {
|
||||
this.mgmtService.getOrgByDomainGlobal(domain).then((ret) => {
|
||||
const tmp = ret.toObject();
|
||||
this.authService.GetActiveOrg().then((org) => {
|
||||
if (tmp !== org) {
|
||||
@@ -61,7 +59,7 @@ export class ProjectGrantCreateComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
public addGrant(): void {
|
||||
this.projectService
|
||||
this.mgmtService
|
||||
.CreateProjectGrant(this.org.id, this.projectId, this.rolesKeyList)
|
||||
.then((data) => {
|
||||
this.close();
|
||||
|
||||
@@ -5,7 +5,7 @@ import { FormArray, FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { ActivatedRoute, Params, Router } from '@angular/router';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { ProjectRoleAdd } from 'src/app/proto/generated/management_pb';
|
||||
import { ProjectService } from 'src/app/services/project.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
@@ -45,7 +45,7 @@ export class ProjectRoleCreateComponent implements OnInit, OnDestroy {
|
||||
private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private toast: ToastService,
|
||||
private projectService: ProjectService,
|
||||
private mgmtService: ManagementService,
|
||||
private _location: Location,
|
||||
) {
|
||||
this.formGroup = new FormGroup({
|
||||
@@ -92,7 +92,7 @@ export class ProjectRoleCreateComponent implements OnInit, OnDestroy {
|
||||
return role;
|
||||
});
|
||||
|
||||
this.projectService.BulkAddProjectRole(this.projectId, rolesToAdd).then(() => {
|
||||
this.mgmtService.BulkAddProjectRole(this.projectId, rolesToAdd).then(() => {
|
||||
this.router.navigate(['projects', this.projectId]);
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
|
||||
@@ -5,9 +5,8 @@ import { Subscription } from 'rxjs';
|
||||
import { UserGrantContext } from 'src/app/modules/user-grants/user-grants-datasource';
|
||||
import { Org } from 'src/app/proto/generated/auth_pb';
|
||||
import { ProjectGrantView, ProjectRole, ProjectView, User, UserGrant } from 'src/app/proto/generated/management_pb';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { MgmtUserService } from 'src/app/services/mgmt-user.service';
|
||||
import { ProjectService } from 'src/app/services/project.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';
|
||||
|
||||
@Component({
|
||||
@@ -35,12 +34,12 @@ export class UserGrantCreateComponent implements OnDestroy {
|
||||
|
||||
public grantRolesKeyList: string[] = [];
|
||||
constructor(
|
||||
private authService: AuthService,
|
||||
private userService: MgmtUserService,
|
||||
private userService: ManagementService,
|
||||
private toast: ToastService,
|
||||
private _location: Location,
|
||||
private route: ActivatedRoute,
|
||||
private projectService: ProjectService,
|
||||
private authService: GrpcAuthService,
|
||||
private mgmtService: ManagementService,
|
||||
) {
|
||||
this.subscription = this.route.params.subscribe((params: Params) => {
|
||||
const { context, projectid, grantid, userid } = params;
|
||||
@@ -54,7 +53,7 @@ export class UserGrantCreateComponent implements OnDestroy {
|
||||
this.context = UserGrantContext.OWNED_PROJECT;
|
||||
} else if (this.projectId && this.grantId) {
|
||||
this.context = UserGrantContext.GRANTED_PROJECT;
|
||||
this.projectService.GetGrantedProjectByID(this.projectId, this.grantId).then(resp => {
|
||||
this.mgmtService.GetGrantedProjectByID(this.projectId, this.grantId).then(resp => {
|
||||
this.grantRolesKeyList = resp.toObject().roleKeysList;
|
||||
}).catch(error => {
|
||||
this.toast.showError(error);
|
||||
|
||||
@@ -3,8 +3,7 @@ import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/fo
|
||||
import { Router } from '@angular/router';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { CreateUserRequest, Gender, User } from 'src/app/proto/generated/management_pb';
|
||||
import { MgmtUserService } from 'src/app/services/mgmt-user.service';
|
||||
import { OrgService } from 'src/app/services/org.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
function noEmailValidator(c: AbstractControl): any {
|
||||
@@ -44,12 +43,12 @@ export class UserCreateComponent implements OnDestroy {
|
||||
constructor(
|
||||
private router: Router,
|
||||
private toast: ToastService,
|
||||
public userService: MgmtUserService,
|
||||
public userService: ManagementService,
|
||||
private fb: FormBuilder,
|
||||
private orgService: OrgService,
|
||||
private mgmtService: ManagementService,
|
||||
) {
|
||||
this.loading = true;
|
||||
this.orgService.GetMyOrgIamPolicy().then((iampolicy) => {
|
||||
this.mgmtService.GetMyOrgIamPolicy().then((iampolicy) => {
|
||||
this.userLoginMustBeDomain = iampolicy.toObject().userLoginMustBeDomain;
|
||||
this.initForm();
|
||||
this.loading = false;
|
||||
|
||||
@@ -4,7 +4,7 @@ import { TranslateService } from '@ngx-translate/core';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { ChangeType } from 'src/app/modules/changes/changes.component';
|
||||
import { Gender, UserAddress, UserEmail, UserPhone, UserProfile, UserView } from 'src/app/proto/generated/auth_pb';
|
||||
import { AuthUserService } from 'src/app/services/auth-user.service';
|
||||
import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
import { CodeDialogComponent } from './code-dialog/code-dialog.component';
|
||||
@@ -35,7 +35,7 @@ export class AuthUserDetailComponent implements OnDestroy {
|
||||
constructor(
|
||||
public translate: TranslateService,
|
||||
private toast: ToastService,
|
||||
private userService: AuthUserService,
|
||||
private userService: GrpcAuthService,
|
||||
private dialog: MatDialog,
|
||||
) {
|
||||
this.loading = true;
|
||||
|
||||
@@ -4,7 +4,7 @@ import { MatSort } from '@angular/material/sort';
|
||||
import { MatTable, MatTableDataSource } from '@angular/material/table';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { MfaOtpResponse, MFAState, MfaType, MultiFactor } from 'src/app/proto/generated/auth_pb';
|
||||
import { AuthUserService } from 'src/app/services/auth-user.service';
|
||||
import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
import { DialogOtpComponent } from '../dialog-otp/dialog-otp.component';
|
||||
@@ -28,7 +28,7 @@ export class AuthUserMfaComponent implements OnInit, OnDestroy {
|
||||
|
||||
public error: string = '';
|
||||
public otpAvailable: boolean = false;
|
||||
constructor(private service: AuthUserService, private toast: ToastService, private dialog: MatDialog) { }
|
||||
constructor(private service: GrpcAuthService, private toast: ToastService, private dialog: MatDialog) { }
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.getOTP();
|
||||
@@ -48,7 +48,7 @@ export class AuthUserMfaComponent implements OnInit, OnDestroy {
|
||||
|
||||
dialogRef.afterClosed().subscribe((code) => {
|
||||
if (code) {
|
||||
(this.service as AuthUserService).VerifyMfaOTP(code).then(() => {
|
||||
this.service.VerifyMfaOTP(code).then(() => {
|
||||
this.getOTP();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Timestamp } from 'google-protobuf/google/protobuf/timestamp_pb';
|
||||
import { BehaviorSubject, from, Observable, of } from 'rxjs';
|
||||
import { catchError, finalize, map } from 'rxjs/operators';
|
||||
import { UserMembershipView } from 'src/app/proto/generated/management_pb';
|
||||
import { MgmtUserService } from 'src/app/services/mgmt-user.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
|
||||
export class MembershipDetailDataSource extends DataSource<UserMembershipView.AsObject> {
|
||||
public totalResult: number = 0;
|
||||
@@ -13,7 +13,7 @@ export class MembershipDetailDataSource extends DataSource<UserMembershipView.As
|
||||
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
||||
|
||||
constructor(private mgmtUserService: MgmtUserService) {
|
||||
constructor(private mgmtUserService: ManagementService) {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,9 +8,7 @@ import { tap } from 'rxjs/operators';
|
||||
import { CreationType, MemberCreateDialogComponent } from 'src/app/modules/add-member-dialog/member-create-dialog.component';
|
||||
import { User, UserMembershipSearchResponse, UserMembershipView, UserView } from 'src/app/proto/generated/management_pb';
|
||||
import { AdminService } from 'src/app/services/admin.service';
|
||||
import { MgmtUserService } from 'src/app/services/mgmt-user.service';
|
||||
import { OrgService } from 'src/app/services/org.service';
|
||||
import { ProjectService } from 'src/app/services/project.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
import { MembershipDetailDataSource } from './membership-detail-datasource';
|
||||
@@ -38,20 +36,18 @@ export class MembershipDetailComponent implements AfterViewInit {
|
||||
public memberships!: UserMembershipSearchResponse.AsObject;
|
||||
|
||||
constructor(
|
||||
private mgmtUserService: MgmtUserService,
|
||||
activatedRoute: ActivatedRoute,
|
||||
private dialog: MatDialog,
|
||||
private toast: ToastService,
|
||||
private projectService: ProjectService,
|
||||
private orgService: OrgService,
|
||||
private mgmtService: ManagementService,
|
||||
private adminService: AdminService,
|
||||
) {
|
||||
activatedRoute.params.subscribe(data => {
|
||||
const { id } = data;
|
||||
if (id) {
|
||||
this.mgmtUserService.GetUserByID(id).then(user => {
|
||||
this.mgmtService.GetUserByID(id).then(user => {
|
||||
this.user = user.toObject();
|
||||
this.dataSource = new MembershipDetailDataSource(this.mgmtUserService);
|
||||
this.dataSource = new MembershipDetailDataSource(this.mgmtService);
|
||||
this.dataSource.loadMemberships(
|
||||
this.user.id,
|
||||
0,
|
||||
@@ -80,19 +76,6 @@ export class MembershipDetailComponent implements AfterViewInit {
|
||||
);
|
||||
}
|
||||
|
||||
// public removeSelectedMemberships(): void {
|
||||
// Promise.all(this.selection.selected.map(membership => {
|
||||
// switch (membership.memberType) {
|
||||
// case MemberType.MEMBERTYPE_ORGANISATION:
|
||||
// return this.orgService.RemoveMyOrgMember(membership.objectId);
|
||||
// case MemberType.MEMBERTYPE_PROJECT:
|
||||
// return this.projectService.RemoveProjectMember(membership.objectId, this.user.id);
|
||||
// // case MemberType.MEMBERTYPE_PROJECT_GRANT:
|
||||
// // return this.projectService.RemoveProjectGrantMember(membership.objectId, this.user.id);
|
||||
// }
|
||||
// }));
|
||||
// }
|
||||
|
||||
public isAllSelected(): boolean {
|
||||
const numSelected = this.selection.selected.length;
|
||||
const numRows = this.dataSource.membersSubject.value.length;
|
||||
@@ -134,7 +117,7 @@ export class MembershipDetailComponent implements AfterViewInit {
|
||||
}
|
||||
|
||||
public async loadManager(userId: string): Promise<void> {
|
||||
this.mgmtUserService.SearchUserMemberships(userId, 100, 0, []).then(response => {
|
||||
this.mgmtService.SearchUserMemberships(userId, 100, 0, []).then(response => {
|
||||
this.memberships = response.toObject();
|
||||
this.loading = false;
|
||||
});
|
||||
@@ -161,7 +144,7 @@ export class MembershipDetailComponent implements AfterViewInit {
|
||||
|
||||
if (users && users.length && roles && roles.length) {
|
||||
Promise.all(users.map(user => {
|
||||
return this.orgService.AddMyOrgMember(user.id, roles);
|
||||
return this.mgmtService.AddMyOrgMember(user.id, roles);
|
||||
})).then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.MEMBERADDED', true);
|
||||
}).catch(error => {
|
||||
@@ -176,7 +159,7 @@ export class MembershipDetailComponent implements AfterViewInit {
|
||||
|
||||
if (users && users.length && roles && roles.length) {
|
||||
users.forEach(user => {
|
||||
return this.projectService.AddProjectGrantMember(
|
||||
return this.mgmtService.AddProjectGrantMember(
|
||||
response.projectId,
|
||||
response.grantId,
|
||||
user.id,
|
||||
@@ -196,7 +179,7 @@ export class MembershipDetailComponent implements AfterViewInit {
|
||||
|
||||
if (users && users.length && roles && roles.length) {
|
||||
users.forEach(user => {
|
||||
return this.projectService.AddProjectMember(response.projectId, user.id, roles)
|
||||
return this.mgmtService.AddProjectMember(response.projectId, user.id, roles)
|
||||
.then(() => {
|
||||
this.toast.showInfo('PROJECT.TOAST.MEMBERADDED', true);
|
||||
}).catch(error => {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<div class="membership-groups">
|
||||
<span class="header">{{ 'USER.MEMBERSHIPS.TITLE' | translate }}</span>
|
||||
<!-- <span class="sub-header">{{ 'USER,' }}</span> -->
|
||||
<div class="people" *ngIf="memberships">
|
||||
<div class="img-list" [@cardAnimation]="memberships.totalResult">
|
||||
<mat-spinner class="spinner" diameter="20" *ngIf="loading"></mat-spinner>
|
||||
|
||||
@@ -5,9 +5,7 @@ import { Router } from '@angular/router';
|
||||
import { CreationType, MemberCreateDialogComponent } from 'src/app/modules/add-member-dialog/member-create-dialog.component';
|
||||
import { MemberType, UserView, UserMembershipSearchResponse } from 'src/app/proto/generated/management_pb';
|
||||
import { AdminService } from 'src/app/services/admin.service';
|
||||
import { MgmtUserService } from 'src/app/services/mgmt-user.service';
|
||||
import { OrgService } from 'src/app/services/org.service';
|
||||
import { ProjectService } from 'src/app/services/project.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
@@ -39,9 +37,7 @@ export class MembershipsComponent implements OnInit {
|
||||
public MemberType: any = MemberType;
|
||||
|
||||
constructor(
|
||||
private orgService: OrgService,
|
||||
private projectService: ProjectService,
|
||||
private mgmtUserService: MgmtUserService,
|
||||
private mgmtService: ManagementService,
|
||||
private adminService: AdminService,
|
||||
private dialog: MatDialog,
|
||||
private toast: ToastService,
|
||||
@@ -53,7 +49,7 @@ export class MembershipsComponent implements OnInit {
|
||||
}
|
||||
|
||||
public async loadManager(userId: string): Promise<void> {
|
||||
this.mgmtUserService.SearchUserMemberships(userId, 100, 0, []).then(response => {
|
||||
this.mgmtService.SearchUserMemberships(userId, 100, 0, []).then(response => {
|
||||
this.memberships = response.toObject();
|
||||
this.loading = false;
|
||||
});
|
||||
@@ -112,7 +108,7 @@ export class MembershipsComponent implements OnInit {
|
||||
|
||||
if (users && users.length && roles && roles.length) {
|
||||
Promise.all(users.map(user => {
|
||||
return this.orgService.AddMyOrgMember(user.id, roles);
|
||||
return this.mgmtService.AddMyOrgMember(user.id, roles);
|
||||
})).then(() => {
|
||||
this.toast.showInfo('ORG.TOAST.MEMBERADDED', true);
|
||||
}).catch(error => {
|
||||
@@ -127,7 +123,7 @@ export class MembershipsComponent implements OnInit {
|
||||
|
||||
if (users && users.length && roles && roles.length) {
|
||||
users.forEach(user => {
|
||||
return this.projectService.AddProjectGrantMember(
|
||||
return this.mgmtService.AddProjectGrantMember(
|
||||
response.projectId,
|
||||
response.grantId,
|
||||
user.id,
|
||||
@@ -147,7 +143,7 @@ export class MembershipsComponent implements OnInit {
|
||||
|
||||
if (users && users.length && roles && roles.length) {
|
||||
users.forEach(user => {
|
||||
return this.projectService.AddProjectMember(response.projectId, user.id, roles)
|
||||
return this.mgmtService.AddProjectMember(response.projectId, user.id, roles)
|
||||
.then(() => {
|
||||
this.toast.showInfo('PROJECT.TOAST.MEMBERADDED', true);
|
||||
}).catch(error => {
|
||||
|
||||
@@ -4,8 +4,8 @@ import { ActivatedRoute } from '@angular/router';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { lowerCaseValidator, numberValidator, symbolValidator, upperCaseValidator } from 'src/app/pages/validators';
|
||||
import { PasswordComplexityPolicy } from 'src/app/proto/generated/auth_pb';
|
||||
import { AuthUserService } from 'src/app/services/auth-user.service';
|
||||
import { MgmtUserService } from 'src/app/services/mgmt-user.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';
|
||||
|
||||
function passwordConfirmValidator(c: AbstractControl): any {
|
||||
@@ -39,11 +39,10 @@ export class PasswordComponent implements OnDestroy {
|
||||
constructor(
|
||||
activatedRoute: ActivatedRoute,
|
||||
private fb: FormBuilder,
|
||||
private userService: AuthUserService,
|
||||
private mgmtUserService: MgmtUserService,
|
||||
private authService: GrpcAuthService,
|
||||
private mgmtUserService: ManagementService,
|
||||
private toast: ToastService,
|
||||
) {
|
||||
|
||||
activatedRoute.params.subscribe(data => {
|
||||
const { id } = data;
|
||||
if (id) {
|
||||
@@ -51,7 +50,7 @@ export class PasswordComponent implements OnDestroy {
|
||||
}
|
||||
|
||||
const validators: Validators[] = [Validators.required];
|
||||
this.userService.GetMyPasswordComplexityPolicy().then(complexity => {
|
||||
this.authService.GetMyPasswordComplexityPolicy().then(complexity => {
|
||||
this.policy = complexity.toObject();
|
||||
if (this.policy.minLength) {
|
||||
validators.push(Validators.minLength(this.policy.minLength));
|
||||
@@ -110,8 +109,8 @@ export class PasswordComponent implements OnDestroy {
|
||||
if (this.passwordForm.valid && this.currentPassword &&
|
||||
this.currentPassword.value &&
|
||||
this.newPassword && this.newPassword.value && this.newPassword.valid) {
|
||||
this.userService
|
||||
.ChangeMyPassword(this.currentPassword.value, this.newPassword.value).then((data: any) => {
|
||||
this.authService.ChangeMyPassword(this.currentPassword.value, this.newPassword.value)
|
||||
.then((data: any) => {
|
||||
this.toast.showInfo('USER.TOAST.PASSWORDCHANGED', true);
|
||||
window.history.back();
|
||||
}).catch(error => {
|
||||
|
||||
@@ -13,8 +13,7 @@ import {
|
||||
UserState,
|
||||
UserView,
|
||||
} from 'src/app/proto/generated/management_pb';
|
||||
import { MgmtUserService } from 'src/app/services/mgmt-user.service';
|
||||
import { ProjectService } from 'src/app/services/project.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
@@ -41,9 +40,9 @@ export class UserDetailComponent implements OnInit, OnDestroy {
|
||||
public translate: TranslateService,
|
||||
private route: ActivatedRoute,
|
||||
private toast: ToastService,
|
||||
private mgmtUserService: MgmtUserService,
|
||||
private mgmtUserService: ManagementService,
|
||||
private _location: Location,
|
||||
public projectService: ProjectService,
|
||||
public mgmtService: ManagementService,
|
||||
) { }
|
||||
|
||||
public ngOnInit(): void {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { MatSort } from '@angular/material/sort';
|
||||
import { MatTable, MatTableDataSource } from '@angular/material/table';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { MFAState, MfaType, MultiFactor, UserView } from 'src/app/proto/generated/management_pb';
|
||||
import { MgmtUserService } from 'src/app/services/mgmt-user.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
|
||||
|
||||
export interface MFAItem {
|
||||
@@ -31,7 +31,7 @@ export class UserMfaComponent implements OnInit, OnDestroy {
|
||||
public MFAState: any = MFAState;
|
||||
|
||||
public error: string = '';
|
||||
constructor(private mgmtUserService: MgmtUserService) { }
|
||||
constructor(private mgmtUserService: ManagementService) { }
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.getOTP();
|
||||
|
||||
@@ -6,7 +6,7 @@ import { ActivatedRoute } from '@angular/router';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { BehaviorSubject, Observable, Subscription } from 'rxjs';
|
||||
import { User, UserSearchResponse } from 'src/app/proto/generated/management_pb';
|
||||
import { MgmtUserService } from 'src/app/services/mgmt-user.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@Component({
|
||||
@@ -26,7 +26,7 @@ export class UserListComponent implements OnDestroy {
|
||||
|
||||
private subscription?: Subscription;
|
||||
|
||||
constructor(public translate: TranslateService, private route: ActivatedRoute, private userService: MgmtUserService,
|
||||
constructor(public translate: TranslateService, private route: ActivatedRoute, private userService: ManagementService,
|
||||
private toast: ToastService) {
|
||||
this.subscription = this.route.params.subscribe(() => this.getData(10, 0));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user