Skip to content

Commit 209019b

Browse files
committed
Ingestor: fix owner group fetching from profile
1 parent 8bb3b6f commit 209019b

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/app/ingestor/ingestor-metadata-editor/customRenderer/owner-group-field-renderer.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { selectUserSettingsPageViewModel } from "state-management/selectors/user
1111
import { fetchCurrentUserAction } from "state-management/actions/user.actions";
1212
import { MatAutocompleteSelectedEvent } from "@angular/material/autocomplete";
1313
import { Subscription } from "rxjs";
14+
import { selectGroupFilter } from "state-management/selectors/datasets.selectors";
1415

1516
@Component({
1617
selector: "owner-group-renderer",
@@ -98,25 +99,22 @@ export class OwnerGroupFieldComponent
9899
// Fetch the owner groups from the scicat user
99100
this.componentSubscriptions.push(
100101
this.vm$.subscribe((settings) => {
101-
const getclaims = (profile: any): string[] | null => {
102+
const getPossibleOwnerGroups = (profile: any): string[] | null => {
102103
if (!profile) {
103104
return null;
104105
}
106+
var accessGroups = profile.accessGroups ?? null;
105107

106-
if (profile.oidcClaims !== undefined) {
107-
return settings.profile.oidcClaims.accessGroups ?? null;
108+
if (accessGroups === null && profile.oidcClaims !== undefined) {
109+
accessGroups = profile.oidcClaims.accessGroups ?? null;
108110
}
109111

110-
if (profile.accessGroups !== undefined) {
111-
return settings.profile.accessGroups ?? null;
112-
}
113-
114-
return null;
112+
return accessGroups;
115113
};
116114

117-
const claims = getclaims(settings.profile);
118-
if (claims !== null && claims.length > 0) {
119-
this.userOwnerGroups = claims;
115+
const ownerGroups = getPossibleOwnerGroups(settings.profile);
116+
if (ownerGroups !== null && ownerGroups.length > 0) {
117+
this.userOwnerGroups = ownerGroups;
120118
} else {
121119
this.userOwnerGroups = [];
122120

0 commit comments

Comments
 (0)