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=N‘R‘
inner join sys.database_principals dbp_u
    on dbrm.member_principal_id=dbp_u.principal_id and dbp_u.type =N‘S‘

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)

时间: 2024-10-01 06:52:32

Security View Usage的相关文章

SSIS Catalog2:View Usage

Script1,查看错误发生时,某个Package执行Executable的属性和Executable的执行结果 select e.project_name, e.operation_type, --refer to [catalog].[operations] --e.package_name as FristExecutePackagename,e.object_type,e.object_id,e.status, et.package_name,et.package_path as Exe

Spring Security 4 Hello World Annotation+XML

Example July 28, 2015 websystiqueadminThis tutorial demonstrates Spring Security 4 usage to secure a Spring MVC web application, securing URL access with authentication. We will use classic Hello World example to learn Spring Security 4 basics. This

SQL View 的使用语法与原则

1. View只是存储下来的sql 语句 Views are nothing but saved SQL statements, and are sometimes referred as “Virtual Tables”. Keep in mind that Views cannot store data (except for Indexed Views); rather they only refer to data present in tables.2. create a view U

openstact4j学习笔记

认证token curl -X POST -d  '{"auth": {"tenantName": "IED-as", "passwordCredentials":{"username": "admin", "password": "[email protected]"}}}' -H "Content-type: application/

P6 Professional Installation and Configuration Guide (Microsoft SQL Server Database) 16 R1

P6 Professional Installation and Configuration Guide (Microsoft SQL Server Database) 16 R1       May 2016 Contents About This Guide...................................................................................... 11 Shared Topics in This Guide .

WebkitIDL

概述 Web IDL 是一门语言,用来定义WebCore的接口如何绑定外部语言比如JavaScriptCore, ObjC, GObject,C++等等.要暴露WebCore的接口给这些外部语言的话,我们需要编写IDL文件例如XMLHttpRequest.idl, Element.idl等等.Webit编译的时候,这些IDL 文件会被解析.而后生成的代码会绑定到WebCore的实现,而且会自动生成JavaScriptCore,ObjC, GObject, C++接口. 本文描述的是编写IDL的实

WHM使用手册by lin

WebHost Manager 11使用手册(WHM使用手册) 本手册翻译自cpanel官方文档. 本翻译中文版本版权归美国主机侦探所有,未经允许,禁止复制. Overview(概述) 本用户手册主要目的是让新用户熟悉WebHost Manager Interface(WebHost Manager界面):并给老用户补充点额外的知识.本手册将着重介绍如何使用WebHost Manager来安装,配置和管理你的服务器以满足虚拟主机的需要. 如果你是刚刚接触服务器管理和虚拟主机,那么本手册中出现的很

在 Web 项目中应用 Apache Shiro

Apache Shiro 是功能强大并且容易集成的开源权限框架,它能够完成认证.授权.加密.会话管理等功能.认证和授权为权限控制的核心,简单来说,"认证"就是证明你是谁? Web 应用程序一般做法通过表单提交用户名及密码达到认证目的."授权"即是否允许已认证用户访问受保护资源.关于 Shiro 的一系列特征及优点,很多文章已有列举,这里不再逐一赘述,本文重点介绍 Shiro 在 Web Application 中如何实现验证码认证以及如何实现单点登录. 用户权限模型

Jetty:配置安全

用${jetty.home}和${jetty.base}配置安全 Jetty 9.1中: 1)${jetty.home}是jetty发布(二进制)的目录路径: 2)${jetty.base}是用户定制化的目录路径. 这样分化: 1)允许你管理多个Jetty安装: 2)当你升级Jetty后,更容易保留你当前的配置. 更多的信息在后面讲<启动Jetty>时会详述. 而且,Jetty 9.1参数化了所有的标准XML配置.例如SSL,参数现在仅是在start.ini中的属性,不需要编辑XML文件. J