Merge branch 'develop' into feature/SUPPORT-9276_blocked_filter
This commit is contained in:
commit
bb87bf48ee
6 changed files with 65 additions and 26 deletions
|
|
@ -16,6 +16,7 @@ import ru.micord.ervu.account_applications.component.model.Account;
|
|||
import ru.micord.ervu.account_applications.component.model.Person;
|
||||
import ru.micord.ervu.account_applications.component.model.dto.SearchRequest;
|
||||
import ru.micord.ervu.account_applications.component.model.dto.SearchResponse;
|
||||
import ru.micord.ervu.account_applications.dao.RecruitmentDao;
|
||||
import ru.micord.ervu.account_applications.security.context.SecurityContext;
|
||||
import ru.micord.ervu.account_applications.security.model.jwt.UserSession;
|
||||
import ru.micord.ervu.account_applications.security.model.role.ErvuRoleAuthority;
|
||||
|
|
@ -30,15 +31,20 @@ import ru.cg.webbpm.modules.webkit.beans.Behavior;
|
|||
*/
|
||||
@Service
|
||||
public class AccountGridLoadService extends Behavior implements GridService {
|
||||
private static final String DOMAIN_IDS = "domainIds";
|
||||
private static final String DOMAIN_ID = "domainId";
|
||||
private final SecurityContext securityContext;
|
||||
private final AccountFetchService accountService;
|
||||
@Value("${ervu.role.admin:#{null}}")
|
||||
private String ervuAdminRole;
|
||||
private final RecruitmentDao recruitmentDao;
|
||||
@Value("${ervu.security.role:#{null}}")
|
||||
private String ervuSecurityRole;
|
||||
|
||||
public AccountGridLoadService(SecurityContext securityContext,
|
||||
AccountFetchService accountService) {
|
||||
AccountFetchService accountService,
|
||||
RecruitmentDao recruitmentDao) {
|
||||
this.securityContext = securityContext;
|
||||
this.accountService = accountService;
|
||||
this.recruitmentDao = recruitmentDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -105,16 +111,30 @@ public class AccountGridLoadService extends Behavior implements GridService {
|
|||
Map<String, Object> filterMap = new HashMap<>();
|
||||
UserSession userSession = securityContext.getUserSession();
|
||||
Set<ErvuRoleAuthority> roles = userSession.roles();
|
||||
if (ervuAdminRole == null
|
||||
|| roles.stream().noneMatch(role -> role.getAuthority().equals(ervuAdminRole))) {
|
||||
filterMap.put("domainId", securityContext.getDomainId());
|
||||
if (ervuSecurityRole == null
|
||||
|| roles.stream().noneMatch(role -> role.getAuthority().equals(ervuSecurityRole))) {
|
||||
List<String> domainIds = recruitmentDao.getRecruitmentIdsWithParentByDomainId(securityContext.getDomainId());
|
||||
filterMap.put(DOMAIN_IDS, domainIds.toArray());
|
||||
}
|
||||
if (filters != null && filters.length > 0) {
|
||||
filterMap.putAll(Arrays.stream(filters)
|
||||
.filter(filter -> filter.getFilterModels() != null && filter.getFilterModels().length > 0)
|
||||
.collect(Collectors.toMap(
|
||||
filter -> getScriptInObject(filter.componentGuid, StaticFilterComponent.class).name,
|
||||
filter -> filter.getFilterModels()[0].value,
|
||||
filter -> {
|
||||
String filterName = getScriptInObject(filter.componentGuid, StaticFilterComponent.class).name;
|
||||
if (DOMAIN_ID.equals(filterName)) {
|
||||
return DOMAIN_IDS;
|
||||
}
|
||||
return filterName;
|
||||
},
|
||||
filter -> {
|
||||
String filterName = getScriptInObject(filter.componentGuid, StaticFilterComponent.class).name;
|
||||
Object filterValue = filter.getFilterModels()[0].value;
|
||||
if (DOMAIN_ID.equals(filterName)) {
|
||||
return recruitmentDao.getRecruitmentIdsWithParentByDomainId(filterValue.toString()).toArray();
|
||||
}
|
||||
return filterValue;
|
||||
},
|
||||
(existing, replacement) -> replacement
|
||||
))
|
||||
);
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ public class RecruitmentGridService extends GridV2ServiceImpl {
|
|||
@LocalGraphSource(sourceFieldName = "loadDao")
|
||||
@NotNull
|
||||
public EntityColumn recruitmentColumn;
|
||||
@Value("${ervu.role.admin:security_administrator}")
|
||||
private String ervuAdminRole;
|
||||
@Value("${ervu.security.role:security_administrator}")
|
||||
private String ervuSecurityRole;
|
||||
|
||||
public RecruitmentGridService(RecruitmentDao recruitmentDao, SecurityContext securityContext) {
|
||||
this.recruitmentDao = recruitmentDao;
|
||||
|
|
@ -54,8 +54,8 @@ public class RecruitmentGridService extends GridV2ServiceImpl {
|
|||
List<String> recruitmentIds;
|
||||
List<Filter> updatedFilters = new ArrayList<>(Arrays.asList(filters));
|
||||
Optional<Filter> recruitmentFilterOpt = findRecruitmentFilter(updatedFilters);
|
||||
if (ervuAdminRole != null && roles.stream().anyMatch(role -> role.getAuthority().equals(
|
||||
ervuAdminRole))) {
|
||||
if (ervuSecurityRole != null && roles.stream().anyMatch(role -> role.getAuthority().equals(
|
||||
ervuSecurityRole))) {
|
||||
recruitmentIds = recruitmentFilterOpt.map(
|
||||
filter -> getChildRecruitmentIds(updatedFilters, filter))
|
||||
.orElseGet(this::getAllRecruitmentIds);
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ public class TreeItemService {
|
|||
public EntityColumn businessIdColumn;
|
||||
@GraphSource(value = TreeItemRpcService.class, scanMode = GraphSource.ScanMode.SELF)
|
||||
public EntityColumn domainIdColumn;
|
||||
@Value("${ervu.role.admin:security_administrator}")
|
||||
private String ervuAdminRole;
|
||||
@Value("${ervu.security.role:security_administrator}")
|
||||
private String ervuSecurityRole;
|
||||
|
||||
public TreeItemService(SecurityContext securityContext) {
|
||||
this.securityContext = securityContext;
|
||||
|
|
@ -59,8 +59,8 @@ public class TreeItemService {
|
|||
UserSession userSession = securityContext.getUserSession();
|
||||
Set<ErvuRoleAuthority> roles = userSession.roles();
|
||||
List<TreeItemDto> filteredTreeItems = loadTreeItems();
|
||||
if (ervuAdminRole == null || roles.stream().noneMatch(role -> role.getAuthority().equals(
|
||||
ervuAdminRole))) {
|
||||
if (ervuSecurityRole == null || roles.stream().noneMatch(role -> role.getAuthority().equals(
|
||||
ervuSecurityRole))) {
|
||||
filteredTreeItems = filteredTreeItems.stream()
|
||||
.filter(item -> item.domainId.equalsIgnoreCase(domainId))
|
||||
.toList();
|
||||
|
|
|
|||
|
|
@ -445,6 +445,11 @@
|
|||
.webbpm.account-applications grid-v2 {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.webbpm.account-applications grid-v2 {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.webbpm.account-applications * + grid-v2,
|
||||
.webbpm.account-applications grid-v2 ~ *:not([hidden]) {
|
||||
margin-top: var(--indent-small);
|
||||
|
|
@ -461,13 +466,12 @@
|
|||
.webbpm.account-applications ag-grid-angular .ag-filter .ag-filter-condition ~ * {
|
||||
display: none !important;
|
||||
}
|
||||
.webbpm.account-applications ag-grid-angular .ag-root-wrapper {
|
||||
.webbpm.account-applications ag-grid-angular :is(.ag-root-wrapper, .ag-header-viewport, .ag-header-container, .ag-header) {
|
||||
background-color: transparent;
|
||||
}
|
||||
.webbpm.account-applications ag-grid-angular .ag-header {
|
||||
border-top: 1px solid var(--btn-border);
|
||||
border-radius: 0;
|
||||
background-color: transparent;
|
||||
}
|
||||
.webbpm.account-applications ag-grid-angular .ag-header-row {
|
||||
color: var(--color-text-mute);
|
||||
|
|
|
|||
|
|
@ -75,6 +75,9 @@ body.webbpm.account-applications {
|
|||
--w-screen: min(calc(2*var(--w-content)), 2.5rem); /*40*/
|
||||
--h-header: 60px;
|
||||
}
|
||||
.webbpm.account-applications [class*="ag-theme-"] {
|
||||
--ag-modal-overlay-background-color: transparent !important;
|
||||
}
|
||||
|
||||
.webbpm.account-applications a {
|
||||
color: var(--color-link);
|
||||
|
|
|
|||
|
|
@ -875,7 +875,6 @@
|
|||
<componentRootId>a2091daf-e287-4f38-a35f-46bde202f639</componentRootId>
|
||||
<name>Collapsible panel</name>
|
||||
<container>true</container>
|
||||
<expanded>false</expanded>
|
||||
<childrenReordered>false</childrenReordered>
|
||||
<scripts id="65283686-768f-44f9-9621-0c8327d90f11">
|
||||
<properties>
|
||||
|
|
@ -902,7 +901,6 @@
|
|||
<componentRootId>ca69506d-fd9f-43b7-8d18-d03c3b5fa756</componentRootId>
|
||||
<name>Filter group</name>
|
||||
<container>true</container>
|
||||
<expanded>false</expanded>
|
||||
<childrenReordered>false</childrenReordered>
|
||||
<scripts id="3f5f352c-1a86-4702-a914-6c163c903157">
|
||||
<properties>
|
||||
|
|
@ -924,6 +922,12 @@
|
|||
<simple>true</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>skipInitialLoading</key>
|
||||
<value>
|
||||
<simple>false</simple>
|
||||
</value>
|
||||
</entry>
|
||||
</properties>
|
||||
</scripts>
|
||||
<scripts id="b5dcccfd-643a-4c8c-aa3b-a44da851a86a">
|
||||
|
|
@ -1032,6 +1036,12 @@
|
|||
<childrenReordered>false</childrenReordered>
|
||||
<scripts id="d524f4d7-efdc-45ac-a9a5-a160e241b871">
|
||||
<properties>
|
||||
<entry>
|
||||
<key>collectible</key>
|
||||
<value>
|
||||
<simple>false</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>label</key>
|
||||
<value>
|
||||
|
|
@ -1049,6 +1059,12 @@
|
|||
<value>
|
||||
<simple>true</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>treeValuesCacheStrategy</key>
|
||||
<value>
|
||||
<simple>"BY_PAGE_OBJECT_ID"</simple>
|
||||
</value>
|
||||
</entry>
|
||||
</properties>
|
||||
</scripts>
|
||||
|
|
@ -1154,7 +1170,6 @@
|
|||
<componentRootId>55ffb039-3d8b-4e49-a0fa-e15b703f578e</componentRootId>
|
||||
<name>Vbox_current_user</name>
|
||||
<container>true</container>
|
||||
<expanded>false</expanded>
|
||||
<childrenReordered>false</childrenReordered>
|
||||
<scripts id="bf098f19-480e-44e4-9084-aa42955c4d0f">
|
||||
<properties>
|
||||
|
|
@ -1978,7 +1993,6 @@
|
|||
<componentRootId>cd396279-39e3-459f-a8b6-af9894753da7</componentRootId>
|
||||
<name>Vbox</name>
|
||||
<container>true</container>
|
||||
<expanded>false</expanded>
|
||||
<childrenReordered>false</childrenReordered>
|
||||
<scripts id="bf098f19-480e-44e4-9084-aa42955c4d0f">
|
||||
<properties>
|
||||
|
|
@ -2651,7 +2665,6 @@
|
|||
<componentRootId>03d3b749-1cc7-4f37-a8c1-701ffb00762e</componentRootId>
|
||||
<name>Hbox</name>
|
||||
<container>true</container>
|
||||
<expanded>false</expanded>
|
||||
<childrenReordered>false</childrenReordered>
|
||||
<scripts id="bf098f19-480e-44e4-9084-aa42955c4d0f">
|
||||
<properties>
|
||||
|
|
@ -4462,7 +4475,6 @@
|
|||
<componentRootId>df951b69-a0bb-422e-b3ef-f5976671dba1</componentRootId>
|
||||
<name>Grid</name>
|
||||
<container>true</container>
|
||||
<expanded>false</expanded>
|
||||
<childrenReordered>false</childrenReordered>
|
||||
<scripts id="07201df9-ff33-4c71-9aae-a2cfdd028234">
|
||||
<properties>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue