Giter Site home page Giter Site logo

elasticsearch-authorization-query's Introduction

#elasticsearch-authorization-query/elasticsearch权限检查过滤插件

原理

  • 在索引文档中,使用固定字段[authorization] type=keyword/不分词,其内容为 [${authorizationUnit}=[${roleID}...];...],存储其权限值 如:CURRENCY=33504;DEPARTMENT=33107,33101;EXCHANGERATE=-1,223;
  • 分析${authorizationUnit}=[${roleID}...];...,转化成Map<${authorizationUnit},Set[${roleID}...]>,文档中限定了可以访问的roleid,如果条件中设计了其${authorizationUnit},其对应${roleID}集合中不匹配,则为false,被过滤掉
  • 例子: 索引文档中的数据为 CURRENCY=33504;DEPARTMENT=33107,1;MATERIAL=32311,32312; 查询是 条件 CURRENCY=33504;为true; 查询是 条件 CURRENCY=33503;为false; 查询是 条件 CURRENCY=33503;MATERIAL=32311为false; 查询是 条件 CURRENCY=33503;MATERIAL=32311,32312,32313为true; 查询是 条件 CURRENCY=33503;MATERIAL=32311,32312,32313;DEPARTMENT=33107,1为true;

检索语句,条件等式

  {
     "query":{
        "authorization" : {
            "authorization" : "${authorizationUnit}=[${roleID}...];..."
        }
     }
  }
  

例如

  {
     "query":{
        "authorization" : {
            "authorization" : "CURRENCY=33504;DEPARTMENT=33107;"
        }
     }
  }
  

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.