推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
simple2025
0D
V2EX  ›  Python

遇到关于 acl 的问题

  •  
  •   simple2025 · Feb 29, 2020 · 1966 views
    This topic created in 2411 days ago, the information mentioned may be changed or developed.

    我有一个订单页面
    管理员要看到所有的订单, 还有管理
    下游有看到自己的订单,table 包括 downstream_id
    代理要看到代理下面的下游的所有订单, table 包括 proxy_id
    我现在是这么做的
    管理员 /admin/admin/order_list
    , 下游 /admin/downstream/order_list
    代理 /admin/proxy/order_list
    现在的问题就是页面要copy, 两次,刚刚群里问了一下,这居然属于acl的问题, 我理解里面acl只包括操作呀, 难道也包括数据的过滤?

    1 replies  •  2020-02-29 16:17:45 +08:00
    freemoon
        1
    freemoon  
       Feb 29, 2020   ❤️ 1
    你这个场景其实是树形权限表结构,不太清楚你的表是如何设计的,按我的想法一个接口就可以了,接口的参数就是用户 id,查询订单的时候,订单有个商家 id,商家 id 可能有上级,在用户表中有个字段叫 father_id 表这个人的上级 id (当然这样设计需要限制代理商最大深度),查询语句:select * from order where agent_id in (select id from user where id=2 or father_id=2),这是最多两层的情况,如果有三个以上的层级,就需要递归查询把所有的 agent_id 拿到,再去查订单表了,如果是无限极那又是另一种处理情况了。。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2661 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 02:03 · PVG 10:03 · LAX 19:03 · JFK 22:03
    ♥ Do have faith in what you're doing.