Solved SQLB-2079: Role-Based Access to Table; Table Does Not Show In MS Access

Post found bugs and possible workarounds.
Clifford Bass

SQLB-2079: Role-Based Access to Table; Table Does Not Show In MS Access

Post by Clifford Bass » 25 Oct 2012, 21:46

Hi,

When I grant a user access to a table through a role, then try to link to that table from within Microsoft Access using the user's credentials, the table does not show up as being one to which the user has access. Therefore the user cannot link to the table. At least not without also granting select access to the table directly to the user.

Here is a script. This happens using a 11.6.2 back end and using 11.6.x front end.

Code: Select all

connect island 1 sysadm/sysadm;

REMARK
\
  Create a user and a role and grant the role to the user.
/
grant connect to Me identified by My_Password;
create role My_Role;
grant role My_Role to Me;
commit;

REMARK
\
  Create a table and grant select on the table to the role.
/
create table My_Table_to_Link (
  A_Field smallint not null);
insert into My_Table_to_Link values (1);
grant select on My_Table_to_Link to role My_Role;
commit;

REMARK
\
  Test accessing the table by the new user.
/
connect island 2 Me/My_Password;
select * from SysAdm.My_Table_to_Link;
disconnect 2;

REMARK
\
  Start up Microsoft Access, create a new database and try to link to the table using the Me user.

  When I do it, the table does not show up in the list of tables.
/

REMARK
\
  Now grant the user direct access to the table.
/
grant select on My_Table_to_Link to Me;
commit;

REMARK
\
  Back in Microsoft Access, try again to link to the table using the Me user.

  When I do it, the table now shows (not surprisingly).

  Now remove the user's direct access to the table.
/
revoke select on My_Table_to_Link from Me;
commit;

REMARK
\
  Quit MS Access and reopen database see if the Me user can access the newly linked table.

  It works for me.  So the problem is only when getting the list of tables to which the user has access.  
/

REMARK
\
  Finally remove the user if desired.
/
revoke role My_Role from Me;
revoke connect from Me;
commit;

Mike Vandine

Re: SQLB-2079: Role-Based Access to Table; Table Does Not Show In MS Access

Post by Mike Vandine » 26 Oct 2012, 08:25

Hi Cliff,

Let me check this out and get back to you. What version of the ODBC drivers are you using?

Clifford Bass

Re: SQLB-2079: Role-Based Access to Table; Table Does Not Show In MS Access

Post by Clifford Bass » 29 Oct 2012, 18:34

Hi Mike,

The one from 7/17/2012. This is the 64-bit version. I have not tested it with the 32-bit version.

Cliff

Clifford Bass

Re: SQLB-2079: Role-Based Access to Table; Table Does Not Show In MS Access

Post by Clifford Bass » 19 Sep 2013, 01:49

Hi Mike,

I just tested this using ODBC 11.7 SP1 and it continues to be a problem.

Clifford Bass

Mike Vandine

Re: SQLB-2079: Role-Based Access to Table; Table Does Not Show In MS Access

Post by Mike Vandine » 10 Feb 2014, 09:23

Hi Cliff,

This is SQLB-2079, scheduled for SP2.

Best regards,

Clifford Bass

Re: SQLB-2079: Role-Based Access to Table; Table Does Not Show In MS Access

Post by Clifford Bass » 10 Feb 2014, 19:03

Great!

Thanks Mike.

Clifford

Mike Vandine

Re: SQLB-2079: Role-Based Access to Table; Table Does Not Show In MS Access

Post by Mike Vandine » 24 Apr 2014, 00:53

Hi Cliff,

The issue here is actually a problem with the system views, specifically SYSSQL.SYSTABLES, which the drivers use.
This view doesn't have ROLE support.

I've attached a script which not only adds that ROLE support to several views, but also fixes a few other issues we found while researching this.

Edit the script and change the database and password as appropriate. Note, this script MUST run as SYSADM.

Best regards,
You do not have the required permissions to view the files attached to this post.

Clifford Bass

Re: SQLB-2079: Role-Based Access to Table; Table Does Not Show In MS Access

Post by Clifford Bass » 28 Apr 2014, 20:06

Hi Mike,

Cool! Thanks for the script.

I ran into a couple quirks with the script.

1. It did not like the dropping of the SYSCOLUMNS, SYSINDEXES, SYSKEYS and SYSSYNONYMS views, most likely due to their dependence on the SYSTABLES view. Once I commented those statements out it ran without any problems on the first run.

2. I happened to rerun it on the same database and it gave an error when trying to drop the SYSPARTTRANS view. In looking through the rest of the script apparently that view is not recreated. Is that intentional? If not, what statements need to be added to recreate that view?

Clifford

Mike Vandine

Re: SQLB-2079: Role-Based Access to Table; Table Does Not Show In MS Access

Post by Mike Vandine » 05 May 2014, 07:57

Hi Cliff,

Yes, when the SYSTABLES view is dropped, the others are dropped as well automagically.

Yes, the SYSPARTTRANS view was meant to be dropped permanently. That really had nothing to do with this particular fix; the Developer was just cleaning up unnecessary views.

Best regards,

Clifford Bass

Re: SQLB-2079: Role-Based Access to Table; Table Does Not Show In MS Access

Post by Clifford Bass » 05 May 2014, 17:51

Hi Mike,

Thanks for the response.

Clifford

Return to “Bug Reports”

Who is online

Users browsing this forum: [Ccbot] and 0 guests