中の技術日誌ブログ

C#とC++/CLIと
VBと.NETとWindowsで戯れる
 

目次

Blog 利用状況

ニュース

自己紹介

東京でソフトウェアエンジニアをやっています。
お仕事大募集中です。
記事執筆や、講師依頼とかでも何でもどうぞ(*^_^*)
似顔絵 MSMVPロゴ
MSMVP Visual C# Since 2004/04-2013/03

記事カテゴリ

書庫

日記カテゴリ

00-整理

01-MSMVP

ObjectSecurity.GetOwner メソッド

GetOwnerメソッドに限った話ではないけれど、.NET 2.0で搭載されたACL関連の機能では

public IdentityReference GetOwner (
  Type targetType
)

こんな感じで型を引数に取るものが多い。

解説

targetType

所有者を取得する対象となるプライマリ グループ。

正直分かりにくいので、typeof(IdentityReference)を渡してみる。そうすると

"targetType パラメータは IdentityReference 型でなければなりません。\r\nパラメータ名: targetType"

という例外が発生する。

IdentityReferenceが必要といって、そのIdentityReferenceを渡すと怒られる。

これは例外のメッセージがよくなくて、"IdentityReferenceまたはその派生型でなければいけません。"くらいのことを書いておかないといけない。

正解は

System.Security.Principal.NTAccount
System.Security.Principal.SecurityIdentifier

のどちらかが正解。

NTAccountなら domain\user っていう形式のユーザ情報が取得できて、SecurityIdentifierなら S-1-1-1 っていうSIDが取得できる。

SIDってSIDとはいうけどSecurituIdentifierとは普段言わないのでちょっと違和感を感じますね。

投稿日時 : 2006年10月24日 23:53

コメントを追加

# GgPQpovcTybWHF 2022/04/19 11:16 johnansog

http://imrdsoacha.gov.co/silvitra-120mg-qrms

# re: ObjectSecurity.GetOwner メソッド 2023/05/31 13:15 puppet hockey

Your videos are a great source of knowledge, and I frequently refer to them as a reference.

# re: ObjectSecurity.GetOwner メソッド 2023/05/31 13:16 puppet hockey

Your videos are a great source of knowledge, and I frequently refer to them as a reference.

# re: ObjectSecurity.GetOwner メソッド 2023/05/31 13:18 puppet hockey

Your videos are a great source of knowledge, and I frequently refer to them as a reference.

# re: ObjectSecurity.GetOwner メソッド 2023/05/31 13:19 puppet hockey

Your videos are a great source of knowledge, and I frequently refer to them as a reference.

# re: ObjectSecurity.GetOwner メソッド 2025/01/20 16:22 tap road

It's a wonderful piece. In my opinion, this is one of the best blog posts ever. I admire and am inspired by your work. That's really kind of you.

タイトル
名前
URL
コメント