Skip to content

Commit

Permalink
add roles from config setting
Browse files Browse the repository at this point in the history
  • Loading branch information
marevol committed Jun 23, 2024
1 parent f00d9b1 commit 19181a9
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import org.codelibs.fess.helper.CrawlerStatsHelper;
import org.codelibs.fess.helper.CrawlerStatsHelper.StatsAction;
import org.codelibs.fess.helper.CrawlerStatsHelper.StatsKeyObject;
import org.codelibs.fess.mylasta.direction.FessConfig;
import org.codelibs.fess.helper.PermissionHelper;
import org.codelibs.fess.helper.SystemHelper;
import org.codelibs.fess.util.ComponentUtil;
Expand Down Expand Up @@ -304,6 +305,7 @@ protected void processDriveItem(final DataConfig dataConfig, final IndexUpdateCa
final Office365Client client, final Function<GraphServiceClient<Request>, DriveRequestBuilder> builder, final DriveItem item,
final List<String> roles) {
final CrawlerStatsHelper crawlerStatsHelper = ComponentUtil.getCrawlerStatsHelper();
final FessConfig fessConfig = ComponentUtil.getFessConfig();
final String mimetype;
final Hashes hashes;
final Map<String, Object> dataMap = new HashMap<>(defaultDataMap);
Expand Down Expand Up @@ -406,6 +408,9 @@ protected void processDriveItem(final DataConfig dataConfig, final IndexUpdateCa
final PermissionHelper permissionHelper = ComponentUtil.getPermissionHelper();
StreamUtil.split(paramMap.getAsString(DEFAULT_PERMISSIONS), ",")
.of(stream -> stream.filter(StringUtil::isNotBlank).map(permissionHelper::encode).forEach(permissions::add));
if (defaultDataMap.get(fessConfig.getIndexFieldRole()) instanceof List<?> roleTypeList) {
roleTypeList.stream().map(s -> (String) s).forEach(permissions::add);
}
filesMap.put(FILE_ROLES, permissions.stream().distinct().collect(Collectors.toList()));

resultMap.put(FILE, filesMap);
Expand Down

0 comments on commit 19181a9

Please sign in to comment.