マイナーでもいいよね??

殆どVB系、でも .NET じゃない VB は知らないよん

目次

Blog 利用状況

書庫

日記カテゴリ

ForeignSecurityPrincipal クラス

グループのネストしているすべてのメンバーを表示する画面の追加に伴いクラスライブラリ側にクラスを追加しました。

今まで扱ってきたのは ユーザー、グループ、コンピューター、OU、プリンター、共有フォルダーの 6 オブジェクトで、これらのオブジェクトを表す DirectoryEntry をラップした専用のクラスで表しています。

今回、外部のセキュリティ プリンシパルがグループのメンバーに含まれるようになるので、これを表すクラスを追加しました。

 

ForeignSecurityPrincipal クラス(System.Security.Principal 名前空間をインポートしてます)

VB

Public NotInheritable Class ForeignSecurityPrincipal

  Inherits DomainObject

 

#Region " プライベートフィールド "

  Private ReadOnly _readableName, _displayName As String

#End Region

 

#Region " フレンドコンストラクター "

  'DirectoryEntry を指定して ForeignSecurityPrincipal クラスの新しいインスタンスを初期化します。

  Friend Sub New(entry As DirectoryEntry)

    MyBase.New(entry)

 

    Dim objectSid = DirectCast(entry.Properties.Item("objectSid").Value, Byte())

    Dim sid = New SecurityIdentifier(objectSid, 0'SID

    Dim account = DirectCast(sid.Translate(GetType(NTAccount)), NTAccount'アカウントに変換

    _readableName = account.Value   'NT AUTHORITY\○○ => ToStringメソッドでも同じ

    _displayName = IO.Path.GetFileName(account.Value)   'NT AUTHORITY\○○ の ○○部分

  End Sub

#End Region

 

#Region " パブリックプロパティ "

  '表示用の名前を取得します。

  Public ReadOnly Property DisplayName As String

    Get

      Return _displayName

    End Get

  End Property

 

  '読み取り可能な名前を取得します。

  Public ReadOnly Property ReadableName As String

    Get

      Return _readableName

    End Get

  End Property

#End Region

 

#Region " パブリックメソッド "

  '表示用の名前を返します。

  Public Overrides Function ToString() As String

    Return Me.DisplayName

  End Function

#End Region

End Class

 

C#

public sealed class ForeignSecurityPrincipal : DomainObject

{

  #region プライベートフィールド

  private readonly string _readableName, _displayName;

  #endregion

 

  #region インターナルコンストラクタ

  //DirectoryEntry を指定して ForeignSecurityPrincipal クラスの新しいインスタンスを初期化します。

  internal ForeignSecurityPrincipal(DirectoryEntry entry)

    : base(entry)

  {

    var objectSid = (byte[])entry.Properties["objectSid"].Value;

    var sid = new SecurityIdentifier(objectSid, 0);   //SID

    var account = (NTAccount)sid.Translate(typeof(NTAccount));  //アカウントに変換

    _readableName = account.Value;   //NT AUTHORITY\○○ => ToStringメソッドでも同じ

    _displayName = System.IO.Path.GetFileName(account.Value);   //NT AUTHORITY\○○ の ○○部分

  }

  #endregion

 

  #region パブリックプロパティ

  //表示用の名前を取得します。

  public string DisplayName

  {

    get

    {

      return _displayName;

    }

  }

 

  //読み取り可能な名前を取得します。

  public string ReadableName

  {

    get

    {

      return _readableName;

    }

  }

  #endregion

 

  #region パブリックメソッド

  //表示用の名前を返します。

  public override string ToString()

  {

    return this.DisplayName;

  }

  #endregion

}

 

 

 

Active Directory 関連 Blog

http://www.pbyk.com/blog/bloglist.html

投稿日時 : 2015年2月13日 23:39

コメントを追加

# I do believe all of the ideas you've presented in your post. They are really convincing and will definitely work. Nonetheless, the posts are very brief for novices. Could you please lengthen them a bit from subsequent time? Thanks for the post. 2019/05/15 18:29 I do believe all of the ideas you've presented in

I do believe all of the ideas you've presented in your post.
They are really convincing and will definitely work.

Nonetheless, the posts are very brief for novices. Could you please lengthen them
a bit from subsequent time? Thanks for the post.

# Everyone loves what you guys are usually up too. This sort of clever work and exposure! Keep up the excellent works guys I've incorporated you guys to my personal blogroll. 2019/08/24 5:25 Everyone loves what you guys are usually up too. T

Everyone loves what you guys are usually up too.

This sort of clever work and exposure! Keep up the
excellent works guys I've incorporated you
guys to my personal blogroll.

# Fastidious replies in return of this question with genuine arguments and telling the whole thing concerning that. 2021/08/28 14:40 Fastidious replies in return of this question with

Fastidious replies in return of this question with genuine arguments and telling the whole thing concerning that.

# Fastidious replies in return of this question with genuine arguments and telling the whole thing concerning that. 2021/08/28 14:41 Fastidious replies in return of this question with

Fastidious replies in return of this question with genuine arguments and telling the whole thing concerning that.

# Fastidious replies in return of this question with genuine arguments and telling the whole thing concerning that. 2021/08/28 14:42 Fastidious replies in return of this question with

Fastidious replies in return of this question with genuine arguments and telling the whole thing concerning that.

# Fastidious replies in return of this question with genuine arguments and telling the whole thing concerning that. 2021/08/28 14:43 Fastidious replies in return of this question with

Fastidious replies in return of this question with genuine arguments and telling the whole thing concerning that.

# This is a topic which is close to my heart... Many thanks! Exactly where are your contact details though? 2021/08/30 17:23 This is a topic which is close to my heart... Many

This is a topic which is close to my heart... Many
thanks! Exactly where are your contact details though?

# If you wish for to increase your knowledge only keep visiting this website and be updated with the most recent gossip posted here. 2021/09/02 7:44 If you wish for to increase your knowledge only ke

If you wish for to increase your knowledge only keep visiting this website
and be updated with the most recent gossip posted here.

# If you wish for to increase your knowledge only keep visiting this website and be updated with the most recent gossip posted here. 2021/09/02 7:45 If you wish for to increase your knowledge only ke

If you wish for to increase your knowledge only keep visiting this website
and be updated with the most recent gossip posted here.

# If you wish for to increase your knowledge only keep visiting this website and be updated with the most recent gossip posted here. 2021/09/02 7:46 If you wish for to increase your knowledge only ke

If you wish for to increase your knowledge only keep visiting this website
and be updated with the most recent gossip posted here.

# If you wish for to increase your knowledge only keep visiting this website and be updated with the most recent gossip posted here. 2021/09/02 7:47 If you wish for to increase your knowledge only ke

If you wish for to increase your knowledge only keep visiting this website
and be updated with the most recent gossip posted here.

# I think this is one of the so much significant information for me. And i'm satisfied studying your article. But wanna remark on few common things, The site style is perfect, the articles is in point of fact excellent : D. Just right job, cheers 2021/09/05 1:30 I think this is one of the so much significant inf

I think this is one of the so much significant information for me.
And i'm satisfied studying your article. But wanna remark on few common things, The site
style is perfect, the articles is in point of fact excellent : D.
Just right job, cheers

# This is a topic which is close to my heart... Cheers! Exactly where are your contact details though? quest bars https://www.iherb.com/search?kw=quest%20bars quest bars 2021/09/13 22:29 This is a topic which is close to my heart... Chee

This is a topic which is close to my heart...
Cheers! Exactly where are your contact details though?
quest bars https://www.iherb.com/search?kw=quest%20bars quest
bars

# This is a topic which is close to my heart... Cheers! Exactly where are your contact details though? quest bars https://www.iherb.com/search?kw=quest%20bars quest bars 2021/09/13 22:30 This is a topic which is close to my heart... Chee

This is a topic which is close to my heart...
Cheers! Exactly where are your contact details though?
quest bars https://www.iherb.com/search?kw=quest%20bars quest
bars

# This is a topic which is close to my heart... Cheers! Exactly where are your contact details though? quest bars https://www.iherb.com/search?kw=quest%20bars quest bars 2021/09/13 22:31 This is a topic which is close to my heart... Chee

This is a topic which is close to my heart...
Cheers! Exactly where are your contact details though?
quest bars https://www.iherb.com/search?kw=quest%20bars quest
bars

# This is a topic which is close to my heart... Cheers! Exactly where are your contact details though? quest bars https://www.iherb.com/search?kw=quest%20bars quest bars 2021/09/13 22:32 This is a topic which is close to my heart... Chee

This is a topic which is close to my heart...
Cheers! Exactly where are your contact details though?
quest bars https://www.iherb.com/search?kw=quest%20bars quest
bars

# Hi, just wanted to mention, I loved this article. It was inspiring. Keep on posting! 2021/11/18 0:34 Hi, just wanted to mention, I loved this article.

Hi, just wanted to mention, I loved this article. It was inspiring.
Keep on posting!

# Why visitors still make use of to read news papers when in this technological globe the whole thing is available on net? 2021/12/26 8:07 Why visitors still make use of to read news papers

Why visitors still make use of to read news papers when in this technological globe the whole
thing is available on net?

# Why visitors still make use of to read news papers when in this technological globe the whole thing is available on net? 2021/12/26 8:08 Why visitors still make use of to read news papers

Why visitors still make use of to read news papers when in this technological globe the whole
thing is available on net?

# Why visitors still make use of to read news papers when in this technological globe the whole thing is available on net? 2021/12/26 8:09 Why visitors still make use of to read news papers

Why visitors still make use of to read news papers when in this technological globe the whole
thing is available on net?

# Why visitors still make use of to read news papers when in this technological globe the whole thing is available on net? 2021/12/26 8:09 Why visitors still make use of to read news papers

Why visitors still make use of to read news papers when in this technological globe the whole
thing is available on net?

# YAwywiqXMWFOpMmFXP 2022/04/19 12:02 johnansaz

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

# Very good website you have here but I was wanting to know if you knew of any message boards that cover the same topics discussed here? I'd really like to be a part of online community where I can get suggestions from other experienced people that share t 2022/11/28 19:36 Very good website you have here but I was wanting

Very good website you have here but I was wanting to
know if you knew of any message boards that cover the same topics discussed here?
I'd really like to be a part of online community where I can get suggestions from other experienced people that share the same interest.
If you have any recommendations, please let me know. Bless you!

# internet apotheke 2023/09/26 13:27 Williamreomo

http://onlineapotheke.tech/# versandapotheke
gГ?nstige online apotheke

# online apotheke gГјnstig 2023/09/27 2:02 Williamreomo

http://onlineapotheke.tech/# online apotheke gГ?nstig
online apotheke deutschland

# online apotheke preisvergleich 2023/09/27 2:59 Williamreomo

https://onlineapotheke.tech/# п»?online apotheke
online apotheke deutschland

# gГјnstige online apotheke 2023/09/27 4:46 Williamreomo

http://onlineapotheke.tech/# online apotheke deutschland
internet apotheke

# п»їonline apotheke 2023/09/27 6:25 Williamreomo

https://onlineapotheke.tech/# gГ?nstige online apotheke
online apotheke preisvergleich

# п»їonline apotheke 2023/09/27 6:50 Williamreomo

http://onlineapotheke.tech/# versandapotheke deutschland
versandapotheke

# п»їonline apotheke 2023/09/27 18:30 Terrywef

acheter sildenafil 100mg sans ordonnance

# best ed drug https://edpillsotc.store/# - erectile dysfunction drug 2023/10/08 5:03 EdPills

best ed drug https://edpillsotc.store/# - erectile dysfunction drug

# indianpharmaonline review 2023/10/16 15:37 Dannyhealm

Their online chat support is super helpful. http://mexicanpharmonline.shop/# pharmacies in mexico that ship to usa

# foreign pharmacies com 2023/10/16 15:56 Dannyhealm

Their worldwide reputation is well-deserved. https://mexicanpharmonline.shop/# mexican mail order pharmacies

# canada pharmacies online prescriptions 2023/10/16 17:24 Dannyhealm

A game-changer for those needing international medication access. https://mexicanpharmonline.shop/# mexico drug stores pharmacies

# rx meds online 2023/10/16 18:26 Dannyhealm

They provide peace of mind with their secure international deliveries. https://mexicanpharmonline.com/# pharmacies in mexico that ship to usa

# pharm canada 2023/10/16 22:24 Dannyhealm

Their compounding services are impeccable. http://mexicanpharmonline.com/# mexican rx online

# cheap prescription medication online 2023/10/17 11:43 Dannyhealm

Their commitment to healthcare excellence is evident. https://mexicanpharmonline.com/# pharmacies in mexico that ship to usa

# prescription canada 2023/10/17 23:03 Dannyhealm

Always providing clarity and peace of mind. http://mexicanpharmonline.com/# mexican border pharmacies shipping to usa

# prescription meds from canada 2023/10/18 0:45 Dannyhealm

Been a loyal customer for years and theyв??ve never let me down. https://mexicanpharmonline.com/# mexican pharmaceuticals online

# canada on line pharmacies 2023/10/18 1:20 Dannyhealm

They have a great selection of wellness products. https://mexicanpharmonline.com/# mexican pharmaceuticals online

# safe canadian pharmacies 2023/10/18 23:55 Dannyhealm

Setting global standards in pharmaceutical care. http://mexicanpharmonline.com/# reputable mexican pharmacies online

# paxlovid buy https://paxlovid.bid/ paxlovid price 2023/10/26 2:48 Paxlovid

paxlovid buy https://paxlovid.bid/ paxlovid price

# natural remedies for ed 2023/11/22 16:29 WilliamApomb

http://edpills.monster/# best pill for ed

# paxlovid cost without insurance 2023/12/01 5:05 Mathewhip

paxlovid generic https://paxlovid.club/# Paxlovid buy online

# canadian pharmaceuticals for usa sales 2023/12/01 19:12 MichaelBum

https://clomid.club/# buying generic clomid price

# farmacias baratas online envío gratis 2023/12/07 15:22 RonnieCag

http://tadalafilo.pro/# farmacia online madrid

# farmacia online 24 horas 2023/12/08 3:58 RonnieCag

http://farmacia.best/# farmacias online seguras en españa

# farmacia 24h 2023/12/09 19:22 RonnieCag

https://sildenafilo.store/# se puede comprar sildenafil sin receta

# farmacia online barata 2023/12/10 9:14 RonnieCag

http://farmacia.best/# farmacias online baratas

# farmacia envíos internacionales 2023/12/10 15:10 RonnieCag

https://farmacia.best/# farmacias baratas online envío gratis

# farmacia envíos internacionales 2023/12/10 22:43 RonnieCag

https://tadalafilo.pro/# farmacia online 24 horas

# farmacia barata 2023/12/11 2:12 RonnieCag

https://tadalafilo.pro/# farmacia online barata

# farmacias online seguras en españa 2023/12/11 5:49 RonnieCag

http://farmacia.best/# farmacia barata

# ï»¿farmacia online 2023/12/11 8:49 RonnieCag

https://tadalafilo.pro/# farmacia online madrid

# ï»¿farmacia online 2023/12/11 17:21 RonnieCag

https://farmacia.best/# farmacia 24h

# farmacia envíos internacionales 2023/12/12 10:18 RonnieCag

https://tadalafilo.pro/# farmacias online baratas

# Pharmacie en ligne France 2023/12/14 6:55 Larryedump

http://pharmacieenligne.guru/# pharmacie en ligne

# pharmacie ouverte 24/24 2023/12/15 0:15 Larryedump

https://pharmacieenligne.guru/# Pharmacie en ligne France

# Pharmacie en ligne livraison rapide 2023/12/15 4:01 Larryedump

https://pharmacieenligne.guru/# pharmacie ouverte 24/24

# acheter medicament a l etranger sans ordonnance 2023/12/16 3:11 Larryedump

https://pharmacieenligne.guru/# Pharmacie en ligne France

# cures for ed https://edpills.tech/# the best ed pills 2023/12/23 11:28 EdPills

cures for ed https://edpills.tech/# the best ed pills

# п»їpaxlovid 2023/12/27 18:53 Brianmooda

http://prednisone.bid/# prednisone 5093

# abella danger filmleri https://abelladanger.online/ Abella Danger
2024/03/04 22:30 Adella

abella danger filmleri https://abelladanger.online/ Abella Danger

# lana rhoades - https://lanarhoades.pro/ lana rhoades unleashed
2024/03/06 18:58 LanaRho

lana rhoades - https://lanarhoades.pro/ lana rhoades unleashed

# aviator bet https://aviatorjogar.online/ - aviator jogar
2024/03/13 13:46 BraAvia

aviator bet https://aviatorjogar.online/ - aviator jogar

# sweet bonanza hilesi https://sweetbonanza.bid/ - sweet bonanza siteleri
2024/03/28 1:10 Bonanzaj

sweet bonanza hilesi https://sweetbonanza.bid/ - sweet bonanza siteleri

タイトル
名前
URL
コメント