You are not logged in.
I'm using Interface Based Services in sicPerThread mode.
When my TSQLRestServerFullMemory service starts I want to be able to add additional TSQLAuthGroup records and/or modify the access rights. I also want to dynamically add/update/delete entries in this table at runtime.
I've overridden TSQLRestServerAuthenticationNone to support custom TSQLAuthUser creation via the GetUser() method, which works fine for external database user management. However, I want to use the existing TSQLAuthGroup functionality in mORMot.
My question is what is the best way to manage the AuthGroups table? I tried overriding the TSQLAuthGroup.InitializeTable() class method to populate the table at startup, but it doesn't get called because the TSQLAuthGroup and TSQLAuthUser classes are set early during service creation (so I can't create my own entries there).
I assume it's just a simple matter of having a routine that deletes existing records and adds new ones as needed at startup? Also, when the service is running, I'm assuming that any calls to update these tables (e.g. periodically calling a method to do this like MyRestServer.UpdateAuthGroups() from an external thread) will be thread-safe. Or is there something additional I need to do to ensure thread-safety during runtime?
Thanks
Last edited by avista (2014-07-13 04:08:06)
Offline
The DB layer access is thread-safe:there is a global lock for each table storage.
E.g. for TSQLRestServerFullMemory , it is via TSQLRestStorage.StorageLock()/StorageUnlock() calls.
So you can change the tables safely, from any thread.
Offline