Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,171 @@
2009-10-27 Marek Habersack <mhabersack@novell.com>
* ProfileBase.cs: CreateSettingsProperty sets the returned
property's DefaultValue to String.Empty if no default is specified
through the DefaultSettingValue attribute and the associated
property type is String.
2009-10-22 Marek Habersack <mhabersack@novell.com>
* ProfileBase.cs: put named entries into SettingProperty's
Attributes collection based on custom attributes decorating the
associated profile property.
* CustomProviderDataAttribute.cs: implemented IsDefaultAttribute
2009-09-08 Marek Habersack <mhabersack@novell.com>
* ProfileParser.cs: GetProfileGroupType creates type name with
"ProfileGroup" prefix instead of "ProfileCommon". Fixes bug
#535655
* ProfileBase.cs: typo fix - renamed CreateSettingsPropery to
CreateSettingsProperty
2008-12-25 Gonzalo Paniagua Javier <gonzalo@novell.com>
* SqlProfileProvider.cs: use IndexOf (char).
2008-06-30 Marek Habersack <mhabersack@novell.com>
* SqliteProfileProvider.cs: remove unused method
2008-05-30 Marek Habersack <mhabersack@novell.com>
* ProfileModule.cs: do not use synthetized event accessors (to
avoid locks).
2007-12-30 Vladimir Krasnov <vladimirk@mainsoft.com>
* SqlProfileProvider.cs: added db schema checking
2007-12-13 Marek Habersack <mhabersack@novell.com>
* SqlProfileProvider.cs, ProfileParser.cs: speed optimization -
use String.Concat instead of String.Format in some cases.
2007-12-12 Vladimir Krasnov <vladimirk@mainsoft.com>
* ProfileParser.jvm.cs: Profile types loading optimized
2007-12-11 Vladimir Krasnov <vladimirk@mainsoft.com>
* ProfileManager.cs: fixed Providers property to be thread safe
2007-12-08 Marek Habersack <mhabersack@novell.com>
* SqliteProfileProvider.cs: added - a Profile Provider for
Sqlite, based on PostgreSQL Profile Provider code from Daniel
Nauck <dna@informatik.uni-kiel.de>
2007-10-15 Marek Habersack <mhabersack@novell.com>
* ProfileBase.cs: use HttpApplication.LoadType instead of
Type.GetType.
2007-08-14 Marek Habersack <mhabersack@novell.com>
* SqlProfileProvider.cs: remove unused variable.
2007-07-16 Vladimir Krasnov <vladimirk@mainsoft.com>
* ProfileBase.cs: fixed typo bug in InitProperties
2007-05-21 Vladimir Krasnov <vladimirk@mainsoft.com>
* ProfileModule.cs: OnLeave checks if Profile was accessed during a
request
2007-04-17 Igor Zelmanovich <igorz@mainsoft.com>
* ProfileManager.cs:
if default provider was not found ConfigurationErrorsException is thrown.
2007-03-14 Vladimir Krasnov <vladimirk@mainsoft.com>
* ProfileParser.jvm.cs: performance optimization
2007-01-18 Vladimir Krasnov <vladimirk@mainsoft.com>
* ProfileModule.cs: fixed OnLeave, AutomaticSaveEnabled should be
checked before save
2007-01-02 Vladimir Krasnov <vladimirk@mainsoft.com>
* ProfileBase.cs: fixed SetPropertyValue, allow anonymous attribute
check added on property value set
2007-01-02 Vladimir Krasnov <vladimirk@mainsoft.com>
* ProfileBase.cs: added inherited properties properties initialization
2006-12-26 Vladimir Krasnov <vladimirk@mainsoft.com>
* ProfileGroupBase.cs: fixed property name while getting from parent
2006-12-26 Vladimir Krasnov <vladimirk@mainsoft.com>
* ProfileParser.jvm.cs: implemented PageMapper call
* ProfileBase.cs: fixed SettingsProperty type resolving,
added SettingsProperty validation
2006-12-20 Marek Habersack <grendello@gmail.com>
* ProfileParser.cs: use App_Code compiler to get the assembly
where the ProfileCommon class is found.
2006-11-05 Vladimir Krasnov <vladimirk@mainsoft.com>
* ProfileBase.cs, ProfileGroupBase.cs, ProfileManager.cs,
ProfileModule.cs, ProfileProviderCollection.cs, SqlProfileProvider.cs:
implemented profile feature
* added: ProfileParser.cs, ProfileParser.jvm.cs stubs for profile
helper classes compilation
2006-02-28 Chris Toshok <toshok@ximian.com>
* ProfileBase.cs: corcompare work.
* SqlProfileProvider.cs: add stubbed out file.
2005-11-30 Chris Toshok <toshok@ximian.com>
* ProfileBase.cs (Properties): mark as override, not static.
* ProfileProviderCollection.cs (ProfileProvider): mark as "new" to
fix warning.
2005-11-18 Chris Toshok <toshok@ximian.com>
* ProfileModule.cs: hook up saving of the request's profile.
* ProfileBase.cs (Save): call base.Save instead of throwing NIE.
2005-11-03 Chris Toshok <toshok@ximian.com>
* ProfileEventArgs.cs, ProfileProviderCollection.cs,
ProfileAutoSaveEventArgs.cs, ProfileMigrateEventArgs.cs,
ProfileBase.cs, ProfileManager.cs,
SettingsAllowAnonymousAttribute.cs, ProfileProviderAttribute.cs,
ProfileEventHandler.cs, CustomProviderDataAttribute.cs,
DefaultProfile.cs, ProfileModule.cs,
ProfileAutoSaveEventHandler.cs, ProfileGroupBase.cs,
ProfileMigrateEventHandler.cs: 90% unimplemented skeletons.
* ProfileInfoCollection.cs: make serializable.
* ProfileAuthenticationOption.cs: fix ordering of enum elements.
2005-11-03 Chris Toshok <toshok@ximian.com>
* ProfileInfoCollection.cs: new implementation.
* ProfileProvider.cs: new implementation.
2005-08-19 Chris Toshok <toshok@ximian.com>
* ProfileInfo.cs: I was bored. implement this.
2004-08-02 Duncan Mak <duncan@ximian.com>
* ProfileAuthenticationOption.cs: Added enumeration.

