次の方法で共有


Server.Revoke Method (ServerPermissionSet, String, Boolean, Boolean)

Microsoft SQL Server のインスタンスの権限許可対象ユーザーと、その権限許可対象ユーザーが指定した権限のセットを許可した他のすべてのユーザーから、以前に許可した権限を取り消します。また、権限許可対象ユーザーに対し、想定したロールに基づいて指定した権限のセットを他のユーザーから取り消す権限を許可します。

名前空間: Microsoft.SqlServer.Management.Smo
アセンブリ: Microsoft.SqlServer.Smo (microsoft.sqlserver.smo.dll 内)

構文

'宣言
Public Sub Revoke ( _
    permission As ServerPermissionSet, _
    granteeName As String, _
    revokeGrant As Boolean, _
    cascade As Boolean _
)
public void Revoke (
    ServerPermissionSet permission,
    string granteeName,
    bool revokeGrant,
    bool cascade
)
public:
void Revoke (
    ServerPermissionSet^ permission, 
    String^ granteeName, 
    bool revokeGrant, 
    bool cascade
)
public void Revoke (
    ServerPermissionSet permission, 
    String granteeName, 
    boolean revokeGrant, 
    boolean cascade
)
public function Revoke (
    permission : ServerPermissionSet, 
    granteeName : String, 
    revokeGrant : boolean, 
    cascade : boolean
)

パラメータ

  • granteeName
    権限のセットを取り消す権限許可対象ユーザーを示す String 値です。
  • revokeGrant
    権限許可対象ユーザーに対し、指定した権限のセットを Microsoft SQL Server のインスタンスの他のユーザーから取り消す権限を許可するかどうかを示す Boolean プロパティです。

    True の場合は、権限許可対象ユーザーに対し、指定した権限のセットを Microsoft SQL Server のインスタンスの他のユーザーから取り消す権限を許可します。

    False の場合は、権限許可対象ユーザーに対し、指定した権限のセットを Microsoft SQL Server のインスタンスの他のユーザーから取り消す権限を許可しません。

  • cascade
    権限許可対象ユーザーが指定した権限のセットを許可したユーザーについても、権限のセットを取り消すかどうかを示す Boolean プロパティです。

    True の場合は、権限許可対象ユーザーだけでなく、Microsoft SQL Server のインスタンスの指定した権限のセットをその権限許可対象ユーザーが許可したユーザーについても、指定した権限のセットを取り消します。

    False の場合は、権限許可対象ユーザーについてのみ、指定した権限のセットを取り消します。

解説

更新されたテキスト :

この名前空間、クラス、またはメンバは、Microsoft .NET Framework Version 2.0 でのみサポートされています。

使用例

'Connect to the local, default instance of SQL Server.
Dim svr As Server
svr = New Server()
'Define a ServerPermissionSet that contains permission to Create Endpoint and Alter Any Endpoint.
Dim sps As ServerPermissionSet
sps = New ServerPermissionSet(ServerPermission.CreateEndpoint)
sps.Add(ServerPermission.AlterAnyEndpoint)
'This sample assumes that the grantee already has permission to Create Endpoints. 
'Enumerate and display the server permissions in the set for the grantee specified in the vGrantee string variable.
Dim spis As ServerPermissionInfo()
spis = svr.EnumServerPermissions(vGrantee, sps)
Dim spi As ServerPermissionInfo
Console.WriteLine("=================Before revoke===========================")
For Each spi In spis
    Console.WriteLine(spi.Grantee & " has " & spi.PermissionType.ToString & " permission.")
Next
Console.WriteLine(" ")
'Remove a permission from the set.
sps.Remove(ServerPermission.CreateEndpoint)
'Revoke the create endpoint permission from the grantee.
svr.Revoke(sps, vGrantee)
'Enumerate and display the server permissions in the set for the grantee specified in the vGrantee string variable.
spis = svr.EnumServerPermissions(vGrantee, sps)
Console.WriteLine("=================After revoke============================")
For Each spi In spis
    Console.WriteLine(spi.Grantee & " has " & spi.PermissionType.ToString & " permission.")
Next
Console.WriteLine(" ")
'Grant the Create Endpoint permission to the grantee.
svr.Grant(sps, vGrantee)
'Enumerate and display the server permissions in the set for the grantee specified in the vGrantee string variable.
spis = svr.EnumServerPermissions(vGrantee, sps)
Console.WriteLine("=================After grant=============================")
For Each spi In spis
    Console.WriteLine(spi.Grantee & " has " & spi.PermissionType.ToString & " permission.")
Next
Console.WriteLine("")

スレッド セーフ

この型の public static (Microsoft Visual Basic では共有 ) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。

プラットフォーム

開発プラットフォーム

サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。

対象プラットフォーム

サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。

参照

関連項目

Server Class
Server Members
Microsoft.SqlServer.Management.Smo Namespace

その他の技術情報

Visual Basic .NET でサーバー権限を許可する方法
権限の許可、取り消し、および拒否
サーバーの管理

変更履歴

リリース

履歴

新しい内容 :
  • 「例」セクションにコード サンプルを追加しました。