Skip to content

Commit

Permalink
Merged PR 35160: Added missing permissions filter for group owner
Browse files Browse the repository at this point in the history
Added missing permissions filter for group owner.

Upstream PR: geonetwork#7980

Related work items: #190417, #190553
  • Loading branch information
joachimnielandt committed May 3, 2024
2 parents 01fdb95 + 8075b75 commit f952a8b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,19 @@ public static String buildPermissionsFilter(ServiceContext context) throws Excep


String ownerFilter = "";
String groupOwnerFilter = "";
if (userSession.getUserIdAsInt() > 0) {
// OR you are owner
ownerFilter = String.format("owner:%d", userSession.getUserIdAsInt());
// OR member of groupOwner
// TODOES
groupOwnerFilter = String.format("groupOwner:(%s)",
// don't use groups 0, 1, -1 as groupOwner
groups.stream().filter(g -> g > 1)
.map(Object::toString)
.collect(Collectors.joining(" OR ")));

}
return String.format("(%s %s)", operationFilter, ownerFilter).trim();
return String.format("(%s %s %s)", operationFilter, ownerFilter, groupOwnerFilter).trim();
}
}
/**
Expand Down
5 changes: 5 additions & 0 deletions vlaanderen/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [8.1.19-SNAPSHOT]

### core
- Added groupOwner check while testing for permissions in Elasticsearch - [pr](https://agiv.visualstudio.com/Metadata/_git/MetadataGeonetwork/pullrequest/35160) / [pr-core](https://github.com/geonetwork/core-geonetwork/pull/7980)


## [8.1.18] - 2024-04-30

### vlaanderen
Expand All @@ -18,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Now using beta environment as intended for status change mails - [pr](https://agiv.visualstudio.com/Metadata/_git/MetadataGeonetwork/pullrequest/35272)
- Hotfix: fresh users could not be created due to introduced transactions - [pr](https://agiv.visualstudio.com/Metadata/_git/MetadataGeonetwork/pullrequest/35362)


## [8.1.17] - 2024-04-16

### vlaanderen
Expand Down

0 comments on commit f952a8b

Please sign in to comment.