Ejemplo n.º 1
0
        /// <summary>
        /// Constructor that instantiates an AdUser object with the values of the specified
        /// UserPrincipal's attributes.
        /// </summary>
        /// <param name="user"></param>
        public AdUser(UserPrincipal user)
        {
            this.AccountExpirationData             = user.AccountExpirationDate.ToString();
            this.AccountLockoutTime                = user.AccountLockoutTime.ToString();
            this.AllowReversiblePasswordEncryption = user.AllowReversiblePasswordEncryption;
            this.BadLogonCount       = user.BadLogonCount;
            this.Company             = GetCompany(user);
            this.DelegationPermitted = user.DelegationPermitted;
            this.Department          = GetDepartment(user);
            this.Description         = user.Description;
            this.DisplayName         = user.DisplayName;
            this.DistinguishedName   = user.DistinguishedName;
            this.EmailAddress        = user.EmailAddress;
            this.EmployeeId          = user.EmployeeId;
            this.Enabled             = user.Enabled;
            this.GivenName           = user.GivenName;
            this.Guid                   = user.Guid.ToString();
            this.HomeDirectory          = user.HomeDirectory;
            this.HomeDrive              = user.HomeDrive;
            this.LastBadPasswordAttempt = user.LastBadPasswordAttempt.ToString();
            this.LastLogon              = user.LastLogon.ToString();
            this.LastPasswordSet        = user.LastPasswordSet.ToString();
            this.Manager                = GetManager(user);
            this.MemberOf               = AdGroup.GetAdGroupSamAccountNames(user.GetGroups());
            this.MiddleName             = user.MiddleName;
            this.Mobile                 = GetMobile(user);
            this.Name                   = user.Name;
            this.PasswordNeverExpires   = user.PasswordNeverExpires;
            this.PasswordNotRequired    = user.PasswordNotRequired;
            this.ProfilePath            = AdToolkit.GetProperty(user, "profilePath");
            this.SamAccountName         = user.SamAccountName;
            this.ScriptPath             = user.ScriptPath;
            this.Sid = user.Sid.Value;
            this.SmartCardLogonRequired = user.SmartcardLogonRequired;
            this.Surname = user.Surname;
            this.UserCannotChangePassword = user.UserCannotChangePassword;
            this.UserPrincipalName        = user.UserPrincipalName;
            this.VoiceTelephoneNumber     = user.VoiceTelephoneNumber;

            //user.GetGroups
        }
Ejemplo n.º 2
0
 public static string GetMobile(Principal user)
 {
     return(AdToolkit.GetProperty(user, "mobile"));
 }
Ejemplo n.º 3
0
 public static String GetDepartment(Principal user)
 {
     return(AdToolkit.GetProperty(user, "department"));
 }
Ejemplo n.º 4
0
        public static string GetManager(Principal user)
        {
            string managerDn = AdToolkit.GetProperty(user, "manager");

            return(AdToolkit.GetSamAccountName(managerDn));
        }
Ejemplo n.º 5
0
 public static String GetCompany(Principal user)
 {
     return(AdToolkit.GetProperty(user, "company"));
 }