Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Synonyms Permissions? Expand / Collapse
Posted Monday, January 9, 2012 9:54 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Wednesday, April 20, 2016 2:41 PM
Points: 92, Visits: 692
Hello –

I’m on a project where I created two Synonyms I called TimeDataFetchCurrent and the other TimeDataFetchOld.

(Synonym) TimeDataFetchCurrent is referencing my table TimeDataFresh and (Synonym) TimeDataFetchOld is referencing table TDFB

Users are connecting within Excel to the database server and want them to only use TimeDataFetchCurrent . This way they can pull in the data and report off of it.

My question is there a way to lock down the tables and only have people see and choose the TimeDataFetchCurrent Synonym when setting this up? Didn’t know if I set the permissions Synonoym if they would carry over and give the table permission as well.

I attached a screenshot of what I was looking for.



  Post Attachments 
1-9-2012 11-45-44 AM.png (9 views, 30.52 KB)
Post #1232604
Posted Monday, January 9, 2012 11:55 AM



Group: General Forum Members
Last Login: Today @ 2:36 AM
Points: 7,933, Visits: 14,357
From Metadata Visibility Configuration:

In SQL Server 2005, the visibility of metadata is limited to securables that a user either owns or on which the user has been granted some permission.

Synonyms are objects too, so they have permissions that belong to them separate from the objects they point to. If you REVOKE all permissions of the Database User you want to hide the Synonym from then the User will not see it in an object listing, at least not in SSMS Object Explorer. I do not have a testbed setup for your Excel use-case.

REVOKE SELECT ON dbo.TimeDataFetchOld TO user_to_hide_object_from ;

If it is still visible check for other permissions:

EXECUTE AS LOGIN = 'user_to_hide_object_from';
SELECT * FROM fn_my_permissions ( 'dbo.TimeDataFetchOld' , 'OBJECT' )


PS Note that Role Membership also counts. The query above using fn_my_permissions will show you if the user has access, however if will not tell you whether it is via a direct GRANT or via Role Membership.

There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1232712
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse