userman icon indicating copy to clipboard operation
userman copied to clipboard

Support for database other than mongodb

Open dsuppiger opened this issue 11 years ago • 5 comments

Are there any plans to support other databases? I'm writing an application using Redis and need to add user management. Now I would like to implement Redis support for userman but want to discuss the approach. The most straightforward option would be to turn the UserManController into an interface and then implement various concrete classes for each supported db. The UserManSettings would need to be extended with some additional properties (e.g. databaseIndex for Redis).

dsuppiger avatar May 17 '14 19:05 dsuppiger

No concrete plans, yet, but this would be a welcome change. I think the interface suggestion is the quickest way to add support right now. I'm currently investigating in a DB abstraction, which would be ideal for this (dotter), but it's still in the experimentation phase.

As for the UserManSettings, I'd say that a single databaseURL field would be ideal (the databaseName field could then be deprecated). This would have the advantage that the MongoDB server (or cluster) and various other parameters could also be configured. For Redis, it would look like "redis://localhost:6379/0".

s-ludwig avatar May 18 '14 09:05 s-ludwig

The databaseURL is a good idea. So I'll do it this way then. A db abstraction layer would definitely be great although tricky with NoSQL.

dsuppiger avatar May 19 '14 17:05 dsuppiger

Yeah, the abstraction layer will definitely have to be limited to simple operations (at least at first), so there would still be at least some DB specific code.

s-ludwig avatar May 19 '14 17:05 s-ludwig

How would you handle the entity abstraction (User, AuthInfo, Group)? Currently they have properties with BSON types like BsonObjectID and BsonDate for easy (de)serialization which is mongodb specific. So far I came up with the following two options:

  1. Use the 'BSON classes' in an intermediate step and map them to more generic classes (with e.g. string id) to be exposed by the API?
  2. Implement UDAs to make the vibe.d BSON module treat properties with e.g. the attribute @("BsonObjectID") accordingly.

How would you go about it?

dsuppiger avatar May 29 '14 12:05 dsuppiger

I've discovered the serialization customization methods and implemented those.

dsuppiger avatar Aug 09 '14 20:08 dsuppiger