dongpengyu1363 2015-08-20 11:26
浏览 10

Symfony每个客户端登录多个数据库

I'm developping a webapplication in Symfony2. The website is supposed to have a database per client. My idea was to make a main database with information about all organizations and their databases. But now I'm running into some trouble.

Every client has their own users. This information should be stored in their own database. So in my opinion every client should have their own login page. Now I started by adding a prefix to see what client you are : example.com/{client}/ -> controllers .. The thing is you're not allowed to set a parameter in your route for a login page in symfony! So how should I make sure every client has a different login page?

Another thing is security. What is the best way to make sure a user cannot change the route parameter to a different client and get access?

I've been looking for guides on the internet to do what I need to do. But I can't find any solid ways for Symfony2 .. Mostly it's half solutions, for example just switching between the databases via a service. If there is another php framework that does all this much better I would definately consider changing to that too.

I hope you guys can give me some advice. Thanks in advance.

  • 写回答

2条回答 默认 最新

  • doubo82706 2015-08-20 12:43
    关注

    what you have is a multi instance database structure where each client has their own seperate database, how about using a multi tennant db structures where all clients are stored in one single db and website setup is done based on client id, that way no need for a seperate login page or database switching. if this is not a huge and significant change in project structure you could consider it. would be cheaper too

    if its impossible to change the project structure, then how about using subdomains instead of url slugs company.example.com in place of example.com/company

    评论

报告相同问题?

悬赏问题

  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测