简体   繁体   English

在 Laravel 如何管理嵌套的身份验证系统?

[英]In Laravel how to manage nested auth system?

I want to create architecture as the follow tree.我想将架构创建为跟随树。

  • Super-Admin超级管理员
    • Managers经理人
    • Editors编辑
    • Admins管理员
    • View-Only只读
    • Vendors (Can create Vendors profiles)供应商(可以创建供应商配置文件)

Super-Admin and Admin also can Create Vendors (Vendors table must be separate)超级管理员和管理员也可以创建供应商(供应商表必须是单独的)

Vendors can also directly Signup/Signin Each Vendor have their own users backend users and frontend users.供应商也可以直接注册/登录每个供应商都有自己的用户后端用户和前端用户。

  • Backend后端

    • Vendor小贩
      • Managers经理人
      • Editors编辑
      • Admins管理员
      • View-Only只读
      • Frontend Users (create frontend users profile)前端用户(创建前端用户配置文件)
  • Frontend Users前端用户

Front-end Users can also signup directly from frontend / social-login also allowed前端用户也可以直接从前端注册/社交登录也允许

Please help me how i will manage user Auth for this kind of architecture in Laravel?请帮助我如何在 Laravel 中为这种架构管理用户身份验证? I want front-end users table separate, vendors table separate and super-admins table separate.我希望前端用户表分开,供应商表分开,超级管理员表分开。 just to reduce data length in each table and easy to manage.只是为了减少每个表中的数据长度并且易于管理。

I don't know how i will make base structure for this, how group permissions will work with this complex structure.我不知道我将如何为此创建基本结构,组权限将如何与这个复杂的结构一起工作。

Want to use laravel-7+想用 laravel-7+

First look into RBAC (role based access control) to see how it is to have an idea.首先查看 RBAC(基于角色的访问控制),看看它是如何产生想法的。

Laravel authentication has guards that you can use to authenticate different users from different tables. Laravel身份验证具有可用于对来自不同表的不同用户进行身份验证的保护措施。 Just define different guards for each of your tables and use them wherever you want.只需为您的每张桌子定义不同的警卫,并在任何您想要的地方使用它们。

Also look at authorization .还要看授权 You can define different gates and policies for different user types to check their role and allow/deny them.您可以为不同的用户类型定义不同的门禁和策略,以检查他们的角色并允许/拒绝他们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM