Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] fix data-permission namespace problem #5654

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@

package org.apache.shenyu.admin.model.dto;

import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;

import java.io.Serializable;

/**
Expand All @@ -36,14 +37,14 @@ public class NamespaceDTO implements Serializable {
/**
* namespace name.
*/
@Max(value = 255, message = "The maximum length is 255")
@Length(max = 255, message = "The maximum length is 255")
@NotNull(message = "namespace name not null")
private String name;

/**
* namespace description.
*/
@Max(value = 255, message = "The maximum length is 255")
@Length(max = 255, message = "The maximum length is 255")
@NotNull(message = "namespace description not null")
private String description;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,13 @@ public CommonPager<DataPermissionPageVO> listSelectorsByPage(final SelectorQuery
if (totalCount > 0) {
Supplier<Stream<SelectorDO>> selectorDOStreamSupplier = () -> selectorMapper.selectByQuery(selectorQuery).stream();
List<String> selectorIds = selectorDOStreamSupplier.get().map(SelectorDO::getId).collect(Collectors.toList());

Set<String> hasDataPermissionSelectorIds = new HashSet<>(dataPermissionMapper.selectDataIds(selectorIds,
userId, AdminDataPermissionTypeEnum.SELECTOR.ordinal()));


Set<String> hasDataPermissionSelectorIds = new HashSet<>();
if (!selectorIds.isEmpty()) {
hasDataPermissionSelectorIds.addAll(dataPermissionMapper.selectDataIds(selectorIds,
userId, AdminDataPermissionTypeEnum.SELECTOR.ordinal()));
}

selectorList = selectorDOStreamSupplier.get().map(selectorDO -> {
boolean isChecked = hasDataPermissionSelectorIds.contains(selectorDO.getId());
return DataPermissionPageVO.buildPageVOBySelector(selectorDO, isChecked);
Expand Down
Loading