Subject RE: [firebird-support] Roles in Firebird
Author Alan McDonald
> Hi Alexandre...
>
> It's pretty much what I want, let me give tell what I need
> for and maybe
> you can give me hints...
>
> I have a table of clients (like we all do) containing a field called
> Balance. Now in my application users have privileges, a manager can see a
> balance while a regular user should not. I know this can be done at
> application level but I was wondering if it was possible to do it at
> database level, not to fetch 'forbidden' fields at all if not necessary.
>
> Now, if I want to write views, I'll have one that says for example:
>
> "select field1,field2,field3,balance from Clients"
>
> and another
>
> "select field1,field2,field3 from Clients" (without the balance field)
>
> and then in my application I have to check the roles of the users
> anyway to
> know which view to use...
>
> I was wondering if similar cases can be solved at Firebird
> database level...
>
> Thank you for your reposnses
> Vahan

I'm sure it can be done but you would need to write your own abstraction
layer. You would need to describe your roles in a role table and then have
tables containing fields for each role. then queries would need to
interrogate the field list for the role before constructing the field list
for the select. Seems like a lot of work and I'm not sure there is anything
specific in FB to do this although, on the other hand, there IS everything
you need to do it as well. I would think that the application level is as
good a place as any to do it though.
Alan