Synonyms Permissions?

  • 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.

    Thoughts??

    Regards,

    D

  • 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' )

    REVERT;

    Edit:

    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

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply