mORMot and Open Source friends
Check-in [073074697e]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:fixed issue in TSQLRestServer.Create() about authentication enabling
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 073074697ec7f49ba1954626a339479732a933d8
User & Date: abouchez 2012-10-12 14:16:13
Context
2012-10-12
14:39
small comment enhancement check-in: 651be6639c user: abouchez tags: trunk
14:16
fixed issue in TSQLRestServer.Create() about authentication enabling check-in: 073074697e user: abouchez tags: trunk
13:43
* introducing TInterfaceStub and TInterfaceMock classes to define high-performance interface stubbing and mocking via a fluent interface * added dedicated EInterfaceFactoryException * added TServiceMethod.DefaultResult property, to be used for stubs/mocks * TServiceFactory.Create() and its children will now alwyas have an optional aContractExpected parameter (for consistency with TServiceFactoryClient)
check-in: 7e021f8fa8 user: abouchez tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to SQLite3/SQLite3Commons.pas.

694
695
696
697
698
699
700

701
702
703
704
705
706
707
....
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
.....
17969
17970
17971
17972
17973
17974
17975
17976
17977
17978
17979
17980
17981
17982
17983
17984
17985
17986
17987
17988
17989
17990
    - huge code refactoring of the ORM model implementation: a new dedicated
      TSQLModelRecordProperties will contain per-TSQLModel parameters, whereas
      shared information retrieved by RTTI remain in TSQLRecordProperties - this
      will allow use of the same TSQLRecord in several TSQLModel at once, with
      dedicated SQL auto-generation and external DB settings
    - added aExternalTableName/Database optional parameters to method
      TSQLModel.VirtualTableRegister()

    - added TSQLModel.URIMatch() method to allow sub-domains generic matching
      at database model level (so that you can set root='/root/sub1' URIs)
    - TSQLAuthUser and TSQLAuthGroup have now "index ..." attributes to their
      RawUTF8 properties, to allow direct handling in external databases
    - new protected TSQLRestServer.InternalAdaptSQL method, extracted from URI()
      process to also be called by TSQLRestServer.InternalListJSON() for proper
      TSQLRestServerStatic.AdaptSQLForEngineList(SQL) call
................................................................................
    // calls are to be made if tables should be managed as external
    constructor Create(TabParameters: PSQLRibbonTabParameters;
      TabParametersCount, TabParametersSize: integer;
      const NonVisibleTables: array of TSQLRecordClass; const aRoot: RawUTF8='root'); overload;
    /// release associated memory
    destructor Destroy; override;
    /// add the class if it doesn't exist yet
    // - return true if not existing yet and successfully added (in this case,
    // aTableIndexCreated^ is set to the newly created index in Tables[])
    // - supplied class will be redefined as non-virtual: VirtualTableExternalRegister
    // explicit call is to be made if table should be managed as external
    function AddTable(aTable: TSQLRecordClass; aTableIndexCreated: PInteger=nil): boolean;
    /// get the index of aTable in Tables[]
    function GetTableIndex(aTable: TSQLRecordClass): integer; overload;
    /// get the index of a table in Tables[]
................................................................................
    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;
  // abstract MVC initalization
  inherited Create(aModel);
  fStats := TSQLRestServerStats.Create;
  InitializeCriticalSection(fSessionCriticalSection);
  // retrieve published methods
  fPublishedMethods.Init(false);






>







 







|







 







|
|





<







694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
....
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
.....
17970
17971
17972
17973
17974
17975
17976
17977
17978
17979
17980
17981
17982
17983

17984
17985
17986
17987
17988
17989
17990
    - huge code refactoring of the ORM model implementation: a new dedicated
      TSQLModelRecordProperties will contain per-TSQLModel parameters, whereas
      shared information retrieved by RTTI remain in TSQLRecordProperties - this
      will allow use of the same TSQLRecord in several TSQLModel at once, with
      dedicated SQL auto-generation and external DB settings
    - added aExternalTableName/Database optional parameters to method
      TSQLModel.VirtualTableRegister()
    - fixed issue in TSQLRestServer.Create() about authentication enabling  
    - added TSQLModel.URIMatch() method to allow sub-domains generic matching
      at database model level (so that you can set root='/root/sub1' URIs)
    - TSQLAuthUser and TSQLAuthGroup have now "index ..." attributes to their
      RawUTF8 properties, to allow direct handling in external databases
    - new protected TSQLRestServer.InternalAdaptSQL method, extracted from URI()
      process to also be called by TSQLRestServer.InternalListJSON() for proper
      TSQLRestServerStatic.AdaptSQLForEngineList(SQL) call
................................................................................
    // calls are to be made if tables should be managed as external
    constructor Create(TabParameters: PSQLRibbonTabParameters;
      TabParametersCount, TabParametersSize: integer;
      const NonVisibleTables: array of TSQLRecordClass; const aRoot: RawUTF8='root'); overload;
    /// release associated memory
    destructor Destroy; override;
    /// add the class if it doesn't exist yet
    // - return index in Tables[] if not existing yet and successfully added (in this case,
    // aTableIndexCreated^ is set to the newly created index in Tables[])
    // - supplied class will be redefined as non-virtual: VirtualTableExternalRegister
    // explicit call is to be made if table should be managed as external
    function AddTable(aTable: TSQLRecordClass; aTableIndexCreated: PInteger=nil): boolean;
    /// get the index of aTable in Tables[]
    function GetTableIndex(aTable: TSQLRecordClass): integer; overload;
    /// get the index of a table in Tables[]
................................................................................
    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);
  if aHandleUserAuthentication then begin
    fHandleAuthentication := true;
    // 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);

  end;
  // abstract MVC initalization
  inherited Create(aModel);
  fStats := TSQLRestServerStats.Create;
  InitializeCriticalSection(fSessionCriticalSection);
  // retrieve published methods
  fPublishedMethods.Init(false);