C# Класс pGina.Plugin.LocalMachine.LocalAccount

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
GenerateRandomPassword ( int length ) : string

Generates a random password that meets most of the requriements of Windows Server when password policy complexity requirements are in effect. http://technet.microsoft.com/en-us/library/cc786468%28v=ws.10%29.aspx This generates a string with at least two of each of the following character classes: uppercase letters, lowercase letters, and digits. However, this method does not check for the existence of the username or display name within the generated password. The probability of that occurring is somewhat remote, but could happen. If that is a concern, this method could be called repeatedly until a string is returned that does not contain the username or display name.

GetGroupPrincipal ( SecurityIdentifier sid ) : System.DirectoryServices.AccountManagement.GroupPrincipal
GetGroupPrincipal ( string groupname ) : System.DirectoryServices.AccountManagement.GroupPrincipal

Finds and returns the GroupPrincipal object if it exists, if not, returns null. This method uses PrincipalSearcher because it is faster than GroupPrincipal.FindByIdentity. The group name comparison is case insensitive.

GetUserDirectoryEntry ( string username ) : System.DirectoryServices.DirectoryEntry
GetUserPrincipal ( SecurityIdentifier sid ) : System.DirectoryServices.AccountManagement.UserPrincipal
GetUserPrincipal ( string username ) : System.DirectoryServices.AccountManagement.UserPrincipal

Finds and returns the UserPrincipal object if it exists, if not, returns null. This method uses PrincipalSearcher because it is faster than UserPrincipal.FindByIdentity. The username comparison is case insensitive.

LocalAccount ( UserInformation userInfo ) : System
RemoveUserAndProfile ( string user, int sessionID ) : void
ScrambleUsersPassword ( string username ) : void
SyncLocalGroupsToUserInfo ( UserInformation userInfo ) : void
SyncToLocalUser ( ) : void
SyncUserInfoToLocalUser ( UserInformation userInfo ) : void
UserExists ( string strUserName ) : bool

This is a faster technique for determining whether or not a user exists on the local machine. UserPrincipal.FindByIdentity tends to be quite slow in general, so if you only need to know whether or not the account exists, this method is much faster.

Приватные методы

Метод Описание
AddUserToGroup ( System.DirectoryServices.AccountManagement.UserPrincipal user, System.DirectoryServices.AccountManagement.GroupPrincipal group ) : void
Connect2share ( string share, string username, string password, uint retry, System.Boolean DISconnect ) : System.Boolean
CreateOrGetGroupPrincipal ( GroupInformation groupInfo ) : System.DirectoryServices.AccountManagement.GroupPrincipal
CreateOrGetUserPrincipal ( UserInformation userInfo ) : System.DirectoryServices.AccountManagement.UserPrincipal
GetGroups ( System.DirectoryServices.AccountManagement.UserPrincipal user ) : List

Returns a list of groups of which the user is a member. It does so in a fashion that may seem strange since one can call UserPrincipal.GetGroups, but seems to be much faster in my tests.

IsUserInGroup ( System.DirectoryServices.AccountManagement.UserPrincipal user, GroupInformation groupInfo ) : bool
IsUserInGroup ( System.DirectoryServices.AccountManagement.UserPrincipal user, System.DirectoryServices.AccountManagement.GroupPrincipal group ) : bool
IsUserInGroup ( string username, string groupname ) : bool
LocalAccount ( ) : System
RecurseDelete ( string directory ) : void
RemoveUserFromGroup ( System.DirectoryServices.AccountManagement.UserPrincipal user, System.DirectoryServices.AccountManagement.GroupPrincipal group ) : void
SMBserver ( string share, System.Boolean visversa ) : string[]
SetACL ( UserInformation userInfo, string ProfileExtension ) : System.Boolean
SyncUserPrincipalInfo ( UserInformation info ) : void

Описание методов

GenerateRandomPassword() публичный статический Метод

Generates a random password that meets most of the requriements of Windows Server when password policy complexity requirements are in effect. http://technet.microsoft.com/en-us/library/cc786468%28v=ws.10%29.aspx This generates a string with at least two of each of the following character classes: uppercase letters, lowercase letters, and digits. However, this method does not check for the existence of the username or display name within the generated password. The probability of that occurring is somewhat remote, but could happen. If that is a concern, this method could be called repeatedly until a string is returned that does not contain the username or display name.
public static GenerateRandomPassword ( int length ) : string
length int Password length, must be at least 6.
Результат string

GetGroupPrincipal() публичный статический Метод

public static GetGroupPrincipal ( SecurityIdentifier sid ) : System.DirectoryServices.AccountManagement.GroupPrincipal
sid SecurityIdentifier
Результат System.DirectoryServices.AccountManagement.GroupPrincipal

GetGroupPrincipal() публичный статический Метод

Finds and returns the GroupPrincipal object if it exists, if not, returns null. This method uses PrincipalSearcher because it is faster than GroupPrincipal.FindByIdentity. The group name comparison is case insensitive.
public static GetGroupPrincipal ( string groupname ) : System.DirectoryServices.AccountManagement.GroupPrincipal
groupname string
Результат System.DirectoryServices.AccountManagement.GroupPrincipal

GetUserDirectoryEntry() публичный статический Метод

public static GetUserDirectoryEntry ( string username ) : System.DirectoryServices.DirectoryEntry
username string
Результат System.DirectoryServices.DirectoryEntry

GetUserPrincipal() публичный статический Метод

public static GetUserPrincipal ( SecurityIdentifier sid ) : System.DirectoryServices.AccountManagement.UserPrincipal
sid SecurityIdentifier
Результат System.DirectoryServices.AccountManagement.UserPrincipal

GetUserPrincipal() публичный статический Метод

Finds and returns the UserPrincipal object if it exists, if not, returns null. This method uses PrincipalSearcher because it is faster than UserPrincipal.FindByIdentity. The username comparison is case insensitive.
public static GetUserPrincipal ( string username ) : System.DirectoryServices.AccountManagement.UserPrincipal
username string The username to search for.
Результат System.DirectoryServices.AccountManagement.UserPrincipal

LocalAccount() публичный Метод

public LocalAccount ( UserInformation userInfo ) : System
userInfo pGina.Shared.Types.UserInformation
Результат System

RemoveUserAndProfile() публичный Метод

public RemoveUserAndProfile ( string user, int sessionID ) : void
user string
sessionID int
Результат void

ScrambleUsersPassword() публичный Метод

public ScrambleUsersPassword ( string username ) : void
username string
Результат void

SyncLocalGroupsToUserInfo() публичный статический Метод

public static SyncLocalGroupsToUserInfo ( UserInformation userInfo ) : void
userInfo pGina.Shared.Types.UserInformation
Результат void

SyncToLocalUser() публичный Метод

public SyncToLocalUser ( ) : void
Результат void

SyncUserInfoToLocalUser() публичный статический Метод

public static SyncUserInfoToLocalUser ( UserInformation userInfo ) : void
userInfo pGina.Shared.Types.UserInformation
Результат void

UserExists() публичный статический Метод

This is a faster technique for determining whether or not a user exists on the local machine. UserPrincipal.FindByIdentity tends to be quite slow in general, so if you only need to know whether or not the account exists, this method is much faster.
public static UserExists ( string strUserName ) : bool
strUserName string The user name
Результат bool