Subject | RE: [IBO] users in firebird database |
---|---|
Author | Dmitriy A. Beloshistov |
Post date | 2008-04-18T14:30:27Z |
Install IBOAdmin package and use following code:
Procedure SAPISetSecServiceProps(Service:TIBOSecurityService;
IB_Connection:TIB_Connection);
begin
if not Assigned(Service) or
not Assigned(IB_Connection) then exit;
with Service do
begin
ServerName:=IB_Connection.Server;
UserName:=IB_Connection.Username;
Password:=IB_Connection.Password;
Protocol:=IB_Connection.Protocol;
Params.Clear;
Params.Add('user_name='+IB_Connection.Username);
Params.Add('password='+IB_Connection.Password);
LoginPrompt:=False;
end;
end;
Procedure SAPIGetUsersList(IB_Connection:TIB_Connection;
Users:TStrings);
var IBSS:TIBOSecurityService;
I:integer;
begin
if not Assigned(IB_Connection) then
raise Exception.Create(EXBDS_NOIBCONNECTION);
if not Assigned(Users) then exit;
Users.Clear;
IBSS:=TIBOSecurityService.Create(IB_Connection);
try
IBSS.SecurityAction:=ActionDisplayUser;
SAPISetSecServiceProps(IBSS,IB_Connection);
IBSS.Active:=True;
IBSS.DisplayUsers;
for i:=0 to Pred(IBSS.UserInfoCount) do
Users.Add(IBSS.UserInfo[i].UserName);
if Users.IndexOf('PUBLIC')=-1 then Users.Add('PUBLIC');
//23.02.2005,bds
IBSS.Active:=False;
finally IBSS.Free; end;
end;
Example:
L:=TStringList.Create;
Try
SAPIGetUsersList(MyIBConnection,L);
UserExists:=L.IndexOf('USERNAME')<>-1;
Finally L.Free; end;
WBR,Dmitry Beloshistov AKA [-=BDS=-]
-----Original Message-----
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On
Behalf Of Virtual Memory Developers of System
Sent: Thursday, April 17, 2008 6:24 PM
To: ibobjects@yahoogroups.com
Subject: [IBO] users in firebird database
How can I ask the database if the user exists registered in the
database? Use Delphi, IBO and Firebird
Thanks
Flavio Macedo
Procedure SAPISetSecServiceProps(Service:TIBOSecurityService;
IB_Connection:TIB_Connection);
begin
if not Assigned(Service) or
not Assigned(IB_Connection) then exit;
with Service do
begin
ServerName:=IB_Connection.Server;
UserName:=IB_Connection.Username;
Password:=IB_Connection.Password;
Protocol:=IB_Connection.Protocol;
Params.Clear;
Params.Add('user_name='+IB_Connection.Username);
Params.Add('password='+IB_Connection.Password);
LoginPrompt:=False;
end;
end;
Procedure SAPIGetUsersList(IB_Connection:TIB_Connection;
Users:TStrings);
var IBSS:TIBOSecurityService;
I:integer;
begin
if not Assigned(IB_Connection) then
raise Exception.Create(EXBDS_NOIBCONNECTION);
if not Assigned(Users) then exit;
Users.Clear;
IBSS:=TIBOSecurityService.Create(IB_Connection);
try
IBSS.SecurityAction:=ActionDisplayUser;
SAPISetSecServiceProps(IBSS,IB_Connection);
IBSS.Active:=True;
IBSS.DisplayUsers;
for i:=0 to Pred(IBSS.UserInfoCount) do
Users.Add(IBSS.UserInfo[i].UserName);
if Users.IndexOf('PUBLIC')=-1 then Users.Add('PUBLIC');
//23.02.2005,bds
IBSS.Active:=False;
finally IBSS.Free; end;
end;
Example:
L:=TStringList.Create;
Try
SAPIGetUsersList(MyIBConnection,L);
UserExists:=L.IndexOf('USERNAME')<>-1;
Finally L.Free; end;
WBR,Dmitry Beloshistov AKA [-=BDS=-]
-----Original Message-----
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On
Behalf Of Virtual Memory Developers of System
Sent: Thursday, April 17, 2008 6:24 PM
To: ibobjects@yahoogroups.com
Subject: [IBO] users in firebird database
How can I ask the database if the user exists registered in the
database? Use Delphi, IBO and Firebird
Thanks
Flavio Macedo