View File

@@ -0,0 +1,57 @@
//
// System.Web.Profile.CustomProviderDataAttribute.cs
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005-2009 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
namespace System.Web.Profile
{
[AttributeUsage (AttributeTargets.Property)]
public sealed class CustomProviderDataAttribute : Attribute
{
public CustomProviderDataAttribute (string customProviderData)
{
this.customProviderData = customProviderData;
}
public override bool IsDefaultAttribute ()
{
return String.IsNullOrEmpty (CustomProviderData);
}
public string CustomProviderData {
get {
return customProviderData;
}
}
string customProviderData;
}
}
#endif

View File

@@ -0,0 +1,45 @@
//
// System.Web.UI.WebControls.DefaultProfile.cs
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
using System.Configuration;
namespace System.Web.Profile
{
public class DefaultProfile : ProfileBase
{
[MonoTODO("Currently does nothing")]
public DefaultProfile ()
{
}
}
}
#endif

View File

@@ -0,0 +1,39 @@
//
// System.Web.Profile.ProfileAuthenticationOption.cs
//
// Authors:
// Duncan Mak (duncan@ximian.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
#if NET_2_0
namespace System.Web.Profile
{
public enum ProfileAuthenticationOption
{
Anonymous = 0,
Authenticated = 1,
All = 2
}
}
#endif

View File

@@ -0,0 +1,62 @@
//
// System.Web.UI.WebControls.ProfileAutoSaveEventArgs.cs
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
namespace System.Web.Profile
{
public sealed class ProfileAutoSaveEventArgs : EventArgs
{
public ProfileAutoSaveEventArgs (HttpContext context)
{
this.context = context;
this.continueWithProfileAutoSave = true;
}
public HttpContext Context {
get {
return context;
}
}
public bool ContinueWithProfileAutoSave {
get {
return continueWithProfileAutoSave;
}
set {
continueWithProfileAutoSave = value;
}
}
HttpContext context;
bool continueWithProfileAutoSave;
}
}
#endif

View File

@@ -0,0 +1,37 @@
//
// System.Web.UI.WebControls.ProfileAutoSaveEventHandler.cs
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
namespace System.Web.Profile
{
public delegate void ProfileAutoSaveEventHandler (object sender, ProfileAutoSaveEventArgs e);
}
#endif

View File

