Initial project's source code check-in.

This commit is contained in:
ptsurbeleu 2011-07-13 16:07:32 -07:00
commit b03b0b373f
4573 changed files with 981205 additions and 0 deletions

View file

@ -0,0 +1,318 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
namespace WebsitePanel.EnterpriseServer
{
/// <summary>
/// User account.
/// </summary>
[Serializable]
public class UserInfo
{
private int userId;
private int ownerId;
private int roleId;
private int statusId;
private DateTime created;
private DateTime changed;
private bool isPeer;
private bool isDemo;
private string comments;
private string username;
private string password;
private string firstName;
private string lastName;
private string email;
private string secondaryEmail;
private string address;
private string city;
private string country;
private string state;
private string zip;
private string primaryPhone;
private string secondaryPhone;
private string fax;
private string instantMessenger;
private bool htmlMail;
private string companyName;
private bool ecommerceEnabled;
/// <summary>
/// Creates a new instance of UserInfo class.
/// </summary>
public UserInfo()
{
}
/// <summary>
/// User role ID:
/// Administrator = 1,
/// Reseller = 2,
/// User = 3
/// </summary>
public int RoleId
{
get { return roleId; }
set { roleId = value; }
}
/// <summary>
/// User role.
/// </summary>
public UserRole Role
{
get { return (UserRole)roleId; }
set { roleId = (int)value; }
}
/// <summary>
/// User account status:
/// Active = 1,
/// Suspended = 2,
/// Cancelled = 3,
/// Pending = 4
/// </summary>
public int StatusId
{
get { return statusId; }
set { statusId = value; }
}
/// <summary>
/// User account status.
/// </summary>
public UserStatus Status
{
get { return (UserStatus)statusId; }
set { statusId = (int)value; }
}
/// <summary>
/// User account unique identifier.
/// </summary>
public int UserId
{
get { return userId; }
set { userId = value; }
}
public int OwnerId
{
get { return ownerId; }
set { ownerId = value; }
}
public bool IsPeer
{
get { return isPeer; }
set { isPeer = value; }
}
public DateTime Created
{
get { return created; }
set { created = value; }
}
public DateTime Changed
{
get { return changed; }
set { changed = value; }
}
public bool IsDemo
{
get { return isDemo; }
set { isDemo = value; }
}
public string Comments
{
get { return comments; }
set { comments = value; }
}
public string LastName
{
get { return this.lastName; }
set { this.lastName = value; }
}
public string Username
{
get { return this.username; }
set { this.username = value; }
}
public string Password
{
get { return this.password; }
set { this.password = value; }
}
public string FirstName
{
get { return this.firstName; }
set { this.firstName = value; }
}
public string Email
{
get { return this.email; }
set { this.email = value; }
}
public string PrimaryPhone
{
get { return this.primaryPhone; }
set { this.primaryPhone = value; }
}
public string Zip
{
get { return this.zip; }
set { this.zip = value; }
}
public string InstantMessenger
{
get { return this.instantMessenger; }
set { this.instantMessenger = value; }
}
public string Fax
{
get { return this.fax; }
set { this.fax = value; }
}
public string SecondaryPhone
{
get { return this.secondaryPhone; }
set { this.secondaryPhone = value; }
}
public string SecondaryEmail
{
get { return this.secondaryEmail; }
set { this.secondaryEmail = value; }
}
public string Country
{
get { return this.country; }
set { this.country = value; }
}
public string Address
{
get { return this.address; }
set { this.address = value; }
}
public string City
{
get { return this.city; }
set { this.city = value; }
}
public string State
{
get { return this.state; }
set { this.state = value; }
}
public bool HtmlMail
{
get { return this.htmlMail; }
set { this.htmlMail = value; }
}
public string CompanyName
{
get { return this.companyName; }
set { this.companyName = value; }
}
public bool EcommerceEnabled
{
get { return this.ecommerceEnabled; }
set { this.ecommerceEnabled = value; }
}
public string AdditionalParams { get; set; }
public List<UserVlan> Vlans
{
get
{
List<UserVlan> result = new List<UserVlan>();
try
{
if (AdditionalParams != null)
{
XDocument doc = XDocument.Parse(AdditionalParams);
if (doc != null && doc.Root != null)
{
XElement vLansElement = doc.Root.Element("VLans");
if (vLansElement != null)
{
foreach(var item in vLansElement.Elements("VLan"))
result.Add(new UserVlan
{
VLanID = item.Attribute("VLanID") != null ? ushort.Parse(item.Attribute("VLanID").Value) : (ushort) 0,
Comment = item.Attribute("Comment") != null ? item.Attribute("Comment").Value : null
});
}
}
return result;
}
}
catch { }
return result;
}
}
}
/// <summary>
/// User's VLans
/// </summary>
[Serializable]
public class UserVlan
{
public ushort VLanID { get; set; }
public string Comment { get; set; }
}
}

View file

