fix(console): authz creation from user, add org settings keyboardshortcut (#4135)

* fix(console): create user grant from user

* add org settings to keyboard shortcuts

Co-authored-by: Livio Spring <[email protected]>
This commit is contained in:
Max Peintner
2022-08-08 12:18:55 +00:00
committed by GitHub
co-authored by Livio Spring
parent 8f999e5806
commit 50acb22399
7 changed files with 50 additions and 26 deletions
@@ -141,13 +141,20 @@ export class UserGrantCreateComponent implements OnDestroy {
break;
case UserGrantContext.USER:
let grantId: string = '';
let grantedProjectId: string = '';
if (this.grantedProject?.grantId) {
grantId = this.grantedProject.grantId;
grantedProjectId = this.grantedProject.projectId;
}
const promu = this.userIds.map((id) =>
this.userService.addUserGrant(id, this.rolesList, (this.project as Project.AsObject).id, grantId),
this.userService.addUserGrant(
id,
this.rolesList,
this.project?.id ? this.project.id : grantedProjectId ? grantedProjectId : '',
grantId,
),
);
Promise.all(promu)
.then(() => {
@@ -6,16 +6,17 @@ import { BehaviorSubject, Observable, of, pairwise, Subject, takeUntil } from 'r
import { KeyboardShortcutsComponent } from '../../modules/keyboard-shortcuts/keyboard-shortcuts.component';
import { GrpcAuthService } from '../grpc-auth.service';
import {
ACTIONS,
DOMAINS,
HOME,
INSTANCE,
KeyboardShortcut,
ME,
ORG,
PROJECTS,
USERGRANTS,
USERS,
ACTIONS,
DOMAINS,
HOME,
INSTANCE,
KeyboardShortcut,
ME,
ORG,
ORGSETTINGS,
PROJECTS,
USERGRANTS,
USERS,
} from './keyboard-shortcuts';
@Injectable({
@@ -58,7 +59,7 @@ export class KeyboardShortcutsService implements OnDestroy {
this.router.navigate(HOME.link);
}
}
if (firstKey.code === 'KeyG' && secondKey.code === 'KeyS') {
if (firstKey.code === 'KeyG' && secondKey.code === 'KeyI') {
if (this.hasPermission(INSTANCE)) {
this.router.navigate(INSTANCE.link);
}
@@ -98,6 +99,11 @@ export class KeyboardShortcutsService implements OnDestroy {
this.router.navigate(DOMAINS.link);
}
}
if (firstKey.code === 'KeyG' && secondKey.code === 'KeyS') {
if (this.hasPermission(ORGSETTINGS)) {
this.router.navigate(ORGSETTINGS.link);
}
}
} else if (secondKey && exclude.indexOf(secondTagname?.toLowerCase()) === -1) {
if (secondKey.key === '?') {
this.openOverviewDialog();
@@ -12,9 +12,9 @@ export const HOME: KeyboardShortcut = {
};
export const INSTANCE: KeyboardShortcut = {
i18nKey: 'KEYBOARDSHORTCUTS.SHORTCUTS.SYSTEM',
i18nKey: 'KEYBOARDSHORTCUTS.SHORTCUTS.INSTANCE',
link: ['/instance'],
keyboardKeys: ['g', 's'],
keyboardKeys: ['g', 'i'],
permissions: ['iam.read'],
};
@@ -66,7 +66,14 @@ export const DOMAINS: KeyboardShortcut = {
permissions: ['org.read'],
};
export const SIDEWIDESHORTCUTS = [ME, HOME, INSTANCE, ORG, PROJECTS, USERS, USERGRANTS, ACTIONS, DOMAINS];
export const ORGSETTINGS: KeyboardShortcut = {
i18nKey: 'KEYBOARDSHORTCUTS.SHORTCUTS.ORGSETTINGS',
link: ['/org-settings'],
keyboardKeys: ['g', 's'],
permissions: ['org.read'],
};
export const SIDEWIDESHORTCUTS = [ME, HOME, INSTANCE, ORG, PROJECTS, USERS, USERGRANTS, ACTIONS, DOMAINS, ORGSETTINGS];
export const ORGSWITCHER: KeyboardShortcut = {
i18nKey: 'KEYBOARDSHORTCUTS.SHORTCUTS.ORGSWITCHER',