Subject Re: [ib-support] Multiple Company Data in 1 Database
Author Damian Dowling
At 15:00 27/03/2002, you wrote:
>We don't deal with companies but with Municipalities. What we did is .....
>
>1) Create a table of users
>2) Create a table of municipalities (or companies in your case)
>3) Create a table of user2munis which specifies which users have access
>to which munis.
>4) At logon the application checks to see which municipalities the
>person logging on has access to. If there is more than one, then the
>user selects which municipality he wants to work on. Then every select
>requires a WHERE MUNIID = :MUNIID to ensure that he can only see those
>records.
>
>This works well for us.
>
>Todd

I think you mis-understand. When User A logs in, a record is created that
says "User A with Session ID 123 wants to look at Company As Data".

The View would then look up the current Session ID to find out what records
the User is interested in. It is not security, but a way of selecting
records. For Example:

Create View CompanyData (DataKey, Data) as
select D.Datakey, D.Data from Data D join SessionTable ST on ST.CompanyID
= D.CompanyID where ST.user_id = Current_User and ST.Session_ID =
Current_Session;

My problem is how to get the Current_Session, Firebird must have something
similar internally, but i need access to it. Or at least some way to
duplicate it?

Regards


Damian Dowling
IT Manager
Pallas Foods Ltd

Phone: + 353 69 20200
Fax: + 353 69 20201
Email: damian-dowling@...