private void ShowAnonymousProperties(SiteUser siteUser) { bool wouldSeeMoreIfAuthenticated = false; CProfileConfiguration profileConfig = CProfileConfiguration.GetConfig(); if (profileConfig != null) { foreach (CProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions) { if ( (propertyDefinition.VisibleToAnonymous) && (propertyDefinition.OnlyVisibleForRoles.Length == 0) && ( (propertyDefinition.OnlyAvailableForRoles.Length == 0) || (siteUser.IsInRoles(propertyDefinition.OnlyAvailableForRoles)) ) ) { object propValue = siteUser.GetProperty(propertyDefinition.Name, propertyDefinition.SerializeAs, propertyDefinition.LazyLoad); if (propValue != null) { CProfilePropertyDefinition.SetupReadOnlyPropertyControl( pnlProfileProperties, propertyDefinition, propValue.ToString(), timeOffset); } else { CProfilePropertyDefinition.SetupReadOnlyPropertyControl( pnlProfileProperties, propertyDefinition, propertyDefinition.DefaultValue, timeOffset); } } else { if ( (propertyDefinition.VisibleToAuthenticated) && (propertyDefinition.OnlyVisibleForRoles.Length == 0) && ( (propertyDefinition.OnlyAvailableForRoles.Length == 0) || (siteUser.IsInRoles(propertyDefinition.OnlyAvailableForRoles)) ) ) { wouldSeeMoreIfAuthenticated = true; } } } } if (wouldSeeMoreIfAuthenticated) { lblMessage.Text = ProfileResource.WouldSeeMoreIfAuthenticatedMessage; } }
private void ShowAuthenticatedProperties(SiteUser siteUser) { CProfileConfiguration profileConfig = CProfileConfiguration.GetConfig(); if (profileConfig != null) { foreach (CProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions) { if ( (propertyDefinition.VisibleToAuthenticated) && ( (propertyDefinition.OnlyAvailableForRoles.Length == 0) || (siteUser.IsInRoles(propertyDefinition.OnlyAvailableForRoles)) ) && ( (propertyDefinition.OnlyVisibleForRoles.Length == 0) || (WebUser.IsInRoles(propertyDefinition.OnlyVisibleForRoles)) ) ) { object propValue = siteUser.GetProperty(propertyDefinition.Name, propertyDefinition.SerializeAs, propertyDefinition.LazyLoad); if (propValue != null) { CProfilePropertyDefinition.SetupReadOnlyPropertyControl( pnlProfileProperties, propertyDefinition, propValue.ToString(), timeOffset); } else { CProfilePropertyDefinition.SetupReadOnlyPropertyControl( pnlProfileProperties, propertyDefinition, propertyDefinition.DefaultValue, timeOffset); } } } } }
private void PopulateProfileControls() { if (siteUser == null) { return; } CProfileConfiguration profileConfig = CProfileConfiguration.GetConfig(); if (profileConfig != null) { foreach (CProfilePropertyDefinition propertyDefinition in profileConfig.PropertyDefinitions) { if ( (propertyDefinition.VisibleToUser) && ( (propertyDefinition.OnlyAvailableForRoles.Length == 0) || (siteUser.IsInRoles(propertyDefinition.OnlyAvailableForRoles)) ) ) { object propValue = siteUser.GetProperty(propertyDefinition.Name, propertyDefinition.SerializeAs, propertyDefinition.LazyLoad); if (propValue != null) { if (propertyDefinition.EditableByUser) { CProfilePropertyDefinition.SetupPropertyControl( this, pnlProfileProperties, propertyDefinition, propValue.ToString(), timeOffset, SiteRoot); } else { CProfilePropertyDefinition.SetupReadOnlyPropertyControl( pnlProfileProperties, propertyDefinition, propValue.ToString(), timeOffset); } } else { if (propertyDefinition.EditableByUser) { CProfilePropertyDefinition.SetupPropertyControl( this, pnlProfileProperties, propertyDefinition, propertyDefinition.DefaultValue, timeOffset, SiteRoot); } else { CProfilePropertyDefinition.SetupReadOnlyPropertyControl( pnlProfileProperties, propertyDefinition, propertyDefinition.DefaultValue, timeOffset); } } } } } }