private IPropertyCollection GetPropertiesFromDirectoryObject(DirectoryObject doUser) { var schema = this.GetDefaultContextSchema(); var propertyList = new List<IProperty>(); foreach(PropertyDefinition pd in schema) { string propertyValue = (doUser != null && doUser.Contains(pd.PropertyName)) ? doUser[pd.PropertyName] : null; string propertyName = pd.PropertyName; IProperty property = new Property<string>(propertyName, Context.DefaultContext, CultureInfo.InvariantCulture); property.Value = propertyValue; propertyList.Add(property); } return new PropertyCollection(propertyList, schema); }
public abstract void SaveDirectoryObject(DirectoryObject directoryObject);
private IUser GetUserFromDirectoryObject(DirectoryObject doUser) { // If ID is formated as a guid then convert to LDAP searchable octet string string userId = ConvertOctetString(doUser.Id); var user = new User(userId, doUser[this.PropertyNames.UserName] ?? doUser.Id, string.Empty, GetPropertiesFromDirectoryObject(doUser), this.PropertyNames); return user; }