You are not logged in.
Pages: 1
SetUser() is returning true, but the SessionUser.Data isn't there (it's empty). The Data column in the database is *not* empty.
procedure TJournalVolumeClient.LoginUser(const userLogin, userPassword: string);
var
hashedPassword: RawUTF8;
...
userData: Variant;
begin
...
if FDatabase.SetUser(UnicodeStringToUTF8(userLogin), hashedPassword, true) then
begin
TDocVariant.New(userData);
userData := VariantLoadJSON(FDatabase.SessionUser.Data);
...
end;
Am I missing a step?
-David
Offline
OK, after digging around, I see the TSqlAuthUser 'Data' column isn't passed to the client. It's just on the server.
-David
Offline
And what is the best way to get the Data field client side? I have a TSQLUser class overriding TSQLAuthUser, and I need to have the Data field filled in the SessionUser. I've tried to do fClient.RetrieveBlobFields(fClient.SessionUser); as stated in the doc but it tell me I need TSQLAuthUser in the model, and if i do fClient.RetrieveBlob(TSQLUser, fClient.SessionUser.GetID, 'Data', fClient.SessionUser.Data); it tells me i'm not calling RetrieveBlob with the correct argument...
I can still do
fClient.RetrieveBlob(TSQLUser, fClient.SessionUser.GetID, 'Data', aTmpData);
fClient.SessionUser.Data := aTmpData;
but it seems weird
Am I missing something here?
Offline
Well I have a TSQLAuthUser in my model trough my TSQLUser class:
TSQLUser = class(TSQLAuthUser)
So yes, if I directly use TSQLAuthUser as my user table, RetrieveBlobFields() work well, but if i'm using my own inherited class it doesn't work, as GetTableIndex doesn't find TSQLAuthUser.
It seemed to me that mORMot only allowed one TSQLAuthUser per model, so I would think GetTableIndex should return my inherited class. Am i misunderstanding something?
Offline
Please check https://synopse.info/fossil/info/02bb7882b5
It will ensure that any inherited TSQLAuthUser class (e.g. your TSQLUser) will be used to create the fClient.SessionUser field.
Offline
As usual, thanks for your fast reply and your help, i've updated the library and everything is working as expected ; )
Offline
I'm trying to get a SessionUser.Data field, but unsuccessfully.
//user cTestUser was created with Data:='hello' and AuthGroup 'User'
RESTClient.SetUser(cTestUser,cTestPass); //true
RESTClient.RetrieveBlobFields(RESTClient.SessionUser); //there are False with 405 error (not allowed)
RESTClient.SessionUser.Data; // is empty
What am I doing wrong? Thanks.
With "Supervisor" group all works as expected, but I need to get Data for any user.
Last edited by hottabych (2019-04-05 12:34:01)
Offline
Is there a way to know how many requests are currently open in the TSQLRestServerFullMemory class?
Offline
Pages: 1