Calibre Server -- Multi Tenant
Note: I am pretty new to contributing to open source projects (though I have done development work here and there for a lone time), so if I have made any mistakes in approaches or social gaffs, I apologize in advance.
I have wanted to have the server support offering different sets of books to different users. In looking through this forum, I saw that this has come up at least a couple of time in the past, but it looks like it is a bit further down Kovid's to-do list, so I figured I would take a whack at it from the server side...
My thought is to approach this using the username password mechanism that is already in place. so, depending on what username was used, a different virtual library would be selected. I know this limits this feature to devices or browsers that allow username password for opds (I don't know how limiting this is though) but it seems like it is a fair first step.
I considered trying for a url pattern for this (if security was not an issue), but in poking in the code, that seemed like that would be harder to implement (thoughts?)
I also plan on implementing it in an open enough way that hopefully it could integrate with future multi-user plans.
My main question is one of approach, I am sure I can back myself into this, but it seems easier to simply ask here: Based on some of the ways I have seen different web applications work, there are probably a couple of approaches to try here:
1. if the server class is instantiated for each connection, then I can check the user and set the virtual library restrictions at that point (I think this looks easier to do).
-or-
2. if the server class is instantiated once, and connections are passed to it for content, I may have to check each request or re-filter for each request. (probably not hard, but I haven't played enough with the db api to really get a good feeling for how hard... or not... this would be)
Thoughts? (overall thoughts? is this a dumb project, or just the wrong way of going about it? or something that is already solved I just wasn't smart enough to find the answer?)
Dan
|