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 <livio.a@gmail.com>
This commit is contained in:
Max Peintner
2022-08-08 14:18:55 +02:00
committed by GitHub
parent 8f999e5806
commit 50acb22399
7 changed files with 50 additions and 26 deletions

View File

@@ -141,13 +141,20 @@ export class UserGrantCreateComponent implements OnDestroy {
break; break;
case UserGrantContext.USER: case UserGrantContext.USER:
let grantId: string = ''; let grantId: string = '';
let grantedProjectId: string = '';
if (this.grantedProject?.grantId) { if (this.grantedProject?.grantId) {
grantId = this.grantedProject.grantId; grantId = this.grantedProject.grantId;
grantedProjectId = this.grantedProject.projectId;
} }
const promu = this.userIds.map((id) => 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) Promise.all(promu)
.then(() => { .then(() => {

View File

@@ -13,6 +13,7 @@ import {
KeyboardShortcut, KeyboardShortcut,
ME, ME,
ORG, ORG,
ORGSETTINGS,
PROJECTS, PROJECTS,
USERGRANTS, USERGRANTS,
USERS, USERS,
@@ -58,7 +59,7 @@ export class KeyboardShortcutsService implements OnDestroy {
this.router.navigate(HOME.link); this.router.navigate(HOME.link);
} }
} }
if (firstKey.code === 'KeyG' && secondKey.code === 'KeyS') { if (firstKey.code === 'KeyG' && secondKey.code === 'KeyI') {
if (this.hasPermission(INSTANCE)) { if (this.hasPermission(INSTANCE)) {
this.router.navigate(INSTANCE.link); this.router.navigate(INSTANCE.link);
} }
@@ -98,6 +99,11 @@ export class KeyboardShortcutsService implements OnDestroy {
this.router.navigate(DOMAINS.link); 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) { } else if (secondKey && exclude.indexOf(secondTagname?.toLowerCase()) === -1) {
if (secondKey.key === '?') { if (secondKey.key === '?') {
this.openOverviewDialog(); this.openOverviewDialog();

View File

@@ -12,9 +12,9 @@ export const HOME: KeyboardShortcut = {
}; };
export const INSTANCE: KeyboardShortcut = { export const INSTANCE: KeyboardShortcut = {
i18nKey: 'KEYBOARDSHORTCUTS.SHORTCUTS.SYSTEM', i18nKey: 'KEYBOARDSHORTCUTS.SHORTCUTS.INSTANCE',
link: ['/instance'], link: ['/instance'],
keyboardKeys: ['g', 's'], keyboardKeys: ['g', 'i'],
permissions: ['iam.read'], permissions: ['iam.read'],
}; };
@@ -66,7 +66,14 @@ export const DOMAINS: KeyboardShortcut = {
permissions: ['org.read'], 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 = { export const ORGSWITCHER: KeyboardShortcut = {
i18nKey: 'KEYBOARDSHORTCUTS.SHORTCUTS.ORGSWITCHER', i18nKey: 'KEYBOARDSHORTCUTS.SHORTCUTS.ORGSWITCHER',

View File

@@ -182,8 +182,9 @@
"SIDEWIDE": "Seitenübergreifende Tastaturkürzel", "SIDEWIDE": "Seitenübergreifende Tastaturkürzel",
"SHORTCUTS": { "SHORTCUTS": {
"HOME": "Zur Startseite", "HOME": "Zur Startseite",
"SYSTEM": "Zum <strong>S</strong>ystem", "INSTANCE": "Zur <strong>I</strong>nstanz",
"ORG": "Zur <strong>O</strong>rganisation", "ORG": "Zur <strong>O</strong>rganisation",
"ORGSETTINGS": "Zu den Organisationseinstellungen",
"ORGSWITCHER": "Organisation wechseln", "ORGSWITCHER": "Organisation wechseln",
"ME": "Zum eigenen Profil", "ME": "Zum eigenen Profil",
"PROJECTS": "Zu den <strong>P</strong>rojekten", "PROJECTS": "Zu den <strong>P</strong>rojekten",

View File

@@ -182,8 +182,9 @@
"SIDEWIDE": "Site-wide shortcuts", "SIDEWIDE": "Site-wide shortcuts",
"SHORTCUTS": { "SHORTCUTS": {
"HOME": "<strong>G</strong>o to <strong>H</strong>ome", "HOME": "<strong>G</strong>o to <strong>H</strong>ome",
"SYSTEM": "<strong>G</strong>o to <strong>S</strong>ystem", "INSTANCE": "<strong>G</strong>o to <strong>I</strong>instance",
"ORG": "<strong>G</strong>o to <strong>O</strong>rganization", "ORG": "<strong>G</strong>o to <strong>O</strong>rganization",
"ORGSETTINGS": "<strong>G</strong>o to Organization <strong>S</strong>ettings",
"ORGSWITCHER": "Change Organization", "ORGSWITCHER": "Change Organization",
"ME": "Go To own profile", "ME": "Go To own profile",
"PROJECTS": "<strong>G</strong>o to <strong>P</strong>rojects", "PROJECTS": "<strong>G</strong>o to <strong>P</strong>rojects",

View File

@@ -181,16 +181,17 @@
"UNDERORGCONTEXT": "Dans les pages de l'organisation", "UNDERORGCONTEXT": "Dans les pages de l'organisation",
"SIDEWIDE": "Raccourcis pour l'ensemble du site", "SIDEWIDE": "Raccourcis pour l'ensemble du site",
"SHORTCUTS": { "SHORTCUTS": {
"HOME": "<strong>A</strong>ller à <strong>A</strong>ccueil", "HOME": "Aller à Accueil",
"SYSTEM": "<strong>A</strong>ller à <strong>S</strong>ystème", "INSTANCE": "Vers l'aperçu des instances",
"ORG": "<strong>A</strong>ller à <strong>O</strong>rganisation", "ORG": "Aller à Organisation",
"ORGSETTINGS": "Vers les paramètres de l'organisation",
"ORGSWITCHER": "Modifier l'organisation", "ORGSWITCHER": "Modifier l'organisation",
"ME": "Aller à son propre profil", "ME": "Aller à son propre profil",
"PROJECTS": "<strong>A</strong>ller à <strong>P</strong>rojets", "PROJECTS": "Aller à Projets",
"USERS": "<strong>A</strong>ller à <strong>U</strong>tilisateurs", "USERS": "Aller à Utilisateurs",
"USERGRANTS": "<strong>A</strong>ller à<strong>A</strong>utorisations", "USERGRANTS": "Aller à Autorisations",
"ACTIONS": "<strong>A</strong>ller à Actions et <strong>F</strong>lux", "ACTIONS": "Aller à Actions et Flux",
"DOMAINS": "<strong>A</strong>ller à <strong>D</strong>omaines" "DOMAINS": "Aller à Domaines"
} }
}, },
"RESOURCEID": "Id de la ressource", "RESOURCEID": "Id de la ressource",

View File

@@ -182,8 +182,9 @@
"SIDEWIDE": "Tasti rapidi globali", "SIDEWIDE": "Tasti rapidi globali",
"SHORTCUTS": { "SHORTCUTS": {
"HOME": "Vai alla panoramica", "HOME": "Vai alla panoramica",
"SYSTEM": "Vai al pagina di sistema", "INSTANCE": "Vai alla pagina dell' istanza",
"ORG": "Vai all'organizzazione", "ORG": "Vai all'organizzazione",
"ORGSETTINGS": "Alle impostazioni dell'organizzazione",
"ORGSWITCHER": "Cambia organizzazione", "ORGSWITCHER": "Cambia organizzazione",
"ME": "Vai al profilo", "ME": "Vai al profilo",
"PROJECTS": "Vai ai progetti", "PROJECTS": "Vai ai progetti",