Subject Re: [ib-support] Multiple Company Data in 1 Database
Author Lista de Discução Interbase
You could create a table that is filled up in a process in the client
application login, so the user will define the company data they want to
see, you create a record on the session_table, the make views reference
this table, or you could have a column in the users table that is updated
every time the user choose a company to look for data, the make views that
links to the user table and have a where clause that looks like this:

Select * from atable join user on (user.companyid = atable.companyid) and
user.login = USER

I think this kind of approach could work.

HTH

Alexandre

At 15:40 27/03/02 +0000, you wrote:
>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@...
>
>
>
>To unsubscribe from this group, send an email to:
>ib-support-unsubscribe@egroups.com
>
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/