Re: How to prevent DELETEs in a table

From: Kalen Delaney (replies_at_public_newsgroups.com)
Date: 01/04/05


Date: Mon, 3 Jan 2005 21:28:02 -0800

What you say about dbo is true, but it is even MORE true about someone who
is in the sysadmin role. No permissions are ever checked for someone in the
sysadmin role. For dbo users, there is some checking of permissions, but
because dbo is the owner, the deny is not applied. It is a different
internal mechanism.

In older versions, you could deny access to dbo, and a dbo who wasn't a
sysadmin would actually lose privilege even on objects owned by dbo.

-- 
HTH
----------------
Kalen Delaney
SQL Server MVP
www.SolidQualityLearning.com
"AnthonyThomas" <Anthony.Thomas@CommerceBank.com> wrote in message 
news:eHyFhpg8EHA.2016@TK2MSFTNGP15.phx.gbl...
> This is close, but not quite accurate.  Basically, dbo is THE database
> owner.  It is the dbo database USER, not server-level groups, that 
> determins
> the effect of database permissions.
>
> Now, what is interesting is that dbo can not be denied anything...because 
> it
> owns everything.  It has implicit permissions that can not be denied.
> Furthermore, as a member of the system administrator system role, users 
> are
> atomactically aliased to the dbo user in every database hosted by the
> system.
>
> Conversely, members of the db_owner database role can be denied access
> because they have only inherited permissions through grants that CAN be
> denied: DENY CREATE TABLE, etc., and DENY SELECT, INSERT, UPDATE, DELETE,
> etc.  What they can do, however, is regrant themselves these permissions.
>
> This situation is akin to the relationship between the SYSTEM and Local
> Administrators accounts/groups for the Operating System.  Think of DBO as
> SYSTEM and db_owner members like Local Administrators.  The parallels are
> strikingly close.
>
> Sincerely,
>
>
> Anthony Thomas
>
>
> -- 
>
> "Kalen Delaney" <replies@public_newsgroups.com> wrote in message
> news:%239nxsxf8EHA.3368@TK2MSFTNGP10.phx.gbl...
> Hi Dave
>
> If you are a member of the sysadmin role, permissions do not apply to you.
> Basically, SQL Server just skips any permission validation for sysadmins.
>
> -- 
> HTH
> ----------------
> Kalen Delaney
> SQL Server MVP
> www.SolidQualityLearning.com
>
>
> "Dave" <dave@nospam.ru> wrote in message
> news:%23jxSZCf8EHA.2276@TK2MSFTNGP09.phx.gbl...
>> To paraphrase Dr. Nick:
>>
>>    Thanks everybody.
>>
>> I like the idea of the trigger but I still do not understand why when I
>> executed the "DENY DELETE ON EMPLOYEES TO public" I could still perform a
>> DELETE.
>>
>> I always thought that a DENY tainted the well and since everyone was part
>> of
>> public, everyone would be denied the ability to perform DELETEs.  But I
>> still could.
>>
>> Permission changes take effect immediately in SQL Server don't they?
>>
>>
>>
>>
>> "Anith Sen" <anith@bizdatasolutions.com> wrote in message
>> news:ugO5UJe8EHA.3376@TK2MSFTNGP12.phx.gbl...
>>> Do you want to prevent any deletions at all or do you want to prevent
>>> certain users from deleting data? To prevent any deletions, create a
>> INSTEAD
>>> OF trigger on the table like:
>>>
>>> CREATE TRIGGER trg ON tbl INSTEAD OF DELETE
>>> AS
>>> IF @@ROWCOUNT > 0 ROLLBACK
>>>
>>> -- 
>>> Anith
>>>
>>>
>>
>>
>
> 


Relevant Pages

  • Problem is w/ .ADP..Re: SQL db Permissions for users not working
    ... You do not have SELECT permissions on the ... SysObjects system table in the database. ... figured out that qualifying the database owner (dbo in my ... >> I feel that the object owner is not dbo, ...
    (microsoft.public.sqlserver.security)
  • Re: public role question
    ... If 'select user' is returning DBO, it means you are connecting AS DBO, and ... testing the permissions the new user has. ... Are you saying that the permissions to create the stored procedure are ... Dan D. ...
    (microsoft.public.sqlserver.security)
  • Re: How to prevent DELETEs in a table
    ... It is the dbo database USER, not server-level groups, that determins ... It has implicit permissions that can not be denied. ... SQL Server just skips any permission validation for sysadmins. ...
    (microsoft.public.sqlserver.server)
  • Re: DBO/Permissions questions
    ... In your other post, you said that when you logged in as tfs, you had the ... user name of dbo, but here you say the user name is tfs. ... sysadmin role, then he will have full permission to do anything even without ... > I am trying to understand this whole permissions thing. ...
    (microsoft.public.sqlserver.programming)
  • Re: Control over creation of procs & views owned by dbo
    ... To add on to Jasper's response, you could also change object ownership to ... 'dbo' with sp_changeobjectowner. ... security context of the invoking user, not the object owner. ... need permissions on only directly referenced objects. ...
    (microsoft.public.sqlserver.security)