Home DADE

Advantage daAds.pas checkrights

edited August 2007 in DADE
Hi

I think I metioned this a long time ago , but didnt pursue it, but is now
causing problems.
When using advantage tables there is a setting checkrights=false

This allows the system/advantage app to access data without the user have
write access to the data folder. However in report builder there is no
option for this. This means we have to give users access to folders we
don't want to, otherwise users get the common, daMetacache, unable to find
table problem.

Is there a way we can build it into the daAds.pas somehow ?

Thanks

Andy Dyble

Comments

  • edited August 2007
    Hi Andy,

    The nice thing about the DADE plugin architecture is that you can alter the
    plugins to meet your specific needs. DADE uses the TdaDataSet.GetTable to
    either create or get an existing table. This routine is overridden in the
    TdaADSDataSet class. Simply adding a line of code to set the ADSRightsCheck
    property to False should give you the effect you are after.

    FTable.AdsTableOptions.AdsRightsCheck := False;

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2007
    Thanks Nico

    I'll implement this.

    We also found another offending line, that fixes the "unable to get tables"
    error.
    If we used an AdsConnection in the data settings of the template,
    then this line in the daAds.pas returns an empty string :
    GetTableNamesFromDirectory(aDatabaseName, aList);

    so we change as below. ANy comments would be handy.

    if lAdsConnection.IsDictionaryConn then
    GetTableNamesFromDictionary(lAdsConnection, aList)
    else
    //GetTableNamesFromDirectory(aDatabaseName, aList);

    changed last line to :
    GetTableNamesFromDirectory(lAdsConnection.GetConnectionPath, aList);


    Andy

  • edited August 2007
    Perhaps you are using an older version of daAds.pas, or perhaps I am not
    understanding.

    Here is the TdaADSSession.GetTableNames code in the daAds.pas installed with
    RB 10.....


    procedure TdaADSSession.GetTableNames(const aDatabaseName: String; aList:
    TStrings);
    var
    lAdsConnection: TAdsConnection;
    liIndex: Integer;
    begin

    aList.Clear;

    lAdsConnection := TAdsConnection(GetDatabaseForName(aDatabaseName));

    if (lAdsConnection = nil) then
    raise EDataError.CreateFmt('No AdsConnection found for database name:
    %s', [aDataBaseName]);

    if not (lAdsConnection.IsConnected) then
    lAdsConnection.IsConnected := True;

    if (lAdsConnection.IsDictionaryConn) or (lAdsConnection.ConnectPath = '')
    then
    lAdsConnection.GetTableNames(aList, '')
    else
    begin
    {only specify the file extension when using a connection path and not
    using the ads data dictionary}
    lAdsConnection.GetTableNames(aList, '*.ADT');
    lAdsConnection.GetTableNames(aList, '*.DBF');
    end;

    {strip off file extensions}
    for liIndex := 0 to aList.Count - 1 do
    begin
    aList[liIndex] := StringReplace(aList[liIndex], '.ADT', '',
    [rfIgnoreCase]);
    aList[liIndex] := StringReplace(aList[liIndex], '.DBF', '',
    [rfIgnoreCase]);
    end;

    end;

    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.