public override void SaveProperties(IUser user, IPropertyCollection propertyCollection) { if (user == null) { throw new ArgumentNullException("user"); } this.UserCache.RemoveUserFromCache(user); if (propertyCollection == null) { throw new ArgumentNullException("propertyCollection"); } DirectoryObject dirObj = CurrentDS.CreateDirectoryObjectInstance(); dirObj.Id = user.Id; foreach (IProperty property in propertyCollection) { if (dirObj.Contains(property.Name)) { dirObj[property.Name] = property.ToSerializedString(); property.IsDirty = false; } } CurrentDS.SaveDirectoryObject(dirObj); }
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)); }
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); }