@@ -0,0 +1,384 @@
//
// System.Web.UI.WebControls.ProfileBase.cs
//
// Authors:
// Chris Toshok (toshok@ximian.com)
// Vladimir Krasnov (vladimirk@mainsoft.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
using System.Configuration;
using System.Configuration.Provider;
using System.Web.Security;
using System.Web.Configuration;
using System.Reflection;
namespace System.Web.Profile
{
public class ProfileBase : SettingsBase
{
bool _propertiyValuesLoaded = false;
bool _dirty = false;
DateTime _lastActivityDate = DateTime.MinValue;
DateTime _lastUpdatedDate = DateTime.MinValue;
SettingsContext _settingsContext = null;
SettingsPropertyValueCollection _propertiyValues = null;
const string Profiles_SettingsPropertyCollection = "Profiles.SettingsPropertyCollection";
#if TARGET_J2EE
static SettingsPropertyCollection _properties
{
get
{
object o = AppDomain.CurrentDomain.GetData (Profiles_SettingsPropertyCollection);
return (SettingsPropertyCollection) o;
}
set
{
AppDomain.CurrentDomain.SetData (Profiles_SettingsPropertyCollection, value);
}
}
#else
static SettingsPropertyCollection _properties = null;
#endif
static void InitProperties ()
{
SettingsPropertyCollection properties = new SettingsPropertyCollection ();
ProfileSection config = (ProfileSection) WebConfigurationManager.GetSection ("system.web/profile");
RootProfilePropertySettingsCollection ps = config.PropertySettings;
for (int i = 0; i < ps.GroupSettings.Count; i++) {
ProfileGroupSettings pgs = ps.GroupSettings [i];
ProfilePropertySettingsCollection ppsc = pgs.PropertySettings;
for (int s = 0; s < ppsc.Count; s++) {
SettingsProperty settingsProperty = CreateSettingsProperty (pgs, ppsc [s]);
ValidateProperty (settingsProperty, ppsc [s].ElementInformation);
properties.Add (settingsProperty);
}
}
for (int s = 0; s < ps.Count; s++) {
SettingsProperty settingsProperty = CreateSettingsProperty (null, ps [s]);
ValidateProperty (settingsProperty, ps [s].ElementInformation);
properties.Add (settingsProperty);
}
if (config.Inherits.Length > 0) {
Type profileType = ProfileParser.GetProfileCommonType (HttpContext.Current);
if (profileType != null) {
Type properiesType = profileType.BaseType;
for (; ; ) {
PropertyInfo [] pi = properiesType.GetProperties (BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
if (pi.Length > 0)
for (int i = 0; i < pi.Length; i++)
properties.Add (CreateSettingsProperty (pi [i]));
if (properiesType.BaseType == null ||
properiesType.BaseType == typeof (ProfileBase))
break;
properiesType = properiesType.BaseType;
}
}
}
properties.SetReadOnly ();
lock (Profiles_SettingsPropertyCollection) {
if (_properties == null)
_properties = properties;
}
}
public ProfileBase ()
{
}
public static ProfileBase Create (string username)
{
return Create (username, true);
}
public static ProfileBase Create (string username, bool isAuthenticated)
{
ProfileBase profile = null;
Type profileType = ProfileParser.GetProfileCommonType (HttpContext.Current);
if (profileType != null)
profile = (ProfileBase) Activator.CreateInstance (profileType);
else
profile = (ProfileBase) new DefaultProfile ();
profile.Initialize (username, isAuthenticated);
return profile;
}
public ProfileGroupBase GetProfileGroup (string groupName)
{
ProfileGroupBase group = null;
Type groupType = ProfileParser.GetProfileGroupType (HttpContext.Current, groupName);
if (groupType != null)
group = (ProfileGroupBase) Activator.CreateInstance (groupType);
else
throw new ProviderException ("Group '" + groupName + "' not found");
group.Init (this, groupName);
return group;
}
public object GetPropertyValue (string propertyName)
{
if (!_propertiyValuesLoaded)
InitPropertiesValues ();
_lastActivityDate = DateTime.UtcNow;
return ((SettingsPropertyValue) _propertiyValues [propertyName]).PropertyValue;
}
public void SetPropertyValue (string propertyName, object propertyValue)
{
if (!_propertiyValuesLoaded)
InitPropertiesValues ();
if (_propertiyValues [propertyName] == null)
throw new SettingsPropertyNotFoundException ("The settings property '" + propertyName + "' was not found.");
if (!(bool)((SettingsPropertyValue)
_propertiyValues [propertyName]).Property.Attributes["AllowAnonymous"] && IsAnonymous)
throw new ProviderException ("This property cannot be set for anonymous users.");
((SettingsPropertyValue) _propertiyValues [propertyName]).PropertyValue = propertyValue;
_dirty = true;
_lastActivityDate = DateTime.UtcNow;
_lastUpdatedDate = _lastActivityDate;
}
public override object this [string propertyName]
{
get
{
return GetPropertyValue (propertyName);
}
set
{
SetPropertyValue (propertyName, value);
}
}
void InitPropertiesValues ()
{
if (!_propertiyValuesLoaded) {
_propertiyValues = ProfileManager.Provider.GetPropertyValues (_settingsContext, Properties);
_propertiyValuesLoaded = true;
}
}
static Type GetPropertyType (ProfileGroupSettings pgs, ProfilePropertySettings pps)
{
Type type = HttpApplication.LoadType (pps.Type);
if (type != null)
return type;
Type profileType = null;
if (pgs == null)
profileType = ProfileParser.GetProfileCommonType (HttpContext.Current);
else
profileType = ProfileParser.GetProfileGroupType (HttpContext.Current, pgs.Name);
if (profileType == null)
return null;
PropertyInfo pi = profileType.GetProperty (pps.Name);
if (pi != null)
return pi.PropertyType;
return null;
}
static void ValidateProperty (SettingsProperty settingsProperty, ElementInformation elementInfo)
{
string exceptionMessage = string.Empty;
if (!AnonymousIdentificationModule.Enabled &&
(bool) settingsProperty.Attributes ["AllowAnonymous"])
exceptionMessage = "Profile property '{0}' allows anonymous users to store data. " +
"This requires that the AnonymousIdentification feature be enabled.";
if (settingsProperty.PropertyType == null)
exceptionMessage = "The type specified for a profile property '{0}' could not be found.";
if (settingsProperty.SerializeAs == SettingsSerializeAs.Binary &&
!settingsProperty.PropertyType.IsSerializable)
exceptionMessage = "The type for the property '{0}' cannot be serialized " +
"using the binary serializer, since the type is not marked as serializable.";
if (exceptionMessage.Length > 0)
throw new ConfigurationErrorsException (string.Format (exceptionMessage, settingsProperty.Name),
elementInfo.Source, elementInfo.LineNumber);
}
static SettingsProperty CreateSettingsProperty (PropertyInfo property)
{
SettingsProperty sp = new SettingsProperty (property.Name);
Attribute [] attributes = (Attribute [])property.GetCustomAttributes (false);
SettingsAttributeDictionary attDict = new SettingsAttributeDictionary();
bool defaultAssigned = false;
sp.SerializeAs = SettingsSerializeAs.ProviderSpecific;
sp.PropertyType = property.PropertyType;
sp.IsReadOnly = false;
sp.ThrowOnErrorDeserializing = false;
sp.ThrowOnErrorSerializing = true;
for (int i = 0; i < attributes.Length; i++) {
if (attributes [i] is DefaultSettingValueAttribute) {
sp.DefaultValue = ((DefaultSettingValueAttribute) attributes [i]).Value;
defaultAssigned = true;
} else if (attributes [i] is SettingsProviderAttribute) {
Type providerType = HttpApplication.LoadType (((SettingsProviderAttribute) attributes [i]).ProviderTypeName);
sp.Provider = (SettingsProvider) Activator.CreateInstance (providerType);
sp.Provider.Initialize (null, null);
} else if (attributes [i] is SettingsSerializeAsAttribute) {
sp.SerializeAs = ((SettingsSerializeAsAttribute) attributes [i]).SerializeAs;
} else if (attributes [i] is SettingsAllowAnonymousAttribute) {
sp.Attributes ["AllowAnonymous"] = ((SettingsAllowAnonymousAttribute) attributes [i]).Allow;
} else if (attributes [i] is CustomProviderDataAttribute) {
sp.Attributes ["CustomProviderData"] = ((CustomProviderDataAttribute) attributes [i]).CustomProviderData;
} else if (attributes [i] is ApplicationScopedSettingAttribute ||
attributes [i] is UserScopedSettingAttribute ||
attributes [i] is SettingsDescriptionAttribute ||
attributes [i] is SettingAttribute)
attDict.Add (attributes [i].GetType (), attributes [i]);
}
if (sp.Provider == null)
sp.Provider = ProfileManager.Provider;
if (sp.Attributes ["AllowAnonymous"] == null)
sp.Attributes ["AllowAnonymous"] = false;
if (!defaultAssigned && sp.PropertyType == typeof (string) && sp.DefaultValue == null)
sp.DefaultValue = String.Empty;
return sp;
}
static SettingsProperty CreateSettingsProperty (ProfileGroupSettings pgs, ProfilePropertySettings pps)
{
string name = ((pgs == null) ? String.Empty : pgs.Name + ".") + pps.Name;
SettingsProperty sp = new SettingsProperty (name);
sp.Attributes.Add ("AllowAnonymous", pps.AllowAnonymous);
sp.DefaultValue = pps.DefaultValue;
sp.IsReadOnly = pps.ReadOnly;
sp.Provider = ProfileManager.Provider;
sp.ThrowOnErrorDeserializing = false;
sp.ThrowOnErrorSerializing = true;
if (pps.Type.Length == 0 || pps.Type == "string")
sp.PropertyType = typeof (string);
else
sp.PropertyType = GetPropertyType (pgs, pps);
switch (pps.SerializeAs) {
case SerializationMode.Binary:
sp.SerializeAs = SettingsSerializeAs.Binary;
break;
case SerializationMode.ProviderSpecific:
sp.SerializeAs = SettingsSerializeAs.ProviderSpecific;
break;
case SerializationMode.String:
sp.SerializeAs = SettingsSerializeAs.String;
break;
case SerializationMode.Xml:
sp.SerializeAs = SettingsSerializeAs.Xml;
break;
}
return sp;
}
public void Initialize (string username, bool isAuthenticated)
{
_settingsContext = new SettingsContext ();
_settingsContext.Add ("UserName", username);
_settingsContext.Add ("IsAuthenticated", isAuthenticated);
SettingsProviderCollection spc = new SettingsProviderCollection();
spc.Add (ProfileManager.Provider);
base.Initialize (Context, ProfileBase.Properties, spc);
}
public override void Save ()
{
if (IsDirty) {
ProfileManager.Provider.SetPropertyValues (_settingsContext, _propertiyValues);
}
}
public bool IsAnonymous {
get {
return !(bool) _settingsContext ["IsAuthenticated"];
}
}
public bool IsDirty {
get {
return _dirty;
}
}
public DateTime LastActivityDate {
get {
return _lastActivityDate;
}
}
public DateTime LastUpdatedDate {
get {
return _lastUpdatedDate;
}
}
public new static SettingsPropertyCollection Properties {
get {
if (_properties == null)
InitProperties ();
return _properties;
}
}
public string UserName {
get {
return (string) _settingsContext ["UserName"];
}
}
}
}
#endif

View File

@@ -0,0 +1,63 @@
//
// System.Web.UI.WebControls.ProfileEventArgs.cs
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
namespace System.Web.Profile
{
public sealed class ProfileEventArgs : EventArgs
{
public ProfileEventArgs (HttpContext context)
{
this.context = context;
}
public HttpContext Context {
get {
return context;
}
}
public ProfileBase Profile {
get {
return profile;
}
set {
profile = value;
}
}
ProfileBase profile;
HttpContext context;
}
}
#endif

View File

@@ -0,0 +1,37 @@
//
// System.Web.UI.WebControls.ProfileEventHandler.cs
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
namespace System.Web.Profile
{
public delegate void ProfileEventHandler (object sender, ProfileEventArgs e);
}
#endif

View File

@@ -0,0 +1,72 @@
//
// System.Web.UI.WebControls.ProfileGroupBase.cs
//
// Authors:
// Chris Toshok (toshok@ximian.com)
// Vladimir Krasnov (vladimirk@mainsoft.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
using System.Configuration;
namespace System.Web.Profile
{
public class ProfileGroupBase
{
ProfileBase _parent = null;
string _name = null;
public ProfileGroupBase ()
{
}
public void Init (ProfileBase parent, string myName)
{
_parent = parent;
_name = myName;
}
public object GetPropertyValue (string propertyName)
{
return _parent.GetPropertyValue (_name + "." + propertyName);
}
public void SetPropertyValue (string propertyName, object propertyValue)
{
_parent.SetPropertyValue (_name + "." + propertyName, propertyValue);
}
public object this [string propertyName] {
get {
return GetPropertyValue (propertyName);
}
set {
SetPropertyValue (propertyName, value);
}
}
}
}
#endif

View File

@@ -0,0 +1,94 @@
//
// System.Web.Profile.ProfileInfo.cs
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
namespace System.Web.Profile
{
[Serializable]
public class ProfileInfo
{
string user_name;
bool is_anonymous;
DateTime last_activity_date;
DateTime last_updated_date;
int size;
protected ProfileInfo ()
{
}
public ProfileInfo (string username,
bool isAnonymous,
DateTime lastActivityDate,
DateTime lastUpdatedDate,
int size)
{
user_name = username;
is_anonymous = isAnonymous;
last_activity_date = lastActivityDate;
last_updated_date = lastUpdatedDate;
this.size = size;
}
public virtual bool IsAnonymous
{
get {
return is_anonymous;
}
}
public virtual DateTime LastActivityDate
{
get {
return last_activity_date;
}
}
public virtual DateTime LastUpdatedDate {
get {
return last_updated_date;
}
}
public virtual int Size {
get {
return size;
}
}
public virtual string UserName {
get {
return user_name;
}
}
}
}
#endif

View File

@@ -0,0 +1,129 @@
//
// System.Web.Profile.ProfileInfoCollection.cs
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
using System.Collections;
namespace System.Web.Profile
{
[Serializable]
public sealed class ProfileInfoCollection : ICollection, IEnumerable
{
public ProfileInfoCollection()
{
list = new ArrayList ();
}
public void Add (ProfileInfo profileInfo)
{
if (readOnly)
throw new NotSupportedException ();
list.Add (profileInfo);
}
public void Clear ()
{
if (readOnly)
throw new NotSupportedException ();
list.Clear ();
}
public void CopyTo (System.Array array, int index)
{
list.CopyTo (array, index);
}
public void CopyTo (ProfileInfo[ ] array, int index)
{
list.CopyTo (array, index);
}
public IEnumerator GetEnumerator ()
{
return list.GetEnumerator ();
}
public void Remove (string name)
{
if (readOnly)
throw new NotSupportedException ();
for (int i = 0; i < list.Count; i ++) {
ProfileInfo info = (ProfileInfo)list[i];
if (info.UserName == name) {
list.Remove (i);
break;
}
}
}
public void SetReadOnly ()
{
readOnly = true;
}
public int Count {
get {
return list.Count;
}
}
public bool IsSynchronized {
get {
return false;
}
}
public object SyncRoot {
get {
return this;
}
}
public ProfileInfo this [string name] {
get {
for (int i = 0; i < list.Count; i ++) {
ProfileInfo info = (ProfileInfo)list[i];
if (info.UserName == name) {
return info;
}
}
return null;
}
}
ArrayList list;
bool readOnly;
}
}
#endif

View File

@@ -0,0 +1,215 @@
//
// System.Web.Profile.ProfileManager.cs
//
// Authors:
// Chris Toshok (toshok@ximian.com)
// Vladimir Krasnov (vladimirk@mainsoft.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
using System.Web;
using System.Web.Configuration;
using System.Configuration;
namespace System.Web.Profile
{
public static class ProfileManager
{
#if TARGET_J2EE
const string Profiles_config = "Profiles.config";
const string Profiles_ProfileProviderCollection = "Profiles.ProfileProviderCollection";
static ProfileSection config
{
get
{
object o = AppDomain.CurrentDomain.GetData (Profiles_config);
if (o == null) {
config = (ProfileSection) WebConfigurationManager.GetSection ("system.web/profile");
return (ProfileSection) config;
}
return (ProfileSection) o;
}
set
{
AppDomain.CurrentDomain.SetData (Profiles_config, value);
}
}
static ProfileProviderCollection providersCollection
{
get
{
object o = AppDomain.CurrentDomain.GetData (Profiles_ProfileProviderCollection);
return (ProfileProviderCollection) o;
}
set
{
AppDomain.CurrentDomain.SetData (Profiles_ProfileProviderCollection, value);
}
}
#else
static ProfileSection config;
static ProfileProviderCollection providersCollection;
static ProfileManager ()
{
config = (ProfileSection) WebConfigurationManager.GetSection ("system.web/profile");
}
#endif
public static int DeleteInactiveProfiles (ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
{
return Provider.DeleteInactiveProfiles (authenticationOption, userInactiveSinceDate);
}
public static bool DeleteProfile (string username)
{
return Provider.DeleteProfiles (new string [] { username }) > 0;
}
public static int DeleteProfiles (string[] usernames)
{
return Provider.DeleteProfiles (usernames);
}
public static int DeleteProfiles (ProfileInfoCollection profiles)
{
return Provider.DeleteProfiles (profiles);
}
public static ProfileInfoCollection FindInactiveProfilesByUserName (ProfileAuthenticationOption authenticationOption,
string usernameToMatch, DateTime userInactiveSinceDate)
{
int totalRecords = 0;
return Provider.FindInactiveProfilesByUserName (authenticationOption, usernameToMatch, userInactiveSinceDate, 0, int.MaxValue, out totalRecords);
}
public static ProfileInfoCollection FindInactiveProfilesByUserName (ProfileAuthenticationOption authenticationOption,
string usernameToMatch, DateTime userInactiveSinceDate,
int pageIndex, int pageSize, out int totalRecords)
{
return Provider.FindInactiveProfilesByUserName (authenticationOption, usernameToMatch, userInactiveSinceDate, pageIndex, pageSize, out totalRecords);
}
public static ProfileInfoCollection FindProfilesByUserName (ProfileAuthenticationOption authenticationOption, string usernameToMatch)
{
int totalRecords = 0;
return Provider.FindProfilesByUserName (authenticationOption, usernameToMatch, 0, int.MaxValue, out totalRecords);
}
public static ProfileInfoCollection FindProfilesByUserName (ProfileAuthenticationOption authenticationOption, string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
{
return Provider.FindProfilesByUserName (authenticationOption, usernameToMatch, pageIndex, pageSize, out totalRecords);
}
public static ProfileInfoCollection GetAllInactiveProfiles (ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
{
int totalRecords = 0;
return Provider.GetAllInactiveProfiles (authenticationOption, userInactiveSinceDate, 0, int.MaxValue, out totalRecords);
}
public static ProfileInfoCollection GetAllInactiveProfiles (ProfileAuthenticationOption authenticationOption,
DateTime userInactiveSinceDate, int pageIndex, int pageSize,
out int totalRecords)
{
return Provider.GetAllInactiveProfiles (authenticationOption, userInactiveSinceDate, pageIndex, pageSize, out totalRecords);
}
public static ProfileInfoCollection GetAllProfiles (ProfileAuthenticationOption authenticationOption)
{
int totalRecords = 0;
return Provider.GetAllProfiles (authenticationOption, 0, int.MaxValue, out totalRecords);
}
public static ProfileInfoCollection GetAllProfiles (ProfileAuthenticationOption authenticationOption, int pageIndex, int pageSize, out int totalRecords)
{
return Provider.GetAllProfiles (authenticationOption, pageIndex, pageSize, out totalRecords);
}
public static int GetNumberOfInactiveProfiles (ProfileAuthenticationOption authenticationOption, DateTime userInactiveSinceDate)
{
return Provider.GetNumberOfInactiveProfiles (authenticationOption, userInactiveSinceDate);
}
public static int GetNumberOfProfiles (ProfileAuthenticationOption authenticationOption)
{
int totalRecords = 0;
Provider.GetAllProfiles (authenticationOption, 0, 1, out totalRecords);
return totalRecords;
}
public static string ApplicationName {
get {
return Provider.ApplicationName;
}
set {
Provider.ApplicationName = value;
}
}
public static bool AutomaticSaveEnabled {
get {
return config.AutomaticSaveEnabled;
}
}
public static bool Enabled {
get {
return config.Enabled;
}
}
[MonoTODO ("check AspNetHostingPermissionLevel")]
public static ProfileProvider Provider {
get {
ProfileProvider p = Providers [config.DefaultProvider];
if (p == null)
throw new ConfigurationErrorsException ("Provider '" + config.DefaultProvider + "' was not found");
return p;
}
}
public static ProfileProviderCollection Providers {
get {
CheckEnabled ();
if (providersCollection == null) {
ProfileProviderCollection providersCollectionTmp = new ProfileProviderCollection ();
ProvidersHelper.InstantiateProviders (config.Providers, providersCollectionTmp, typeof (ProfileProvider));
providersCollection = providersCollectionTmp;
}
return providersCollection;
}
}
static void CheckEnabled ()
{
if (!Enabled)
throw new Exception ("This feature is not enabled. To enable it, add <profile enabled=\"true\"> to your configuration file.");
}
}
}
#endif

View File

@@ -0,0 +1,60 @@
//
// System.Web.UI.WebControls.ProfileMigrateEventArgs.cs
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
using System.Web;
namespace System.Web.Profile
{
public sealed class ProfileMigrateEventArgs : System.EventArgs
{
public ProfileMigrateEventArgs (HttpContext context, string anonymousId)
{
this.context = context;
this.anonymousId = anonymousId;
}
public string AnonymousID {
get {
return anonymousId;
}
}
public HttpContext Context {
get {
return context;
}
}
HttpContext context;
string anonymousId;
}
}
#endif

View File

@@ -0,0 +1,38 @@
//
// System.Web.UI.WebControls.ProfileMigrateEventHandler.cs
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
using System.Configuration;
namespace System.Web.Profile
{
public delegate void ProfileMigrateEventHandler (object sender, ProfileMigrateEventArgs e);
}
#endif

View File

@@ -0,0 +1,141 @@
//
// System.Web.UI.WebControls.ProfileModule.cs
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
using System.ComponentModel;
using System.Web;
using System.Web.Configuration;
using System.Text;
namespace System.Web.Profile
{
public sealed class ProfileModule : IHttpModule
{
static readonly object migrateAnonymousEvent = new object ();
static readonly object personalizeEvent = new object ();
static readonly object profileAutoSavingEvent = new object ();
HttpApplication app;
ProfileBase profile;
string anonymousCookieName = null;
EventHandlerList events = new EventHandlerList ();
public event ProfileMigrateEventHandler MigrateAnonymous {
add { events.AddHandler (migrateAnonymousEvent, value); }
remove { events.RemoveHandler (migrateAnonymousEvent, value); }
}
[MonoTODO ("implement event rising")]
public event ProfileEventHandler Personalize {
add { events.AddHandler (personalizeEvent, value); }
remove { events.RemoveHandler (personalizeEvent, value); }
}
public event ProfileAutoSaveEventHandler ProfileAutoSaving {
add { events.AddHandler (profileAutoSavingEvent, value); }
remove { events.RemoveHandler (profileAutoSavingEvent, value); }
}
public ProfileModule ()
{
}
public void Dispose ()
{
app.EndRequest -= OnLeave;
app.PostMapRequestHandler -= OnEnter;
}
public void Init (HttpApplication app)
{
this.app = app;
app.PostMapRequestHandler += OnEnter;
app.EndRequest += OnLeave;
AnonymousIdentificationSection anonymousConfig =
(AnonymousIdentificationSection) WebConfigurationManager.GetSection ("system.web/anonymousIdentification");
if (anonymousConfig == null)
return;
anonymousCookieName = anonymousConfig.CookieName;
}
void OnEnter (object o, EventArgs eventArgs)
{
if (!ProfileManager.Enabled)
return;
if (HttpContext.Current.Request.IsAuthenticated) {
HttpCookie cookie = app.Request.Cookies [anonymousCookieName];
if (cookie != null && (cookie.Expires != DateTime.MinValue && cookie.Expires > DateTime.Now)) {
ProfileMigrateEventHandler eh = events [migrateAnonymousEvent] as ProfileMigrateEventHandler;
if (eh != null) {
ProfileMigrateEventArgs e = new ProfileMigrateEventArgs (HttpContext.Current,
Encoding.Unicode.GetString (Convert.FromBase64String (cookie.Value)));
eh (this, e);
}
HttpCookie newCookie = new HttpCookie (anonymousCookieName);
newCookie.Path = app.Request.ApplicationPath;
newCookie.Expires = new DateTime (1970, 1, 1);
newCookie.Value = "";
app.Response.AppendCookie (newCookie);
}
}
}
void OnLeave (object o, EventArgs eventArgs)
{
if (!ProfileManager.Enabled)
return;
if (!app.Context.ProfileInitialized)
return;
if (ProfileManager.AutomaticSaveEnabled) {
profile = app.Context.Profile;
if (profile == null)
return;
ProfileAutoSaveEventHandler eh = events [profileAutoSavingEvent] as ProfileAutoSaveEventHandler;
if (eh != null) {
ProfileAutoSaveEventArgs args = new ProfileAutoSaveEventArgs (app.Context);
eh (this, args);
if (!args.ContinueWithProfileAutoSave)
return;
}
profile.Save ();
}
}
}
}
#endif

View File

@@ -0,0 +1,77 @@
//
// System.Web.UI.ProfileParser
//
// Authors:
// Vladimir Krasnov (vladimirk@mainsoft.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
using System.Collections;
using System.IO;
using System.Web;
using System.Web.Compilation;
using System.Web.Util;
namespace System.Web.Profile
{
internal sealed class ProfileParser
{
internal ProfileParser (HttpContext context)
{
}
public static Type GetProfileCommonType (HttpContext context)
{
string typeName;
if (AppCodeCompiler.DefaultAppCodeAssemblyName != null)
typeName = String.Concat ("ProfileCommon, ", AppCodeCompiler.DefaultAppCodeAssemblyName);
else
typeName = "ProfileCommon";
Type profileBaseType = Type.GetType (typeName);
if (profileBaseType == null) {
//Compiler call
}
return profileBaseType;
}
public static Type GetProfileGroupType (HttpContext context, string groupName)
{
string typeName;
if (AppCodeCompiler.DefaultAppCodeAssemblyName != null)
typeName = String.Concat ("ProfileGroup", groupName, ", ", AppCodeCompiler.DefaultAppCodeAssemblyName);
else
typeName = String.Concat ("ProfileGroup", groupName);
Type profileGroupType = Type.GetType (typeName);
if (profileGroupType == null) {
//Compiler call
}
return profileGroupType;
}
}
}
#endif

View File

@@ -0,0 +1,62 @@
//
// System.Web.Profile.ProfileProvider.cs
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
using System.Configuration;
namespace System.Web.Profile
{
public abstract class ProfileProvider : SettingsProvider
{
protected ProfileProvider () { }
public abstract int DeleteInactiveProfiles (ProfileAuthenticationOption authenticationOption,
DateTime userInactiveSinceDate);
public abstract int DeleteProfiles (string[ ] usernames);
public abstract int DeleteProfiles (ProfileInfoCollection profiles);
public abstract ProfileInfoCollection FindInactiveProfilesByUserName (ProfileAuthenticationOption authenticationOption,
string usernameToMatch,
DateTime userInactiveSinceDate,
int pageIndex, int pageSize, out int totalRecords);
public abstract ProfileInfoCollection FindProfilesByUserName (ProfileAuthenticationOption authenticationOption,
string usernameToMatch,
int pageIndex, int pageSize, out int totalRecords);
public abstract ProfileInfoCollection GetAllInactiveProfiles (ProfileAuthenticationOption authenticationOption,
DateTime userInactiveSinceDate,
int pageIndex, int pageSize, out int totalRecords);
public abstract ProfileInfoCollection GetAllProfiles (ProfileAuthenticationOption authenticationOption,
int pageIndex, int pageSize, out int totalRecords);
public abstract int GetNumberOfInactiveProfiles (ProfileAuthenticationOption authenticationOption,
DateTime userInactiveSinceDate);
}
}
#endif

View File

@@ -0,0 +1,52 @@
//
// System.Web.Profile.ProfileProviderAttribute.cs
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
namespace System.Web.Profile
{
[AttributeUsage (AttributeTargets.Property)]
public sealed class ProfileProviderAttribute : Attribute
{
public ProfileProviderAttribute (string providerName)
{
this.providerName = providerName;
}
public string ProviderName {
get {
return providerName;
}
}
string providerName;
}
}
#endif

View File

@@ -0,0 +1,57 @@
//
// System.Web.UI.WebControls.ProfileProviderCollection.cs
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using System;
using System.Configuration;
using System.Configuration.Provider;
namespace System.Web.Profile
{
public sealed class ProfileProviderCollection : SettingsProviderCollection
{
public ProfileProviderCollection ()
{
}
public override void Add (ProviderBase provider)
{
base.Add (provider);
}
public new ProfileProvider this[string name] {
get {
return (ProfileProvider) base [name];
}
}
}
}
#endif

Some files were not shown because too many files have changed in this diff Show More