Security (aka Permissions) and Lucene - How ? Should it be done?

后端 未结 4 1976
你的背包
你的背包 2020-12-13 04:42

First some background to my question.

  • Individual entities can have read Permissions.
  • If a user fails a read permission check they cant see th
4条回答
  •  攒了一身酷
    2020-12-13 05:40

    It depends on your security model. If permissions are simple - say you have three classes of documents - It is probably best to build a separate Lucene index per class, and merge the results when a user can see more than one class. The Solr security Wiki suggests something similar to HakonB's suggestion - adding user's credentials to the query and searching by them. See also this discussion in the Lucene user group. Another strategy will be to wrap the Lucene search with a separate security class that does additional filtering out of Lucene. It may be faster if you can do this using a database for the permissions.

    Edit: I see you have a rather complex permission system. Your basic design choice is whether to implement it inside Lucene or outside Lucene. My advice is to use Lucene as a search engine (its primary strength) and use another system/application for security. If you choose to use Lucene for security anyway, I suggest you learn Lucene Filters well, and use a bitset filter in order to filter a query's results. It does have the problems you listed of having to keep the permissions updated.

提交回复
热议问题