@ -0,0 +1,42 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
namespace WebsitePanel.EnterpriseServer
{
/// <summary>
/// Summary description for AccountRole.
/// </summary>
public enum UserRole
{
Administrator = 1,
Reseller = 2,
User = 3
}
}

View file

@ -0,0 +1,125 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections.Specialized;
using System.Xml.Serialization;
namespace WebsitePanel.EnterpriseServer
{
/// <summary>
/// Summary description for ServiceProviderSettings.
/// </summary>
public class UserSettings
{
public const string ACCOUNT_SUMMARY_LETTER = "AccountSummaryLetter";
public const string PACKAGE_SUMMARY_LETTER = "PackageSummaryLetter";
public const string PASSWORD_REMINDER_LETTER = "PasswordReminderLetter";
public const string EXCHANGE_MAILBOX_SETUP_LETTER = "ExchangeMailboxSetupLetter";
public const string EXCHANGE_HOSTED_EDITION_ORGANIZATION_SUMMARY = "ExchangeHostedEditionOrganizationSummary";
public const string HOSTED_SOLUTION_REPORT = "HostedSoluitonReportSummaryLetter";
public const string ORGANIZATION_USER_SUMMARY_LETTER = "OrganizationUserSummaryLetter";
public const string VPS_SUMMARY_LETTER = "VpsSummaryLetter";
public const string WEB_POLICY = "WebPolicy";
public const string FTP_POLICY = "FtpPolicy";
public const string MAIL_POLICY = "MailPolicy";
public const string MSSQL_POLICY = "MsSqlPolicy";
public const string MYSQL_POLICY = "MySqlPolicy";
public const string SHAREPOINT_POLICY = "SharePointPolicy";
public const string OS_POLICY = "OsPolicy";
public const string EXCHANGE_POLICY = "ExchangePolicy";
public const string EXCHANGE_HOSTED_EDITION_POLICY = "ExchangeHostedEditionPolicy";
public const string WEBSITEPANEL_POLICY = "WebsitePanelPolicy";
public const string VPS_POLICY = "VpsPolicy";
public const string DISPLAY_PREFS = "DisplayPreferences";
public const string GRID_ITEMS = "GridItems";
public int UserId;
public string SettingsName;
private NameValueCollection settingsHash = null;
public string[][] SettingsArray;
[XmlIgnore]
NameValueCollection Settings
{
get
{
if (settingsHash == null)
{
// create new dictionary
settingsHash = new NameValueCollection();
// fill dictionary
if (SettingsArray != null)
{
foreach (string[] pair in SettingsArray)
settingsHash.Add(pair[0], pair[1]);
}
}
return settingsHash;
}
}
[XmlIgnore]
public string this[string settingName]
{
get
{
return Settings[settingName];
}
set
{
// set setting
Settings[settingName] = value;
// rebuild array
SettingsArray = new string[Settings.Count][];
for (int i = 0; i < Settings.Count; i++)
{
SettingsArray[i] = new string[] { Settings.Keys[i], Settings[Settings.Keys[i]] };
}
}
}
public int GetInt(string settingName)
{
return Int32.Parse(Settings[settingName]);
}
public long GetLong(string settingName)
{
return Int64.Parse(Settings[settingName]);
}
public bool GetBool(string settingName)
{
return Boolean.Parse(Settings[settingName]);
}
}
}

View file

@ -0,0 +1,43 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
namespace WebsitePanel.EnterpriseServer
{
/// <summary>
/// Summary description for AccountStatus.
/// </summary>
public enum UserStatus
{
Active = 1,
Suspended = 2,
Cancelled = 3,
Pending = 4
}
}

View file

@ -0,0 +1,100 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections.Generic;
using System.Text;
namespace WebsitePanel.EnterpriseServer
{
public class UsernamePolicy
{
bool enabled = false;
string allowedSymbols = "a-zA-Z0-9\\.\\_";
int minLength = -1;
int maxLength = -1;
string prefix = null;
string suffix = null;
public UsernamePolicy(string policyValue)
{
if (String.IsNullOrEmpty(policyValue))
return;
try
{
// parse settings
string[] parts = policyValue.Split(';');
enabled = Boolean.Parse(parts[0]);
allowedSymbols += parts[1];
minLength = Int32.Parse(parts[2]);
maxLength = Int32.Parse(parts[3]);
prefix = parts[4];
suffix = parts[5];
}
catch { /* skip */ }
}
public bool Enabled
{
get { return this.enabled; }
set { this.enabled = value; }
}
public string AllowedSymbols
{
get { return this.allowedSymbols; }
set { this.allowedSymbols = value; }
}
public int MinLength
{
get { return this.minLength; }
set { this.minLength = value; }
}
public int MaxLength
{
get { return this.maxLength; }
set { this.maxLength = value; }
}
public string Prefix
{
get { return this.prefix; }
set { this.prefix = value; }
}
public string Suffix
{
get { return this.suffix; }
set { this.suffix = value; }
}
}
}