diff --git a/cloudapp/src/app/components/result/result.component.html b/cloudapp/src/app/components/result/result.component.html
index 772011b..12989ff 100644
--- a/cloudapp/src/app/components/result/result.component.html
+++ b/cloudapp/src/app/components/result/result.component.html
@@ -18,6 +18,26 @@
{{ 'main.results.copyInfo' | translate }}
+
+
+
+ {{ 'main.results.rolesSelectedToCopyTitle' | translate : {count: copyResult.rolesSelectedToCopy.length} }}
+
+
+
+
+
+
+
+ {{ 'main.results.skippedDuplicateRolesTitle' | translate : {count: copyResult.skippedDuplicateRoles.length} }}
+
+
+
+
@@ -28,6 +48,16 @@
+
+
+
+ {{ 'main.results.copiedRolesTitle' | translate : {count: copyResult.copiedRoles.length} }}
+
+
+
+
diff --git a/cloudapp/src/app/services/userRoles.service.ts b/cloudapp/src/app/services/userRoles.service.ts
index e8729ab..2189172 100644
--- a/cloudapp/src/app/services/userRoles.service.ts
+++ b/cloudapp/src/app/services/userRoles.service.ts
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core'
import { from, Observable, of } from 'rxjs'
-import { catchError, mergeMap, switchMap } from 'rxjs/operators'
+import { catchError, map, mergeMap, switchMap } from 'rxjs/operators'
import { ValidationInfo } from '../models/validationInfo'
import { CompareResult } from '../types/compareResult.type'
import { CopyResult } from '../types/copyResult.type'
@@ -20,11 +20,22 @@ export class UserRolesService {
private arrayHelper: ArrayHelperService) { }
copy(sourceUser: UserDetailsChecked, selectedRoles: UserRole[], targetUser: UserDetails, replaceExistingRoles: boolean): Observable {
+ let copyResult: Observable
if (sourceUser.rolesValid) {
- return this.copyValidRoles(selectedRoles, targetUser, replaceExistingRoles)
+ copyResult = this.copyValidRoles(selectedRoles, targetUser, replaceExistingRoles)
} else {
- return this.copyOneByOne(selectedRoles, targetUser, replaceExistingRoles)
+ copyResult = this.copyOneByOne(selectedRoles, targetUser, replaceExistingRoles)
}
+
+ copyResult = copyResult.pipe(
+ map(copyResult => {
+ const duplicates: UserRole[] = this.arrayHelper.findDuplicates(sourceUser.user_role)
+ copyResult.skippedDuplicateRoles = this.arrayHelper.intersection(selectedRoles, duplicates)
+ return copyResult
+ })
+ )
+
+ return copyResult
}
compare(sourceUser: UserDetailsChecked, targetUser: UserDetails): Observable {
@@ -61,8 +72,11 @@ export class UserRolesService {
.pipe(
switchMap(userDetails => {
let copyResult: CopyResult = {
+ rolesSelectedToCopy: selectedRoles,
validRoles: targetUser.user_role,
+ copiedRoles: selectedRoles,
invalidRoles: [],
+ skippedDuplicateRoles: [],
targetUser: userDetails
}
return of(copyResult)
@@ -95,8 +109,11 @@ export class UserRolesService {
.pipe(
switchMap(userDetails => {
let copyResult: CopyResult = {
+ rolesSelectedToCopy: selectedRoles,
validRoles: roleState.valid,
invalidRoles: roleState.invalid,
+ copiedRoles: this.arrayHelper.removeItems(selectedRoles, roleState.invalid),
+ skippedDuplicateRoles: [],
targetUser: userDetails
}
return of(copyResult)
@@ -108,8 +125,11 @@ export class UserRolesService {
return this.userService.updateUser(targetUser).pipe(
switchMap(userDetails => {
let copyResult: CopyResult = {
+ rolesSelectedToCopy: selectedRoles,
validRoles: [],
invalidRoles: [],
+ copiedRoles: [],
+ skippedDuplicateRoles: roles,
targetUser: userDetails
}
return of(copyResult)
diff --git a/cloudapp/src/app/types/copyResult.type.ts b/cloudapp/src/app/types/copyResult.type.ts
index 0d53dce..5167ff4 100644
--- a/cloudapp/src/app/types/copyResult.type.ts
+++ b/cloudapp/src/app/types/copyResult.type.ts
@@ -2,7 +2,10 @@ import { UserDetails } from './userDetails.type'
import { UserRole } from './userRole.type'
export type CopyResult = {
+ rolesSelectedToCopy: UserRole[]
validRoles: UserRole[]
invalidRoles: UserRole[]
+ skippedDuplicateRoles: UserRole[]
+ copiedRoles: UserRole[]
targetUser: UserDetails
}
diff --git a/cloudapp/src/i18n/de.json b/cloudapp/src/i18n/de.json
index a566f0a..a4e16cf 100644
--- a/cloudapp/src/i18n/de.json
+++ b/cloudapp/src/i18n/de.json
@@ -47,17 +47,20 @@
"replaceExistingRolesCheckboxLabel": "Bestehende Rollen ersetzen",
"resetButton": "Zurücksetzen",
"results": {
- "copyInfo": "Falls diese Zahlen nicht korrekt aussehen, vergleichen sie die Rollen von Ziel und Quelle, um zu sehen, ob die Quelle Duplikate hat. Doppelte Rollen werden beim Kopieren reduziert.",
+ "copiedRolesTitle": "Tatsächlich kopierte Rollen: {{count}}",
+ "copyInfo": "Falls diese Zahlen nicht korrekt aussehen, nutzen sie die 'Vergleichen Funktion', um zu sehen, ob die Quelle Duplikate hat. Doppelte Rollen werden beim Kopieren reduziert.",
"intersection": "Überschneidung ({{count}})",
"invalidRolesTitle": "Ungültige Rollen, ausgelassen: {{count}}",
"noneYet": "Noch keine Ergebnisse",
"onlyInSoure": "Nur Quelle ({{count}})",
"onlyInTarget": "Nur Ziel ({{count}})",
"ready": "Resultate bereit",
+ "rolesSelectedToCopyTitle": "Gewählt für Kopie: {{count}}",
+ "skippedDuplicateRolesTitle": "Duplikate, ausgelassen: {{count}}",
"sourceDuplicates": "Duplikate auf Quelle ({{count}})",
"targetDuplicates": "Duplikate auf Ziel({{count}})",
"title": "Ergebnisse",
- "validRolesTitle": "Gültige Rollen, kopiert: {{count}}"
+ "validRolesTitle": "Gültige Rollen, auf Ziel: {{count}}"
},
"rolesCopyToTargetInfo": "Rollen werden auf diesen Benutzer kopiert",
"searchUserInfo": "Benutzer Suchen",
@@ -70,9 +73,9 @@
"userIsNotAllowedInfo": "Sie haben nicht die nötigen Zugriffsrechte um die App zu verwenden."
},
"roleSelect": {
+ "deselectAll": "Alle abwählen",
"rolesSelected": "Gewählte Rollen",
- "selectAll": "Alle auswählen",
- "deselectAll": "Alle abwählen"
+ "selectAll": "Alle auswählen"
},
"validationDialog": {
"abortButtonLabel": "Abbrechen",
diff --git a/cloudapp/src/i18n/en.json b/cloudapp/src/i18n/en.json
index 2cc46c3..d62ffd5 100644
--- a/cloudapp/src/i18n/en.json
+++ b/cloudapp/src/i18n/en.json
@@ -47,17 +47,20 @@
"replaceExistingRolesCheckboxLabel": "Replace existing roles",
"resetButton": "Reset",
"results": {
- "copyInfo": "If this numbers seem incorrect, compare the roles of the users to see if the source user has duplicate roles. Duplicate roles are reduced during copying.",
+ "copiedRolesTitle": "Effectively copied roles: {{count}}",
+ "copyInfo": "If this numbers seem incorrect, use the 'compare function' to check if the source user has duplicate roles. Duplicate roles are reduced during copying.",
"intersection": "Intersection ({{count}})",
"invalidRolesTitle": "Invalid roles, skipped: {{count}}",
"noneYet": "perform action to see results",
"onlyInSoure": "Only on source ({{count}})",
"onlyInTarget": "Only on target ({{count}})",
"ready": "results ready",
+ "rolesSelectedToCopyTitle": "Selected to copy: {{count}}",
+ "skippedDuplicateRolesTitle": "Duplicate roles, skipped: {{count}}",
"sourceDuplicates": "Duplicates on source ({{count}})",
"targetDuplicates": "Duplicates on target ({{count}})",
"title": "Results",
- "validRolesTitle": "Valid roles, copied: {{count}}"
+ "validRolesTitle": "Valid roles on target: {{count}}"
},
"rolesCopyToTargetInfo": "Roles will be copied to this user",
"searchUserInfo": "Search for a user",
@@ -69,11 +72,11 @@
"userIsNotAllowed": "Permission denied",
"userIsNotAllowedInfo": "You don't have the permission to use this app."
},
- "roleSelect": {
- "rolesSelected": "Selected roles",
- "selectAll": "Select all",
- "deselectAll": "Deselect all"
- },
+ "roleSelect": {
+ "deselectAll": "Deselect all",
+ "rolesSelected": "Selected roles",
+ "selectAll": "Select all"
+ },
"validationDialog": {
"abortButtonLabel": "Cancel",
"introText": "Validation of roles failed: Not all roles of this user are valid.",