-
diff --git a/console/src/app/pages/user-grant-create/user-grant-create.component.scss b/console/src/app/pages/user-grant-create/user-grant-create.component.scss
index 41e55414c9..0de500de0e 100644
--- a/console/src/app/pages/user-grant-create/user-grant-create.component.scss
+++ b/console/src/app/pages/user-grant-create/user-grant-create.component.scss
@@ -64,3 +64,13 @@
padding: .5rem 4rem;
}
}
+
+.sa-icon {
+ display: block;
+ width: 32px;
+ margin: 0 .5rem;
+
+ i {
+ margin: auto;
+ }
+}
diff --git a/console/src/app/pages/user-grant-create/user-grant-create.component.ts b/console/src/app/pages/user-grant-create/user-grant-create.component.ts
index ab69bf9900..4bc8b2a03a 100644
--- a/console/src/app/pages/user-grant-create/user-grant-create.component.ts
+++ b/console/src/app/pages/user-grant-create/user-grant-create.component.ts
@@ -2,6 +2,7 @@ import { Location } from '@angular/common';
import { Component, OnDestroy } from '@angular/core';
import { ActivatedRoute, Params } from '@angular/router';
import { Subscription } from 'rxjs';
+import { UserTarget } from 'src/app/modules/search-user-autocomplete/search-user-autocomplete.component';
import { UserGrantContext } from 'src/app/modules/user-grants/user-grants-datasource';
import { Org } from 'src/app/proto/generated/auth_pb';
import { ProjectGrantView, ProjectRole, ProjectView, UserGrant, UserView } from 'src/app/proto/generated/management_pb';
@@ -19,7 +20,10 @@ export class UserGrantCreateComponent implements OnDestroy {
public org!: Org.AsObject;
public userId: string = '';
+
public projectId: string = '';
+ public project!: ProjectGrantView.AsObject | ProjectView.AsObject;
+
public grantId: string = '';
public rolesList: string[] = [];
@@ -33,6 +37,12 @@ export class UserGrantCreateComponent implements OnDestroy {
public UserGrantContext: any = UserGrantContext;
public grantRolesKeyList: string[] = [];
+
+ public user!: UserView.AsObject;
+ public UserTarget: any = UserTarget;
+
+ public ProjectGrantView: any = ProjectGrantView;
+ public ProjectView: any = ProjectView;
constructor(
private userService: ManagementService,
private toast: ToastService,
@@ -42,8 +52,8 @@ export class UserGrantCreateComponent implements OnDestroy {
private mgmtService: ManagementService,
) {
this.subscription = this.route.params.subscribe((params: Params) => {
- const { context, projectid, grantid, userid } = params;
- this.context = context;
+ const { projectid, grantid, userid } = params;
+ this.context = UserGrantContext.NONE;
this.projectId = projectid;
this.grantId = grantid;
@@ -58,6 +68,14 @@ export class UserGrantCreateComponent implements OnDestroy {
}).catch((error: any) => {
this.toast.showError(error);
});
+ } else if (this.userId) {
+ this.context = UserGrantContext.USER;
+ this.mgmtService.GetUserByID(this.userId).then(resp => {
+ this.user = resp.toObject();
+ console.log(this.user);
+ }).catch((error: any) => {
+ this.toast.showError(error);
+ });
}
});
@@ -97,12 +115,52 @@ export class UserGrantCreateComponent implements OnDestroy {
this.toast.showError(error);
});
break;
+ case UserGrantContext.USER:
+ let grantId;
+
+ if ((this.project as ProjectGrantView.AsObject)?.id) {
+ grantId = (this.project as ProjectGrantView.AsObject).id;
+ }
+
+ this.userService.CreateUserGrant(
+ this.userId,
+ this.rolesList,
+ this.project.projectId,
+ grantId,
+ ).then((data: UserGrant) => {
+ this.toast.showInfo('PROJECT.GRANT.TOAST.PROJECTGRANTUSERGRANTADDED', true);
+ this.close();
+ }).catch((error: any) => {
+ this.toast.showError(error);
+ });
+ break;
+ case UserGrantContext.NONE:
+ let tempGrantId;
+
+ if ((this.project as ProjectGrantView.AsObject)?.id) {
+ tempGrantId = (this.project as ProjectGrantView.AsObject).id;
+ }
+
+ this.userService.CreateUserGrant(
+ this.userId,
+ this.rolesList,
+ this.project.projectId,
+ tempGrantId,
+ ).then((data: UserGrant) => {
+ this.toast.showInfo('PROJECT.GRANT.TOAST.PROJECTGRANTUSERGRANTADDED', true);
+ this.close();
+ }).catch((error: any) => {
+ this.toast.showError(error);
+ });
+ break;
}
}
public selectProject(project: ProjectView.AsObject | ProjectGrantView.AsObject | any): void {
+ this.project = project;
this.projectId = project.projectId;
+ this.grantRolesKeyList = project.roleKeysList ?? [];
}
public selectUser(user: UserView.AsObject): void {
diff --git a/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-detail.component.html b/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-detail.component.html
index 2a38dd59cb..ad79e7d455 100644
--- a/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-detail.component.html
+++ b/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-detail.component.html
@@ -47,6 +47,15 @@
+
+
+
+
+
diff --git a/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-detail.component.ts b/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-detail.component.ts
index 56c9dac0cf..3523f17476 100644
--- a/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-detail.component.ts
+++ b/console/src/app/pages/users/user-detail/auth-user-detail/auth-user-detail.component.ts
@@ -2,6 +2,7 @@ import { Component, OnDestroy } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Subscription } from 'rxjs';
import { ChangeType } from 'src/app/modules/changes/changes.component';
+import { UserGrantContext } from 'src/app/modules/user-grants/user-grants-datasource';
import { Gender, UserAddress, UserEmail, UserPhone, UserProfile, UserView } from 'src/app/proto/generated/auth_pb';
import { GrpcAuthService } from 'src/app/services/grpc-auth.service';
import { ToastService } from 'src/app/services/toast.service';
@@ -26,6 +27,8 @@ export class AuthUserDetailComponent implements OnDestroy {
public ChangeType: any = ChangeType;
public userLoginMustBeDomain: boolean = false;
+ public USERGRANTCONTEXT: UserGrantContext = UserGrantContext.USER;
+
constructor(
public translate: TranslateService,
private toast: ToastService,
diff --git a/console/src/app/pages/users/user-detail/contact/contact.component.html b/console/src/app/pages/users/user-detail/contact/contact.component.html
index 1178b442ed..c4f1be7f08 100644
--- a/console/src/app/pages/users/user-detail/contact/contact.component.html
+++ b/console/src/app/pages/users/user-detail/contact/contact.component.html
@@ -3,7 +3,7 @@
{{ 'USER.PROFILE.PASSWORD' | translate }}
*********
-
+
diff --git a/console/src/app/pages/users/user-detail/user-detail/user-detail.component.ts b/console/src/app/pages/users/user-detail/user-detail/user-detail.component.ts
index 8c12f3b27d..70fdb0fe5a 100644
--- a/console/src/app/pages/users/user-detail/user-detail/user-detail.component.ts
+++ b/console/src/app/pages/users/user-detail/user-detail/user-detail.component.ts
@@ -5,6 +5,7 @@ import { ActivatedRoute } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { Subscription } from 'rxjs';
import { ChangeType } from 'src/app/modules/changes/changes.component';
+import { UserGrantContext } from 'src/app/modules/user-grants/user-grants-datasource';
import { WarnDialogComponent } from 'src/app/modules/warn-dialog/warn-dialog.component';
import {
Gender,
@@ -37,6 +38,7 @@ export class UserDetailComponent implements OnInit, OnDestroy {
public UserState: any = UserState;
public copied: string = '';
+ public USERGRANTCONTEXT: UserGrantContext = UserGrantContext.USER;
constructor(
public translate: TranslateService,
diff --git a/console/src/app/pages/users/user-list/user-table/user-table.component.html b/console/src/app/pages/users/user-list/user-table/user-table.component.html
index 4a0572e96f..dfcead088c 100644
--- a/console/src/app/pages/users/user-list/user-table/user-table.component.html
+++ b/console/src/app/pages/users/user-list/user-table/user-table.component.html
@@ -1,6 +1,6 @@
+ [emitRefreshOnPreviousRoutes]="refreshOnPreviousRoutes">
{{'USER.PAGES.FILTER' | translate}}
{
- this.showMessage(data, 'close');
+ this.translate.get('ACTIONS.CLOSE').pipe(take(1)).subscribe(value => {
+ this.showMessage(data, value);
+ });
});
} else {
- this.showMessage(message, 'close');
+ this.translate.get('ACTIONS.CLOSE').pipe(take(1)).subscribe(value => {
+ this.showMessage(message, value);
+ });
}
}
public showError(grpcError: any): void {
const { message, code, metadata } = grpcError;
if (code !== 16) {
- this.showMessage(decodeURI(message), 'close');
+ this.translate.get('ACTIONS.CLOSE').pipe(take(1)).subscribe(value => {
+ this.showMessage(decodeURI(message), value);
+ });
}
}
diff --git a/console/src/assets/i18n/de.json b/console/src/assets/i18n/de.json
index be864ad882..30d64bf21a 100644
--- a/console/src/assets/i18n/de.json
+++ b/console/src/assets/i18n/de.json
@@ -35,7 +35,9 @@
"LOGOUT": "Alle Benutzer abmelden",
"NEWORG":"Neue Organisation",
"IAMADMIN":"Du bist ein IAM-Administrator. Beachte, dass Du erhöhte Rechte besitzt.",
- "SHOWORGS":"Alle Organisationen anzeigen"
+ "SHOWORGS":"Alle Organisationen anzeigen",
+ "GRANTSECTION":"Berechtigungssektion",
+ "GRANTS":"Berechtigungen"
},
"ACTIONS": {
"SAVE": "Speichern",
@@ -870,6 +872,8 @@
},
"ROLESLABEL":"Rollen",
"GRANTS": {
+ "TITLE":"Berechtigungen",
+ "DESC":"Hier kannst Du die Berechtigungen Deiner Organisation verwalten.",
"DELETE":"Berechtigung löschen",
"ADD":"Berechtigung erstellen",
"ADD_BTN":"Neu",
diff --git a/console/src/assets/i18n/en.json b/console/src/assets/i18n/en.json
index faa9343ae9..75276cae37 100644
--- a/console/src/assets/i18n/en.json
+++ b/console/src/assets/i18n/en.json
@@ -35,7 +35,9 @@
"LOGOUT": "Logout All Users",
"NEWORG":"New Organisation",
"IAMADMIN":"You are an IAM Administrator. Note that you have extended permissions.",
- "SHOWORGS":"Show All Organisations"
+ "SHOWORGS":"Show All Organisations",
+ "GRANTSECTION":"Authorization Section",
+ "GRANTS":"Authorizations"
},
"ACTIONS": {
"SAVE": "Save",
@@ -870,6 +872,8 @@
},
"ROLESLABEL":"Roles",
"GRANTS": {
+ "TITLE":"Authorisations",
+ "DESC":"Here you can manage authorizations of your organization users.",
"DELETE":"Delete Authorisation",
"ADD":"Create Authorisation",
"ADD_BTN":"New",
diff --git a/console/src/styles/table.scss b/console/src/styles/table.scss
index 2c02a31c0f..3397770f57 100644
--- a/console/src/styles/table.scss
+++ b/console/src/styles/table.scss
@@ -31,9 +31,9 @@
}
tr {
- cursor: pointer;
-
&.highlight {
+ cursor: pointer;
+
&:hover {
td {
background-color: var(--table-row-back); // rgba($inv-color, .05);