我的 Symfony2.8 项目中有以下学说实体。
用户
id
email
username
password
组织
id
name
subdomain
用户组织
organization_id
user_id
roles
我需要从UserOrganization表中加载用户角色,那么如何覆盖 Symfony 身份验证流程以从“UserOrganization”实体加载用户角色。
笔记:
xyz.mydomain.com这里 xyz 是组织。
因此,当用户尝试从xyz子域登录时,Symfony2 必须从UserOrganization表中 xyz 组织的记录中读取用户的角色