Saving umbraco users in own database
# help-with-umbraco
s
Hi, I'm a trainee software dev at my company and I've been assigned a task to save backoffice users in our own database instead of the umbraco's one. I have very limited experience both with umbraco and .NET so I'm struggling to find a solution. I have a user service that has all the necessary commands to save and retrieve users from the database. Now I don't know what interface or class I need to implement on Umbraco's side. I was looking into BackOfficeUserStore and wondering if I can just use my user service there? Would that be enough?
w
Just to confirm, when you say back office users - do you mean users logging into Umbraco itself, or users logging into a members area on the public-facing website?
s
users logging into umbraco itself, I forgot to mention we're using umbraco 13
j
If you save to your own database instead of Umbraco then users may not be able to log in correctly. If you're saving to Umbraco and your database then I believe there are hooks you can use that are called when users are saved. Alternatively, if you're using straight Sql Server you can use a Trigger to watch the user table.
s
If you only need to "copy" the data and not store it somewhere else completly rather that umbraco DB, then a stored procedure in the SQL database could perhaps to the trick. The stored procedure will need a linked server to access the target server and database, but there are a lot of online tutorials and documentation for this. The the stored procedure could be triggered using the Notification system in Umbraco and run on member CRUD operations. This also prevents the Umbraco instance from doing the logic and keeping the handling of data on the SQL server. This both seperated the logic and keeps the Umbraco instance running as normal.
d
Out of interest what are the reason for storing the users in another DB? I know some people are making use of AAD for SSO for example.
r
I think this is an important question, and well done for asking it @Dean Leigh .. If you decide to save your users data elsewhere, you are denying yourself some of the built in actions and goodness of Umbraco .. as other have said there are plenty of workarounds and or alternatives
3 Views