Re: I would like to do a link between system table.



On 15 nov, 10:16, zoltix <zol...@xxxxxxxxx> wrote:
Hi,
I would like to do a link between system table. My goal is to link the
security's tables with the session's tables, To see the security for
the current user. For example I would to do a request select * from
sys. sys.dm_exec_connections inner join....sys.database_permissions to
see if this user has the privilège for doing a "select"
Therefore how can I do a link between sys.dm_exec_connections (Current
session @@spid) and sys.database_permissions(define all permissions on
db) or perhaps other to see what I want.
Thank a lot for your response...

Some info
IF PERMISSIONS()&2=2
CREATE TABLE test_table (col1 INT)
ELSE
PRINT 'ERROR: The current user cannot create a table.'
--------
This example determines whether the current user can
grant the INSERT permission on the authors table to another user.

IF PERMISSIONS(OBJECT_ID('authors'))&0x80000=0x80000
PRINT 'INSERT on authors is grantable.'
ELSE
PRINT 'You may not GRANT INSERT permissions on authors.'

------http://msdn.microsoft.com/library/default.asp?url=/library/en-us/
tsql...>
How can I retrieve a list of objects and permissions for a specified
role?
------------------------------------------------------------------------------
In SQL Server 2005, you can use the Has_Perms_By_Name() function
(http://msdn2.microsoft.com/en-us/library/ms189802.aspx).



This is an example of usage:

SELECT o.SchemaAndName,
has_perms_by_name(o.SchemaAndName, 'OBJECT', 'EXECUTE')
FROM (SELECT name, SCHEMA_NAME(schema_id) AS [schema],
SCHEMA_NAME(schema_id)+'.'+name AS SchemaAndName
FROM sys.objects
WHERE type = 'P') AS o


SELECT dperms.*
FROM sys.database_permissions dperms
JOIN sys.database_principals dprins
ON dperms.grantee_principal_id = dprins.principal_id
JOIN master.sys.server_principals sprins
ON dprins.sid = sprins.sid


.



Relevant Pages

  • Re: Security Group Settings/Usage
    ... Permissions are defined at the resource being controlled (where ... you use a security group to grant or deny a specific permission set). ... The security groups as defined in AD are just that, groups of accounts, ... Another way to look at this is that each securable resource carries ...
    (microsoft.public.win2000.security)
  • Re: USERS group has the ability to change security permissions???
    ... Please use the Advance view in the NTFS permissions dialog to ... When there is a generic grant and a special grant to the same entity ... the RESULT: user level access can change NTFS ...
    (microsoft.public.win2000.security)
  • Re: DCOM Event ID 10015
    ... Grant the user permissions to start the COM component ... Run the MPSRPT_DirSvc.exe on the server box. ... Microsoft CSS Online Newsgroup Support ...
    (microsoft.public.windows.server.sbs)
  • Re: NTFS woes
    ... "In some cases with a grant of Full is reduced ... NTFS permissions dialog. ... check Allow Delete Subfolders and Files ... Explicit Deny Delete on file does not work (user can still delete ...
    (microsoft.public.windows.server.security)
  • Re: NTFS woes
    ... "In some cases with a grant of Full is reduced ... NTFS permissions dialog. ... check Allow Delete Subfolders and Files ... Explicit Deny Delete on file does not work (user can still delete ...
    (microsoft.public.windows.server.security)