Absract metatype impl (#2575)

* Add common "interface" for metadata supporting entities
* Add common metadata implementation for distribution set and software module
* Extract PermissionSupport + extend by TargetManagement
* TargetManagement tags are now protected by Target permissions - as it should be

---------

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2025-08-01 12:41:53 +03:00
committed by GitHub
parent b40de54d83
commit 5d75c9b0cc
22 changed files with 449 additions and 373 deletions

View File

@@ -64,9 +64,9 @@ public class RepositoryConfiguration {
public boolean hasPermission(final Authentication authentication, final Object targetDomainObject, final Object permission) {
if (targetDomainObject instanceof MethodSecurityExpressionOperations root) {
final String neededPermission =
permission + "_" + (root.getThis() instanceof RepositoryManagement<?, ?, ?> repositoryManagement
? repositoryManagement.permissionGroup()
: "REPOSITORY"); // TODO - should not fall back here - all using parmissions should extend repository management interface
permission + "_" + (root.getThis() instanceof PermissionSupport permissionSupport
? permissionSupport.permissionGroup()
: "REPOSITORY"); // TODO - should not fall back here - all using permissions should extend repository management interface
final boolean hasPermission = roleHierarchy.getReachableGrantedAuthorities(authentication.getAuthorities()).stream()
.map(GrantedAuthority::getAuthority)
.anyMatch(authority -> authority.equals(neededPermission));