mirror of
https://github.com/zitadel/zitadel.git
synced 2025-07-12 18:58:34 +00:00
feat(console): set primary domain, fix org create permission (#688)
* feat: set primary domain, fix org perm * lint
This commit is contained in:
parent
4b183633ab
commit
779879f6ae
@ -84,7 +84,7 @@ const routes: Routes = [
|
|||||||
.then(m => m.UserGrantCreateModule),
|
.then(m => m.UserGrantCreateModule),
|
||||||
canActivate: [RoleGuard],
|
canActivate: [RoleGuard],
|
||||||
data: {
|
data: {
|
||||||
roles: ['project.user.grant.write'],
|
roles: ['user.grant.write'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
{{temporg?.name ? temporg.name : 'NO NAME'}}
|
{{temporg?.name ? temporg.name : 'NO NAME'}}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<ng-template appHasRole [appHasRole]="['(org.create)?(iam.write)?']">
|
<ng-template appHasRole [appHasRole]="['org.create','iam.write']">
|
||||||
<button mat-menu-item [routerLink]="[ '/org/create' ]">
|
<button mat-menu-item [routerLink]="[ '/org/create' ]">
|
||||||
<mat-icon class="avatar">add</mat-icon>
|
<mat-icon class="avatar">add</mat-icon>
|
||||||
{{'MENU.NEWORG' | translate}}
|
{{'MENU.NEWORG' | translate}}
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
<i matTooltip="verified" *ngIf="domain.verified" class="verified las la-check-circle"></i>
|
<i matTooltip="verified" *ngIf="domain.verified" class="verified las la-check-circle"></i>
|
||||||
<i matTooltip="primary" *ngIf="domain.primary" class="primary las la-star"></i>
|
<i matTooltip="primary" *ngIf="domain.primary" class="primary las la-star"></i>
|
||||||
|
<a *ngIf="!domain.primary" class="primaryset"
|
||||||
|
(click)="setPrimary(domain)">{{'ORG.DOMAINS.SETPRIMARY' | translate}}</a>
|
||||||
|
|
||||||
<span class="fill-space"></span>
|
<span class="fill-space"></span>
|
||||||
<button [disabled]="(canwrite$ | async) == false" matTooltip="Remove domain" color="warn"
|
<button [disabled]="(canwrite$ | async) == false" matTooltip="Remove domain" color="warn"
|
||||||
|
@ -25,6 +25,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.primaryset {
|
||||||
|
font-size: 13px;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.verified,
|
.verified,
|
||||||
.primary {
|
.primary {
|
||||||
color: #5282c1;
|
color: #5282c1;
|
||||||
|
@ -84,6 +84,15 @@ export class OrgDetailComponent implements OnInit, OnDestroy {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public setPrimary(domain: OrgDomainView.AsObject): void {
|
||||||
|
this.mgmtService.setMyPrimaryOrgDomain(domain.domain).then(() => {
|
||||||
|
this.toast.showInfo('ORG.TOAST.SETPRIMARY', true);
|
||||||
|
this.getData();
|
||||||
|
}).catch((error) => {
|
||||||
|
this.toast.showError(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public changeState(event: MatButtonToggleChange | any): void {
|
public changeState(event: MatButtonToggleChange | any): void {
|
||||||
if (event.value === OrgState.ORGSTATE_ACTIVE) {
|
if (event.value === OrgState.ORGSTATE_ACTIVE) {
|
||||||
this.mgmtService.ReactivateMyOrg().then(() => {
|
this.mgmtService.ReactivateMyOrg().then(() => {
|
||||||
|
@ -128,6 +128,10 @@ export class GrpcAuthService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns true if user has one of the provided roles
|
||||||
|
* @param roles roles of the user
|
||||||
|
*/
|
||||||
public isAllowed(roles: string[] | RegExp[]): Observable<boolean> {
|
public isAllowed(roles: string[] | RegExp[]): Observable<boolean> {
|
||||||
if (roles && roles.length > 0) {
|
if (roles && roles.length > 0) {
|
||||||
return this.zitadelPermissions.pipe(switchMap(zroles => {
|
return this.zitadelPermissions.pipe(switchMap(zroles => {
|
||||||
@ -138,6 +142,11 @@ export class GrpcAuthService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns true if user has one of the provided roles
|
||||||
|
* @param userRoles roles of the user
|
||||||
|
* @param requestedRoles required roles for accessing the respective component
|
||||||
|
*/
|
||||||
public hasRoles(userRoles: string[], requestedRoles: string[] | RegExp[]): boolean {
|
public hasRoles(userRoles: string[], requestedRoles: string[] | RegExp[]): boolean {
|
||||||
return requestedRoles.findIndex((regexp: any) => {
|
return requestedRoles.findIndex((regexp: any) => {
|
||||||
return userRoles.findIndex(role => {
|
return userRoles.findIndex(role => {
|
||||||
|
@ -63,6 +63,7 @@ import {
|
|||||||
PasswordLockoutPolicyID,
|
PasswordLockoutPolicyID,
|
||||||
PasswordLockoutPolicyUpdate,
|
PasswordLockoutPolicyUpdate,
|
||||||
PasswordRequest,
|
PasswordRequest,
|
||||||
|
PrimaryOrgDomainRequest,
|
||||||
Project,
|
Project,
|
||||||
ProjectCreateRequest,
|
ProjectCreateRequest,
|
||||||
ProjectGrant,
|
ProjectGrant,
|
||||||
@ -254,6 +255,12 @@ export class ManagementService {
|
|||||||
return this.grpcService.mgmt.searchMyOrgDomains(req);
|
return this.grpcService.mgmt.searchMyOrgDomains(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async setMyPrimaryOrgDomain(domain: string): Promise<Empty> {
|
||||||
|
const req: PrimaryOrgDomainRequest = new PrimaryOrgDomainRequest();
|
||||||
|
req.setDomain(domain);
|
||||||
|
return this.grpcService.mgmt.setMyPrimaryOrgDomain(req);
|
||||||
|
}
|
||||||
|
|
||||||
public async GenerateMyOrgDomainValidation(domain: string, type: OrgDomainValidationType):
|
public async GenerateMyOrgDomainValidation(domain: string, type: OrgDomainValidationType):
|
||||||
Promise<OrgDomainValidationResponse> {
|
Promise<OrgDomainValidationResponse> {
|
||||||
const req: OrgDomainValidationRequest = new OrgDomainValidationRequest();
|
const req: OrgDomainValidationRequest = new OrgDomainValidationRequest();
|
||||||
|
@ -335,6 +335,7 @@
|
|||||||
"NEW":"Domain hinzufügen",
|
"NEW":"Domain hinzufügen",
|
||||||
"TITLE":"Domains",
|
"TITLE":"Domains",
|
||||||
"DESCRIPTION":"Konfiguriere die Domains mit denen sich deine Benutzer einloggen können.",
|
"DESCRIPTION":"Konfiguriere die Domains mit denen sich deine Benutzer einloggen können.",
|
||||||
|
"SETPRIMARY":"Primäre Domain setzen",
|
||||||
"DELETE": {
|
"DELETE": {
|
||||||
"TITLE":"Domain löschen?",
|
"TITLE":"Domain löschen?",
|
||||||
"DESCRIPTION":"Du bist im Begriff eine Domain aus deiner Organisation zu löschen. Deine Benutzer können diese nach dem Löschen nicht mehr für den Login nutzen."
|
"DESCRIPTION":"Du bist im Begriff eine Domain aus deiner Organisation zu löschen. Deine Benutzer können diese nach dem Löschen nicht mehr für den Login nutzen."
|
||||||
@ -408,7 +409,8 @@
|
|||||||
"DOMAINREMOVED":"Domain entfernt!",
|
"DOMAINREMOVED":"Domain entfernt!",
|
||||||
"MEMBERADDED":"Manager hinzugefügt!",
|
"MEMBERADDED":"Manager hinzugefügt!",
|
||||||
"MEMBERREMOVED":"Manager entfernt!",
|
"MEMBERREMOVED":"Manager entfernt!",
|
||||||
"MEMBERCHANGED":"Manager verändert!"
|
"MEMBERCHANGED":"Manager verändert!",
|
||||||
|
"SETPRIMARY":"Primäre Domain gesetzt"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ORG_DETAIL": {
|
"ORG_DETAIL": {
|
||||||
|
@ -335,6 +335,7 @@
|
|||||||
"NEW":"Add Domain",
|
"NEW":"Add Domain",
|
||||||
"TITLE":"Domains",
|
"TITLE":"Domains",
|
||||||
"DESCRIPTION":"Configure your domains. This domain can be used to login with your users.",
|
"DESCRIPTION":"Configure your domains. This domain can be used to login with your users.",
|
||||||
|
"SETPRIMARY":"Set as primary",
|
||||||
"DELETE": {
|
"DELETE": {
|
||||||
"TITLE":"Delete domain?",
|
"TITLE":"Delete domain?",
|
||||||
"DESCRIPTION":"You are about to delete one of your domains. Note that your users can no longer use this domain for their logins."
|
"DESCRIPTION":"You are about to delete one of your domains. Note that your users can no longer use this domain for their logins."
|
||||||
@ -408,7 +409,8 @@
|
|||||||
"DOMAINREMOVED":"Removed domain!",
|
"DOMAINREMOVED":"Removed domain!",
|
||||||
"MEMBERADDED":"Manager added!",
|
"MEMBERADDED":"Manager added!",
|
||||||
"MEMBERREMOVED":"Manager removed!",
|
"MEMBERREMOVED":"Manager removed!",
|
||||||
"MEMBERCHANGED":"Manager changed!"
|
"MEMBERCHANGED":"Manager changed!",
|
||||||
|
"SETPRIMARY":"Primary Domain set"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ORG_DETAIL": {
|
"ORG_DETAIL": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user