Security View Usage

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Security View Usage相关的知识,希望对你有一定的参考价值。

一,在Database level上,主要有 sys.database_principals, sys.database_permissions 和 sys.database_role_members。

Script1,查询数据库中 role 和 其Member(SQL User)的关系

select dbp_r.name as RoleName,dbp_r.type_desc as RoleTypeDesc,
    dbp_r.authentication_type_desc as Role_authentication_type_desc,
    dbp_u.name as UserName,dbp_u.type_desc as UserTypeDesc,
    dbp_u.authentication_type_desc as user_authentication_type_desc
from sys.database_role_members dbrm
inner join sys.database_principals dbp_r
    on dbrm.role_principal_id=dbp_r.principal_id and dbp_r.type=NR
inner join sys.database_principals dbp_u
    on dbrm.member_principal_id=dbp_u.principal_id and dbp_u.type =NS


Script2, Listing all the permissions of database principals

SELECT pr.principal_id, pr.name, pr.type_desc, pr.authentication_type_desc, 
    pe.permission_name,pe.class_desc,pe.state_desc
FROM sys.database_principals AS pr
Inner JOIN sys.database_permissions AS pe
    ON pe.grantee_principal_id = pr.principal_id;


Script3,Listing permissions on schemas or objects within a database

--查看对Object授予的权限
SELECT pr.principal_id, pr.name, pr.type_desc, 
    pr.authentication_type_desc, pe.state_desc, 
    pe.permission_name,pe.class_desc, s.name + . + o.name AS ObjectName
FROM sys.database_principals AS pr
JOIN sys.database_permissions AS pe
    ON pe.grantee_principal_id = pr.principal_id
JOIN sys.objects AS o
    ON pe.major_id = o.object_id
JOIN sys.schemas AS s
    ON o.schema_id = s.schema_id
where pe.class =1;


--查看对Schema授予的权限
SELECT pr.principal_id, pr.name, pr.type_desc, 
    pr.authentication_type_desc, pe.state_desc, 
    pe.permission_name,pe.class_desc, s.name AS SchemaName
FROM sys.database_principals AS pr
JOIN sys.database_permissions AS pe
    ON pe.grantee_principal_id = pr.principal_id
JOIN sys.schemas AS s
    ON pe.major_id = s.schema_id
where pe.class =3;

参考:sys.database_permissions (Transact-SQL)


二,在Server Level上,后续研究....

 

参考文档:

Security Catalog Views (Transact-SQL)

以上是关于Security View Usage的主要内容,如果未能解决你的问题,请参考以下文章

SSIS Catalog2:View Usage

如何将 View 类中的代码片段移动到 OnAppearing() 方法?

[linux][c/c++]代码片段01

Tablayout+view 寻呼机未在位置 0 显示片段

android.view.InflateException:二进制 XML 文件第 15 行:二进制 XML 文件第 19 行:膨胀类片段时出错

自己定义View时,用到Paint Canvas的一些温故,简单的帧动画(动画一 ,"掏粪男孩Gif"顺便再提提onWindowFocusChanged)(代码片段