문서를 영문으로 보려면 영문 확인란을 선택하세요. 마우스 포인터를 텍스트 위로 이동시켜 팝업 창에서 영문 텍스트를 표시할 수도 있습니다.
번역
영문

Table.Deny 메서드 (ObjectPermissionSet, String, Boolean)

Denies the specified set of permissions for the specified grantee and other users to whom the grantee granted the specified set of permissions on the table.

네임스페이스:  Microsoft.SqlServer.Management.Smo
어셈블리:  Microsoft.SqlServer.Smo(Microsoft.SqlServer.Smo.dll)

public void Deny(
	ObjectPermissionSet permission,
	string granteeName,
	bool cascade
)

매개 변수

permission
유형: Microsoft.SqlServer.Management.Smo.ObjectPermissionSet
An ObjectPermissionSet object value that specifies the permission.
granteeName
유형: System.String
A String value that specifies the grantee to be denied the specified set of permissions on the table.
cascade
유형: System.Boolean
A Boolean property that specifies whether the users to whom the grantee granted the specified set of permission are also denied access to the specified set of permissions on the table.If True, the grantee and the users to whom the grantee granted the specified set of permissions are all denied the specified set of permissions.If False, only the grantee is denied the specified set of permissions.

구현

IObjectPermission.Deny(ObjectPermissionSet, String, Boolean)

The following code example shows how to grant guest accounts permission to select table elements, and then revoke the permission by using the Deny method. The account grantee is a placeholder for any defined user account.

The following Database schema is used for this snippet.

//CREATE DATABASE MYTESTDB;
//GO

//USE MYTESTDB;
//GO

//CREATE TABLE TABLE1(
//    id int,
//    name varchar(32)
//);
//GO

C#

Server srv = new Server("(local)");

Database db = srv.Databases["MYTESTDB"];

Table tb = db.Tables[0];

ObjectPermissionSet objPermissionSet = new ObjectPermissionSet(ObjectPermission.Select);
objPermissionSet.Select = true;
tb.Grant(objPermissionSet, grantee);
tb.Deny(objPermissionSet, grantee, true);

Powershell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$db = New-Object Microsoft.SqlServer.Management.Smo.Database
$db = $srv.Databases.Item("MYTESTDB")
$tb = $db.Tables[0]

$objPermissionSet = new-object Microsoft.SqlServer.Management.Smo.ObjectPermissionSet([Microsoft.SqlServer.Management.Smo.ObjectPermission]::Select)
$objPermissionSet.Select = $TRUE
$tb.Grant($objPermissionSet, grantee)
$tb.Deny($objPermissionSet, grantee, $TRUE)

커뮤니티 추가 항목

추가
표시: