安全性(又名权限)和 Lucene - 如何?应该这样做吗? [英] Security (aka Permissions) and Lucene - How ? Should it be done?

查看:9
本文介绍了安全性(又名权限)和 Lucene - 如何?应该这样做吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先介绍一下我的问题的背景.

First some background to my question.

  • 单个实体可以拥有读取权限.
  • 如果用户未通过 读取 权限检查,他们将无法看到该实例.
  • Individual entities can have read Permissions.
  • If a user fails a read permission check they cant see that instance.

该问题涉及引入 Lucene 并执行搜索,该搜索仅返回匹配实体实例的列表.然后,我的代码将需要一一过滤实体.这种方法效率极低,因为存在这样的情况:用户可能只能看到一小部分,而检查许多以返回少数并不理想.

The probelm relates to introducing Lucene and performing a search which simply returns a list of matching entity instances. My code would then need to filter entities one by one. This approach is extremely inefficient as the situation exists that a user may only be able to see a small minority and checking many to return a few is less than ideal.

开发人员将使用什么方法或如何解决此问题 - 请记住,索引和搜索是使用 Lucene 执行的?

What approaches or how would developers solve this problem - keeping in mind that indexing and searches are performed using Lucene ?

编辑

定义

  • 一个用户可能属于多个组.
  • 一个角色可能有很多组 - 这些可以更改.
  • 权限具有角色 -(间接).
  • X 可以拥有读取权限.
  • 角色的定义可以随时更改.

索引

  • 在索引时添加组集(扩展权限)可能会导致角色的成员组列表更改时定义变得不同步.
  • 我希望避免在权限/角色的定义发生更改时重新索引 X.

安全检查

  • 要通过权限检查,用户必须属于一组组中的组,该组属于给定权限的角色.

推荐答案

这取决于与您的上下文相关的不同安全组的数量以及安全性如何应用于您的索引数据.

It depends on the number of different security groups that are relevant in your context and how the security applies to your indexed data.

我们遇到了一个类似的问题,我们通过以下方式解决了这个问题:在索引时,我们将允许的组添加到文档中,在搜索时,我们添加了一个布尔查询,其中包含用户所属的组.这在我们的场景中表现良好.

We had a similar issue which we solved the following way: When indexing we added the allowed groups to the document and when searching we added a boolean query with the groups the user was a member of. That performed well in our scenario.

这篇关于安全性(又名权限)和 Lucene - 如何?应该这样做吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