You are not logged in.
Pages: 1
with the latest versions occurs the error "missing class in Model" when I try to add a user in the table TSQLAuthUser. If, however, point to the name of the two tables in my Model works.
But I have seen this piece of code in the file SQLite3Commons and in theory it should not be necessary to inform it if I put the parameter "HandleAuthentication = True".
I ask this because I use the same model to create a local connection (without authentication) and if I point out the tables and TSQLAuthUser TSQLAuthGroup the program I change the parameter "HandleAuthentication from False to True" with all the consequences.
constructor TSQLRestServer.Create(aModel: TSQLModel; aHandleUserAuthentication: boolean);
var i,n: integer;
C: PtrInt;
M: PMethodInfo;
// RI: PReturnInfo; // such RTTI info not available at least in Delphi 7
begin
// specific server initialization
fVirtualTableDirect := true; // faster direct Static call by default
fAuthUserIndex := aModel.GetTableIndex(TSQLAuthUser);
fAuthGroupIndex := aModel.GetTableIndex(TSQLAuthGroup);
fHandleAuthentication := (fAuthUserIndex>=0) and (fAuthGroupIndex>=0);
if aHandleUserAuthentication and (not fHandleAuthentication) then begin
// we need both AuthUser+AuthGroup tables for authentication -> create now
if fAuthUserIndex<0 then
aModel.AddTable(TSQLAuthUser,@fAuthUserIndex);
if fAuthGroupIndex<0 then
aModel.AddTable(TSQLAuthGroup,@fAuthGroupIndex);
fHandleAuthentication := true;
end;
...
thanks corchi
Offline
The model should not be shared, but each TSQLRestServer instance should have its own TSQLModel instance.
This is not the only modification made to the TSQLModel of the server (e.g. if tables are external DB tables and other features implemented by TSQLModelRecordProperties in current trunk version), so it is mandatory not to share the model.
You can use constructor TSQLModel.Create(CloneFrom: TSQLModel) to make a safe copy of an existing model, or - even better IMHO - create a shared function returning a generic TSQLModel instance.
Offline
I'm sorry but I did not understand I always declare or not? because before in older versions did not serve its reporting the two tables "TSQLAuthUser, TSQLAuthGroup" in the model, because they were created and added to the model if you indicated the parameter "aHandleUserAuthentication" (as shown in the code above), but now in addition to indicating the parameter "aHandleUserAuthentication "is required to manually add the two tables" TSQLAuthUser, TSQLAuthGroup "otherwise the error occurs in the subject. you is?
FileTabs: array[0..10] of TFileRibbonTabParameters = (
(
// (Table: TSQLAuthUser; Select: REL_SELECT; Group: GROUP_MAIN; FieldWidth: 'IddId'; Actions: DEF_ACTIONS),
// (Table: TSQLAuthGroup; Select: REL_SELECT; Group: GROUP_MAIN; FieldWidth: 'IddId'; Actions: DEF_ACTIONS),
(Table: TSQLOption; Select: REL_SELECT; Group: GROUP_MAIN; FieldWidth: 'IddId'; Actions: DEF_ACTIONS),
(Table: TSQLConnection; Select: REL_SELECT; Group: GROUP_MAIN; FieldWidth: 'IddId'; Actions: DEF_ACTIONS),
....
)
Offline
You need the two TSQLAuthUser and TSQLAuthGroup only if authentication is required.
No need to add those to the UI.
Just do not re-use a TSQLModel instance, but use a dedicated one per server.
Offline
the error is in the fact that is assigned the value of a variable regardless of the parameter "aHandleUserAuthentication "
fHandleAuthentication := (fAuthUserIndex>=0) and (fAuthGroupIndex>=0);
I would write:
if aHandleUserAuthentication and (not (fAuthUserIndex>=0) and (fAuthGroupIndex>=0)) then begin
// we need both AuthUser+AuthGroup tables for authentication -> create now
if fAuthUserIndex<0 then
aModel.AddTable(TSQLAuthUser,@fAuthUserIndex);
if fAuthGroupIndex<0 then
aModel.AddTable(TSQLAuthGroup,@fAuthGroupIndex);
fHandleAuthentication := true;
end;
Offline
You are right: there was an issue in TSQLRestServer.Create() about authentication enabling.
The fix included in http://synopse.info/fossil/info/073074697e is a bit diverse than yours, which will fail if the tables already exists.
Offline
ok thanks!
Offline
Pages: 1