Subject | Re: Multiple Company Data in 1 Database |
---|---|
Author | iananewby |
Post date | 2002-03-27T15:21:38Z |
Hi Damian,
How about this example.
create table data (
company_id integer,
key integer,
data integer
)
create table useraccess (
company_id integer,
user_id varchar(8))
create view u_data (key, data) as
select d.key, d.data from data d join useraccess u on u.compang_id
= d.company_id where u.user_id = current_user;
If you give all your users access to the views only then they can
only ever see the information for the company they can see. If you
want a user to be able to see multiple companies data, return the
company_id in the view and allow multiple companies per user in the
useraccess table.
Regards
Ian Newby
How about this example.
create table data (
company_id integer,
key integer,
data integer
)
create table useraccess (
company_id integer,
user_id varchar(8))
create view u_data (key, data) as
select d.key, d.data from data d join useraccess u on u.compang_id
= d.company_id where u.user_id = current_user;
If you give all your users access to the views only then they can
only ever see the information for the company they can see. If you
want a user to be able to see multiple companies data, return the
company_id in the view and allow multiple companies per user in the
useraccess table.
Regards
Ian Newby