Skip to content

Commit

Permalink
ensure information of permissions entries are always visible (#417)
Browse files Browse the repository at this point in the history
  • Loading branch information
allyoucanmap authored Aug 11, 2021
1 parent 7380ba3 commit 6d84f0e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions geonode_mapstore_client/client/js/utils/ResourceUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,17 @@ export function resourceToPermissionEntry(type, resource) {
id: resource.id || resource.pk,
avatar: resource.avatar,
name: resource.username,
permissions: resource.permissions
permissions: resource.permissions,
parsed: true
};
}
return {
type: 'group',
id: resource.id || resource?.group?.pk,
name: resource.title,
avatar: resource.logo,
permissions: resource.permissions
permissions: resource.permissions,
parsed: true
};
}

Expand All @@ -124,11 +126,11 @@ export function permissionsListsToCompact({ groups, entries }) {
export function permissionsCompactToLists({ groups, users, organizations }) {
return {
groups: [
...(groups || []).map((entry) => ({ ...entry, type: 'group', name: entry.name, avatar: entry.logo }))
...(groups || []).map((entry) => ({ ...entry, type: 'group', ...(!entry.parsed && { name: entry.name, avatar: entry.logo }) }))
],
entries: [
...(users || []).map((entry) => ({ ...entry, type: 'user', name: entry.username, avatar: entry.avatar })),
...(organizations || []).map((entry) => ({ ...entry, type: 'group', name: entry.title, avatar: entry.logo }))
...(users || []).map((entry) => ({ ...entry, type: 'user', ...(!entry.parsed && { name: entry.username, avatar: entry.avatar }) })),
...(organizations || []).map((entry) => ({ ...entry, type: 'group', ...(!entry.parsed && { name: entry.title, avatar: entry.logo }) }))
]
};
}
Expand Down

0 comments on commit 6d84f0e

Please sign in to comment.