Subject Re: [firebird-support] Firebird 1.5 Users Question
Author Stefan Heymann
Hi David,

> I'm developing a security module in Delphi 7 using Firebird 1.5.
> I am looking for a way to list ALL Firebird users, so they can be
> selected and rights assigned to them.

> I have seen the Security.fdb, should I access it directly or are there
> API calls.

In Firebird 1.5, you can access it directly. However, there is a
"Services API", which you should prefer, because from Firebird 2.0 on,
the security database can only be accessed via the Services API.

> If I access it directly is there a way of getting the
> correct connection string?

Do you use IbObjects? If so, you can use this call to retrieve the
path&filename of the security database on the server:

SecurityDbName := IB_Session.GetISC4Path (Server, cpTCP_IP, 'SYSDBA',
'masterkey');

In InterBase, the security database used to be isc4.gdb, so that's
where the method name comes from.

I use this SQL to get a list of users:

select user_name, first_name, last_name from users
order by 1

In order to create a new user, you can use
IB_Connection.AlterUser(uaAddUser, UserName, Password, '', FirstName, MiddleName, LastName);

To change a user's first/middle/last name, I use a simple UPDATE
(which will not work with FB2 anymore).

To modify a user's password:

IB_Connection.AlterUser(uaModifyUser, UserName, Password, '', FirstName, MiddleName, LastName);

To delete a user:

IB_Connection.AlterUser (uaDeleteUser, UserName, '', '', '', '', '');


As I have learned just today, the character set for the security
database is ASCII, so can't savely store any other characters than
7-bit ASCII characters (no international characters like accents,
umlauts, etc.). It's surely a good idea to prevent your user manager
from using characters > #126.


Best Regards

Stefan


--
Stefan Heymann
www.destructor.de/firebird