Delphi Examples: DbiOpenSecurityList

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Delphi Examples: DbiOpenSecurityList

Return to chapter overview

Return the record-level security (password) information about a specified Paradox table and append it to the TStringList passed in.

This example uses the following input:

 fDbiOpenSecurityList(SecurityTable, SecurityList);

 

The procedure is:

procedure fDbiOpenSecurityList(Tbl: TTable; SecurityList: TStringList);

var

 TmpCursor: hdbicur;

 Security: SECDesc;

 result: dbiResult;

begin

 Check(DbiOpenSecurityList(Tbl.dbhandle, PChar(Tbl.TableName), nil, TmpCursor));

repeat

   result:= DbiGetNextRecord(TmpCursor, dbiNOLOCK, @Security, nil);

  if (result <> DBIERR_EOF) then begin

     SecurityList.Add('Security Descriptor: ' + IntToStr(Security.iSecNum));

    case Security.eprvTable of

       prvNone:     SecurityList.Add('No privilege');

       prvREADONLY: SecurityList.Add('Read only Table or Field');

       prvMODIFY:   SecurityList.Add('Read and Modify fields (non-key)');

       prvINSERT:   SecurityList.Add('Insert + All of above');

       prvINSDEL:   SecurityList.Add('Delete + All of above');

       prvFULL:     SecurityList.Add('Full Writes');

       prvUNKNOWN:  SecurityList.Add('Unknown');

    end;

     SecurityList.Add('Family Rights: ' + IntToStr (Security.iFamRights));

     SecurityList.Add('Session: ' + Security.szPassword);

  end;

until (Result <> DBIERR_NONE);

 Check(DbiCloseCursor(TmpCursor));

end;