mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-25 13:58:46 +00:00
fix(console): partial authconfig prompt, regex permissions (#658)
* fix partial authconfig prompt, domain c perm * membership read check * contributor refresh trigger, observe org write * user permissions, project deactivate * allow user grants for project.write * fix: create project * project create, roles, grants, members * fix adminurl * disable user * disable user actions * project grant members delete, p g user grant * lint * projectgrantcreate fix Co-authored-by: Fabiennne <[email protected]>
This commit is contained in:
co-authored by
Fabiennne
parent
bd7e3731c5
commit
0dd49f7430
@@ -34,7 +34,7 @@
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="btn-container">
|
||||
<button class="submit-button" type="submit" color="primary"
|
||||
<button [disabled]="disabled" class="submit-button" type="submit" color="primary"
|
||||
mat-raised-button>{{ 'ACTIONS.SAVE' | translate }}</button>
|
||||
</div>
|
||||
</form>
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, OnChanges, OnDestroy, Output } from '@angular/core';
|
||||
import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { Gender as authGender, UserProfile as authUP, UserView as authUV } from 'src/app/proto/generated/auth_pb';
|
||||
@@ -10,7 +10,7 @@ import { Gender as mgmtGender, UserProfile as mgmtUP, UserView as mgmtUV } from
|
||||
templateUrl: './detail-form.component.html',
|
||||
styleUrls: ['./detail-form.component.scss'],
|
||||
})
|
||||
export class DetailFormComponent implements OnInit, OnDestroy {
|
||||
export class DetailFormComponent implements OnDestroy, OnChanges {
|
||||
@Input() public username!: string;
|
||||
@Input() public user!: mgmtUV | authUV;
|
||||
@Input() public disabled: boolean = false;
|
||||
@@ -36,7 +36,19 @@ export class DetailFormComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
public ngOnInit(): void {
|
||||
public ngOnChanges(): void {
|
||||
console.log('disabled');
|
||||
this.profileForm = this.fb.group({
|
||||
userName: [{ value: '', disabled: true }, [
|
||||
Validators.required,
|
||||
]],
|
||||
firstName: [{ value: '', disabled: this.disabled }, Validators.required],
|
||||
lastName: [{ value: '', disabled: this.disabled }, Validators.required],
|
||||
nickName: [{ value: '', disabled: this.disabled }],
|
||||
gender: [{ value: 0 }, { disabled: this.disabled }],
|
||||
preferredLanguage: [{ value: '', disabled: this.disabled }],
|
||||
});
|
||||
|
||||
this.profileForm.patchValue({ userName: this.username, ...this.user });
|
||||
|
||||
if (this.preferredLanguage) {
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
<span>{{memberships.totalResult}}</span>
|
||||
</div>
|
||||
</ng-template>
|
||||
<button class="add-img" (click)="addMember()" mat-icon-button aria-label="add membership">
|
||||
<button [disabled]="disabled" class="add-img" (click)="addMember()" mat-icon-button
|
||||
aria-label="add membership">
|
||||
<mat-icon>add</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Component, Input, OnInit } from '@angular/core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
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 { MemberType, UserMembershipSearchResponse, UserView } from 'src/app/proto/generated/management_pb';
|
||||
import { AdminService } from 'src/app/services/admin.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
@@ -34,6 +34,8 @@ export class MembershipsComponent implements OnInit {
|
||||
public memberships!: UserMembershipSearchResponse.AsObject;
|
||||
|
||||
@Input() public user!: UserView.AsObject;
|
||||
@Input() public disabled: boolean = false;
|
||||
|
||||
public MemberType: any = MemberType;
|
||||
|
||||
constructor(
|
||||
@@ -46,6 +48,7 @@ export class MembershipsComponent implements OnInit {
|
||||
|
||||
ngOnInit(): void {
|
||||
this.loadManager(this.user.id);
|
||||
console.log(this.disabled);
|
||||
}
|
||||
|
||||
public async loadManager(userId: string): Promise<void> {
|
||||
@@ -56,7 +59,9 @@ export class MembershipsComponent implements OnInit {
|
||||
}
|
||||
|
||||
public navigateToObject(): void {
|
||||
this.router.navigate(['/users', this.user.id, 'memberships']);
|
||||
if (!this.disabled) {
|
||||
this.router.navigate(['/users', this.user.id, 'memberships']);
|
||||
}
|
||||
}
|
||||
|
||||
public addMember(): void {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<app-meta-layout>
|
||||
<div *ngIf="user" class="max-width-container">
|
||||
<app-meta-layout *ngIf="user && (['user.write','user.write:' + user.id] | hasRole) as canWrite$">
|
||||
<div class="max-width-container">
|
||||
<div class="head">
|
||||
<a (click)="navigateBack()" mat-icon-button>
|
||||
<mat-icon class="icon">arrow_back</mat-icon>
|
||||
@@ -38,9 +38,8 @@
|
||||
|
||||
<ng-template appHasRole [appHasRole]="['user.read', 'user.read:'+user?.id]">
|
||||
<app-card *ngIf="user.human" title="{{ 'USER.PROFILE.TITLE' | translate }}">
|
||||
<app-detail-form [disabled]="(['user.write:' + user?.id, 'user.write'] | hasRole | async) == false"
|
||||
[genders]="genders" [languages]="languages" [username]="user.userName" [user]="user.human"
|
||||
(submitData)="saveProfile($event)">
|
||||
<app-detail-form [disabled]="(canWrite$ | async) == false" [genders]="genders" [languages]="languages"
|
||||
[username]="user.userName" [user]="user.human" (submitData)="saveProfile($event)">
|
||||
</app-detail-form>
|
||||
</app-card>
|
||||
|
||||
@@ -51,7 +50,7 @@
|
||||
</app-detail-form-machine>
|
||||
</app-card>
|
||||
|
||||
<app-card *ngIf="user.id" title="{{ 'USER.MACHINE.KEYSTITLE' | translate }}"
|
||||
<app-card *ngIf="user.machine && user.id" title="{{ 'USER.MACHINE.KEYSTITLE' | translate }}"
|
||||
description="{{ 'USER.MACHINE.KEYSDESC' | translate }}">
|
||||
<app-machine-keys [userId]="user.id"></app-machine-keys>
|
||||
</app-card>
|
||||
@@ -62,13 +61,12 @@
|
||||
<div class="method-col">
|
||||
<div class="method-row">
|
||||
<span class="label">{{ 'USER.PROFILE.PASSWORD' | translate }}</span>
|
||||
|
||||
<span>*********</span>
|
||||
<span>******</span>
|
||||
<div class="actions">
|
||||
<button class="notify-change-pwd" (click)="sendSetPasswordNotification()" mat-stroked-button
|
||||
color="primary"
|
||||
<button [disabled]="(canWrite$ | async) == false" class="notify-change-pwd"
|
||||
(click)="sendSetPasswordNotification()" mat-stroked-button color="primary"
|
||||
*ngIf="user.state === UserState.USERSTATE_INITIAL">{{ 'USER.PASSWORD.RESENDNOTIFICATION' | translate }}</button>
|
||||
<a [routerLink]="['password']" mat-icon-button>
|
||||
<a [disabled]="(canWrite$ | async) == false" [routerLink]="['password']" mat-icon-button>
|
||||
<mat-icon class="icon">chevron_right</mat-icon>
|
||||
</a>
|
||||
</div>
|
||||
@@ -86,13 +84,16 @@
|
||||
<mat-icon class="icon" color="warn" aria-hidden="false" aria-label="not verified icon">
|
||||
highlight_off
|
||||
</mat-icon>
|
||||
<a class="verify" matTooltip="{{'USER.LOGINMETHODS.EMAIL.RESEND' | translate}}"
|
||||
(click)="resendVerification()">{{'USER.LOGINMETHODS.RESENDCODE' | translate}}</a>
|
||||
<ng-container *ngIf="(canWrite$ | async)">
|
||||
<a class="verify" matTooltip="{{'USER.LOGINMETHODS.EMAIL.RESEND' | translate}}"
|
||||
(click)="resendVerification()">{{'USER.LOGINMETHODS.RESENDCODE' | translate}}</a>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<button (click)="emailEditState = true" mat-icon-button>
|
||||
<button [disabled]="(canWrite$ | async) == false" (click)="emailEditState = true"
|
||||
mat-icon-button>
|
||||
<mat-icon class="icon">edit</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
@@ -105,8 +106,7 @@
|
||||
<button (click)="emailEditState = false" mat-icon-button>
|
||||
<mat-icon class="icon">close</mat-icon>
|
||||
</button>
|
||||
<button *ngIf="user.human"
|
||||
[disabled]="!user.human.email || (['user.write','user.write' + user.id] | hasRole | async) == false"
|
||||
<button *ngIf="user.human" [disabled]="!user.human.email || (canWrite$ | async) == false"
|
||||
class="submit-button" type="button" color="primary" (click)="saveEmail()"
|
||||
mat-raised-button>{{ 'ACTIONS.SAVE' | translate }}</button>
|
||||
</ng-template>
|
||||
@@ -125,13 +125,16 @@
|
||||
<mat-icon class="icon" color="warn" aria-hidden="false" aria-label="not verified icon">
|
||||
highlight_off
|
||||
</mat-icon>
|
||||
<a class="verify" matTooltip="{{'USER.LOGINMETHODS.PHONE.RESEND' | translate}}"
|
||||
(click)="resendPhoneVerification()">{{'USER.LOGINMETHODS.RESENDCODE' | translate}}</a>
|
||||
<ng-container *ngIf="(canWrite$ | async)">
|
||||
<a class="verify" matTooltip="{{'USER.LOGINMETHODS.PHONE.RESEND' | translate}}"
|
||||
(click)="resendPhoneVerification()">{{'USER.LOGINMETHODS.RESENDCODE' | translate}}</a>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<button (click)="phoneEditState = true" mat-icon-button>
|
||||
<button [disabled]="(canWrite$ | async) == false" (click)="phoneEditState = true"
|
||||
mat-icon-button>
|
||||
<mat-icon class="icon">edit</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
@@ -140,16 +143,19 @@
|
||||
<ng-template #phoneEdit>
|
||||
<mat-form-field class="name">
|
||||
<mat-label>{{ 'USER.PHONE' | translate }}</mat-label>
|
||||
<input *ngIf="user.human && user.human.phone" matInput [(ngModel)]="user.human.phone" />
|
||||
<input *ngIf="user.human && user.human.phone" matInput
|
||||
[disabled]="(canWrite$ | async) == false" [(ngModel)]="user.human.phone" />
|
||||
</mat-form-field>
|
||||
<button (click)="phoneEditState = false" mat-icon-button>
|
||||
<button (click)="phoneEditState = false" mat-icon-button
|
||||
[disabled]="(canWrite$ | async) == false">
|
||||
<mat-icon class="icon">close</mat-icon>
|
||||
</button>
|
||||
<button *ngIf="user.human?.phone" color="warn" (click)="deletePhone()" mat-icon-button>
|
||||
<button *ngIf="user.human?.phone" color="warn" (click)="deletePhone()"
|
||||
[disabled]="(canWrite$ | async) == false" mat-icon-button>
|
||||
<i class="las la-trash"></i>
|
||||
</button>
|
||||
<button *ngIf="user.human"
|
||||
[disabled]="!user.human.phone || (['user.write', 'user.write'+ user.id]| hasRole | async) == false"
|
||||
|
||||
<button *ngIf="user.human" [disabled]="!user.human.phone || (canWrite$ | async) == false"
|
||||
type="button" color="primary" (click)="savePhone()" mat-raised-button>
|
||||
{{ 'ACTIONS.SAVE' | translate }}</button>
|
||||
</ng-template>
|
||||
@@ -176,7 +182,7 @@
|
||||
</div>
|
||||
|
||||
<ng-template appHasRole [appHasRole]="['user.membership.read']">
|
||||
<app-memberships [user]="user"></app-memberships>
|
||||
<app-memberships [user]="user" [disabled]="(canWrite$ | async) == false"></app-memberships>
|
||||
</ng-template>
|
||||
|
||||
<app-changes class="changes" [changeType]="ChangeType.USER" [id]="user.id"></app-changes>
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
.label,
|
||||
.name {
|
||||
margin-right: 1rem;
|
||||
padding-right: 1rem;
|
||||
}
|
||||
|
||||
.actions {
|
||||
@@ -87,6 +87,16 @@
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 700px) {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
.label,
|
||||
.name {
|
||||
padding-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ export class UserDetailComponent implements OnInit, OnDestroy {
|
||||
|
||||
public saveEmail(): void {
|
||||
this.emailEditState = false;
|
||||
if (this.user && this.user.human?.phone) {
|
||||
if (this.user && this.user.human?.email) {
|
||||
this.mgmtUserService
|
||||
.SaveUserEmail(this.user.id, this.user.human.email).then((data: UserEmail) => {
|
||||
this.toast.showInfo('USER.TOAST.EMAILSENT', true);
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
<h1>{{ 'USER.PAGES.LIST' | translate }}</h1>
|
||||
<p class="sub">{{ 'USER.PAGES.DESCRIPTION' | translate }}</p>
|
||||
|
||||
<app-user-table [userType]="UserType.HUMAN"></app-user-table>
|
||||
<app-user-table [userType]="UserType.HUMAN" [disabled]="(['user.write'] | hasRole | async) == false">
|
||||
</app-user-table>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngSwitchCase="UserType.MACHINE">
|
||||
@@ -11,7 +12,8 @@
|
||||
<p class="sub">{{ 'USER.PAGES.DESCRIPTIONMACHINE' | translate }}</p>
|
||||
|
||||
<app-user-table [userType]="UserType.MACHINE"
|
||||
[displayedColumns]="['select','name', 'username', 'description','state']">
|
||||
[displayedColumns]="['select','name', 'username', 'description','state']"
|
||||
[disabled]="(['user.write'] | hasRole | async) == false">
|
||||
</app-user-table>
|
||||
</ng-container>
|
||||
</div>
|
||||
@@ -15,6 +15,7 @@ import { AvatarModule } from 'src/app/modules/avatar/avatar.module';
|
||||
import { CardModule } from 'src/app/modules/card/card.module';
|
||||
import { RefreshTableModule } from 'src/app/modules/refresh-table/refresh-table.module';
|
||||
import { SharedModule } from 'src/app/modules/shared/shared.module';
|
||||
import { HasRolePipeModule } from 'src/app/pipes/has-role-pipe.module';
|
||||
|
||||
import { UserListRoutingModule } from './user-list-routing.module';
|
||||
import { UserListComponent } from './user-list.component';
|
||||
@@ -41,6 +42,7 @@ import { UserTableComponent } from './user-table/user-table.component';
|
||||
MatProgressSpinnerModule,
|
||||
MatCheckboxModule,
|
||||
MatTooltipModule,
|
||||
HasRolePipeModule,
|
||||
TranslateModule,
|
||||
SharedModule,
|
||||
RefreshTableModule,
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
[timestamp]="userResult?.viewTimestamp" [selection]="selection">
|
||||
<ng-template appHasRole [appHasRole]="['user.write']" actions>
|
||||
<button (click)="deactivateSelectedUsers()" matTooltip="{{'ORG_DETAIL.TABLE.DEACTIVATE' | translate}}"
|
||||
class="icon-button" mat-icon-button *ngIf="selection.hasValue()">
|
||||
class="icon-button" mat-icon-button *ngIf="selection.hasValue()" [disabled]="disabled">
|
||||
<mat-icon svgIcon="mdi_account_cancel"></mat-icon>
|
||||
</button>
|
||||
<button (click)="reactivateSelectedUsers()" matTooltip="{{'ORG_DETAIL.TABLE.ACTIVATE' | translate}}"
|
||||
class="icon-button" mat-icon-button *ngIf="selection.hasValue()">
|
||||
class="icon-button" mat-icon-button *ngIf="selection.hasValue()" [disabled]="disabled">
|
||||
<mat-icon svgIcon="mdi_account_check_outline"></mat-icon>
|
||||
</button>
|
||||
<a class="add-button" [routerLink]="[ '/users',userType == UserType.HUMAN ? 'create' : 'create-machine']"
|
||||
color="primary" mat-raised-button>
|
||||
color="primary" mat-raised-button [disabled]="disabled">
|
||||
<mat-icon class="icon">add</mat-icon>{{ 'ACTIONS.NEW' | translate }}
|
||||
</a>
|
||||
</ng-template>
|
||||
|
||||
@@ -5,7 +5,7 @@ import { MatTableDataSource } from '@angular/material/table';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { UserView } from 'src/app/proto/generated/auth_pb';
|
||||
import { UserSearchKey, UserSearchQuery, UserSearchResponse } from 'src/app/proto/generated/management_pb';
|
||||
import { SearchMethod, UserSearchKey, UserSearchQuery, UserSearchResponse } from 'src/app/proto/generated/management_pb';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
@@ -19,6 +19,7 @@ import { UserType } from '../user-list.component';
|
||||
export class UserTableComponent implements OnInit {
|
||||
public UserType: any = UserType;
|
||||
@Input() userType: UserType = UserType.HUMAN;
|
||||
@Input() disabled: boolean = false;
|
||||
@ViewChild(MatPaginator) public paginator!: MatPaginator;
|
||||
public dataSource: MatTableDataSource<UserView.AsObject> = new MatTableDataSource<UserView.AsObject>();
|
||||
public selection: SelectionModel<UserView.AsObject> = new SelectionModel<UserView.AsObject>(true, []);
|
||||
@@ -79,9 +80,11 @@ export class UserTableComponent implements OnInit {
|
||||
this.loadingSubject.next(true);
|
||||
const query = new UserSearchQuery();
|
||||
query.setKey(UserSearchKey.USERSEARCHKEY_TYPE);
|
||||
query.setMethod(SearchMethod.SEARCHMETHOD_EQUALS);
|
||||
query.setValue(filterTypeValue);
|
||||
console.log(filterTypeValue);
|
||||
|
||||
this.userService.SearchUsers(limit, offset).then(resp => {
|
||||
this.userService.SearchUsers(limit, offset, [query]).then(resp => {
|
||||
this.userResult = resp.toObject();
|
||||
this.dataSource.data = this.userResult.resultList;
|
||||
console.log(this.userResult.resultList);
|
||||
|
||||
Reference in New Issue
Block a user