C# 클래스 ADLib.ActiveDirectory

This class encapsulates an Active Directory connection, and handles common tasks
파일 보기 프로젝트 열기: bolenc/Active-Directory-Examples 1 사용 예제들

공개 메소드들

메소드 설명
ActiveDirectory ( string container, string name, string userid, string password ) : System

Create an Active Directory connection

AddUserToGroup ( System.DirectoryServices.AccountManagement.UserPrincipal adUser, string groupName ) : void

Adds the user to the specified group

ConnectionStringFor ( string item = "" ) : string
CreateGroup ( string groupName, System.Boolean isUserGroup = true ) : System.DirectoryServices.AccountManagement.GroupPrincipal

Creates a new group

Find ( ADCriteria criteria = null, ADObjectType objectType = ADObjectType.User ) : IEnumerable
Find ( string query, ADObjectType objectType = ADObjectType.User ) : IEnumerable

Performs a search on the current connection using the given query string (NOTE: Only users currently work)

GetGroup ( string groupName, System.DirectoryServices.AccountManagement.PrincipalContext context = null ) : System.DirectoryServices.AccountManagement.GroupPrincipal

Get the group with the specified id or null if not found

GetGroupByGuid ( System.Guid guid, System.DirectoryServices.AccountManagement.PrincipalContext context = null ) : System.DirectoryServices.AccountManagement.GroupPrincipal

Get the group with the specified guid or null if not found

GetOrCreate ( string groupName, System.Boolean isUserGroup = true ) : System.DirectoryServices.AccountManagement.GroupPrincipal
GetPrincipal ( System.DirectoryServices.SearchResult item ) : Principal
GetUser ( string userID, System.DirectoryServices.AccountManagement.PrincipalContext context = null ) : System.DirectoryServices.AccountManagement.UserPrincipal

Returns the user with the specified ID or null if not found

GetUserByGuid ( System.Guid guid, System.DirectoryServices.AccountManagement.PrincipalContext context = null ) : System.DirectoryServices.AccountManagement.UserPrincipal

Returns the user with the specified ID or null if not found

GetUserBySid ( object Sid ) : System.DirectoryServices.AccountManagement.UserPrincipal
IsInGroup ( System.DirectoryServices.AccountManagement.UserPrincipal adUser, string groupName ) : bool

Returns true if the user is in the specified group

RemoveUserFromGroup ( System.DirectoryServices.AccountManagement.UserPrincipal adUser, string groupName ) : void

Removes the user from the specified group

비공개 메소드들

메소드 설명
GetGlobalContainer ( string container ) : string
SysMessage ( string message ) : void

Writes debug statements to the output window

메소드 상세

ActiveDirectory() 공개 메소드

Create an Active Directory connection
public ActiveDirectory ( string container, string name, string userid, string password ) : System
container string
name string
userid string
password string
리턴 System

AddUserToGroup() 공개 메소드

Adds the user to the specified group
public AddUserToGroup ( System.DirectoryServices.AccountManagement.UserPrincipal adUser, string groupName ) : void
adUser System.DirectoryServices.AccountManagement.UserPrincipal User to add
groupName string Group to which the user should be added
리턴 void

ConnectionStringFor() 공개 메소드

public ConnectionStringFor ( string item = "" ) : string
item string
리턴 string

CreateGroup() 공개 메소드

Creates a new group
public CreateGroup ( string groupName, System.Boolean isUserGroup = true ) : System.DirectoryServices.AccountManagement.GroupPrincipal
groupName string The name of the new group
isUserGroup System.Boolean If true (default), the new group will be made a subgroup of Domain Users
리턴 System.DirectoryServices.AccountManagement.GroupPrincipal

Find() 공개 메소드

public Find ( ADCriteria criteria = null, ADObjectType objectType = ADObjectType.User ) : IEnumerable
criteria ADCriteria
objectType ADObjectType
리턴 IEnumerable

Find() 공개 메소드

Performs a search on the current connection using the given query string (NOTE: Only users currently work)
public Find ( string query, ADObjectType objectType = ADObjectType.User ) : IEnumerable
query string The query string
objectType ADObjectType What objects to search for (defaults to User)
리턴 IEnumerable

GetGroup() 공개 메소드

Get the group with the specified id or null if not found
public GetGroup ( string groupName, System.DirectoryServices.AccountManagement.PrincipalContext context = null ) : System.DirectoryServices.AccountManagement.GroupPrincipal
groupName string ID of the group
context System.DirectoryServices.AccountManagement.PrincipalContext
리턴 System.DirectoryServices.AccountManagement.GroupPrincipal

GetGroupByGuid() 공개 메소드

Get the group with the specified guid or null if not found
public GetGroupByGuid ( System.Guid guid, System.DirectoryServices.AccountManagement.PrincipalContext context = null ) : System.DirectoryServices.AccountManagement.GroupPrincipal
guid System.Guid
context System.DirectoryServices.AccountManagement.PrincipalContext
리턴 System.DirectoryServices.AccountManagement.GroupPrincipal

GetOrCreate() 공개 메소드

public GetOrCreate ( string groupName, System.Boolean isUserGroup = true ) : System.DirectoryServices.AccountManagement.GroupPrincipal
groupName string
isUserGroup System.Boolean
리턴 System.DirectoryServices.AccountManagement.GroupPrincipal

GetPrincipal() 공개 메소드

public GetPrincipal ( System.DirectoryServices.SearchResult item ) : Principal
item System.DirectoryServices.SearchResult
리턴 Principal

GetUser() 공개 메소드

Returns the user with the specified ID or null if not found
public GetUser ( string userID, System.DirectoryServices.AccountManagement.PrincipalContext context = null ) : System.DirectoryServices.AccountManagement.UserPrincipal
userID string ID of the user
context System.DirectoryServices.AccountManagement.PrincipalContext
리턴 System.DirectoryServices.AccountManagement.UserPrincipal

GetUserByGuid() 공개 메소드

Returns the user with the specified ID or null if not found
public GetUserByGuid ( System.Guid guid, System.DirectoryServices.AccountManagement.PrincipalContext context = null ) : System.DirectoryServices.AccountManagement.UserPrincipal
guid System.Guid
context System.DirectoryServices.AccountManagement.PrincipalContext
리턴 System.DirectoryServices.AccountManagement.UserPrincipal

GetUserBySid() 공개 메소드

public GetUserBySid ( object Sid ) : System.DirectoryServices.AccountManagement.UserPrincipal
Sid object
리턴 System.DirectoryServices.AccountManagement.UserPrincipal

IsInGroup() 공개 메소드

Returns true if the user is in the specified group
public IsInGroup ( System.DirectoryServices.AccountManagement.UserPrincipal adUser, string groupName ) : bool
adUser System.DirectoryServices.AccountManagement.UserPrincipal The user
groupName string The ID of the group to check for membership
리턴 bool

RemoveUserFromGroup() 공개 메소드

Removes the user from the specified group
public RemoveUserFromGroup ( System.DirectoryServices.AccountManagement.UserPrincipal adUser, string groupName ) : void
adUser System.DirectoryServices.AccountManagement.UserPrincipal User to remove
groupName string Group from which the user should be removed
리턴 void