public static S_FilterExit filterForGroups(S_FilterEntryOrEmpty q, String userOid, RepositoryService repositoryService, RelationRegistry relationRegistry, OperationResult result) throws SchemaException { return q.item(WorkItemType.F_CANDIDATE_REF).ref(getGroupsForUser(userOid, repositoryService, relationRegistry, result)); }
/** * Augments work item query by including filter to see only work items assigned to the current user or any of his delegators, * providing that the limitation(s) allow it. * * Note that work item limitations are supported only in the current (crude) form: all or none. */ public static S_AtomicFilterExit filterForAssignees(S_FilterEntryOrEmpty q, MidPointPrincipal principal, QName limitationItemName, RelationRegistry relationRegistry) { if (principal == null) { return q.none(); } else { return q.item(WorkItemType.F_ASSIGNEE_REF).ref(getPotentialAssigneesForUser(principal, limitationItemName, relationRegistry)); } }
protected void checkVisibleWorkItem(ExpectedWorkItem expectedWorkItem, int count, Task task, OperationResult result) throws SchemaException, ObjectNotFoundException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException, CommunicationException { S_AtomicFilterExit q = QueryUtils .filterForAssignees(prismContext.queryFor(WorkItemType.class), SecurityUtil.getPrincipal(), OtherPrivilegesLimitationType.F_APPROVAL_WORK_ITEMS, relationRegistry); List<WorkItemType> currentWorkItems = modelService.searchContainers(WorkItemType.class, q.build(), null, task, result); long found = currentWorkItems.stream().filter(wi -> expectedWorkItem == null || expectedWorkItem.matches(wi)).count(); assertEquals("Wrong # of matching work items", count, found); }
private ObjectFilter getReviewerAndEnabledFilterForWI(MidPointPrincipal principal) throws SchemaException { if (principal != null) { return QueryUtils.filterForAssignees( prismContext.queryFor(AccessCertificationWorkItemType.class), principal, OtherPrivilegesLimitationType.F_CERTIFICATION_WORK_ITEMS, relationRegistry) .and().item(F_CLOSE_TIMESTAMP).isNull() .buildFilter(); } else { return prismContext.queryFor(AccessCertificationWorkItemType.class) .item(F_CLOSE_TIMESTAMP).isNull() .buildFilter(); } }