Project

General

Profile

Actions

Task #3135

open

Optimization of permission VsRequestByImplementerEvaluator

Added by Ondřej Kopr over 2 years ago.

Status:
New
Priority:
Normal
Assignee:
Peter Štrunc
Category:
Performance
Target version:
-
Start date:
06/08/2022
Due date:
% Done:

0%

Estimated time:
Owner:

Description

The evaluator VsRequestByImplementerEvaluator contains two separate queries:

Set<UUID> roles = identityRoleService.findValidRoles(currentId, null).getContent()//
                .stream()//
                .map(IdmIdentityRoleDto::getRole)//
                .collect(Collectors.toSet());
Subquery<VsSystemImplementer> subquery = query.subquery(VsSystemImplementer.class);
        Root<VsSystemImplementer> subRoot = subquery.from(VsSystemImplementer.class);
        subquery.select(subRoot);
        subquery.where(builder.and( //
                builder.equal(root.get(VsRequest_.system), subRoot.get(VsSystemImplementer_.system)), //
                builder.or(// correlation attribute
                        builder.equal(subRoot.get(VsSystemImplementer_.identity).get(IdmIdentity_.id), currentId),
                        subRoot.get(VsSystemImplementer_.role).get(IdmRole_.id).in(roles))));

The issue is that when user has more roles, the queries can be slow. The whole query can be optimize with transformation into one query or at least use findId instead of findValidRoles.

No data to display

Actions

Also available in: Atom PDF