Added change user principalName

Added button to change user password
Changes EmailAddresses, user principal name disabled
This commit is contained in:
robvde 2012-11-24 11:39:42 +04:00
parent 8a4159a0ff
commit 4c75df5a73
21 changed files with 850 additions and 153 deletions

View file

@ -6964,3 +6964,24 @@ BEGIN
INSERT [dbo].[Quotas] ([QuotaID], [GroupID], [QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID]) VALUES (230, 13, 4, N'HostedSolution.AllowChangeUPN', N'Allow to Change UserPrincipalName', 1, 0, NULL) INSERT [dbo].[Quotas] ([QuotaID], [GroupID], [QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID]) VALUES (230, 13, 4, N'HostedSolution.AllowChangeUPN', N'Allow to Change UserPrincipalName', 1, 0, NULL)
END END
GO GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE type_desc = N'SQL_STORED_PROCEDURE' AND name = N'UpdateExchangeAccountUserPrincipalName')
BEGIN
EXEC sp_executesql N' CREATE PROCEDURE [dbo].[UpdateExchangeAccountUserPrincipalName]
(
@AccountID int,
@UserPrincipalName nvarchar(300)
)
AS
UPDATE ExchangeAccounts SET
UserPrincipalName = @UserPrincipalName
WHERE
AccountID = @AccountID
RETURN'
END
GO

View file

@ -36,6 +36,7 @@ namespace WebsitePanel.EnterpriseServer
{ {
string emailAddress; string emailAddress;
bool isPrimary; bool isPrimary;
bool iSuserPrincipalName;
public string EmailAddress public string EmailAddress
{ {
@ -48,5 +49,12 @@ namespace WebsitePanel.EnterpriseServer
get { return this.isPrimary; } get { return this.isPrimary; }
set { this.isPrimary = value; } set { this.isPrimary = value; }
} }
public bool IsUserPrincipalName
{
get { return iSuserPrincipalName; }
set { iSuserPrincipalName = value; }
}
} }
} }

View file

@ -29,7 +29,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:2.0.50727.6387 // Runtime Version:2.0.50727.6400
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
@ -54,7 +54,6 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
using WebsitePanel.Providers.ResultObjects; using WebsitePanel.Providers.ResultObjects;
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()]
@ -104,6 +103,10 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
private System.Threading.SendOrPostCallback SetUserGeneralSettingsOperationCompleted; private System.Threading.SendOrPostCallback SetUserGeneralSettingsOperationCompleted;
private System.Threading.SendOrPostCallback SetUserPrincipalNameOperationCompleted;
private System.Threading.SendOrPostCallback SetUserPasswordOperationCompleted;
private System.Threading.SendOrPostCallback SearchAccountsOperationCompleted; private System.Threading.SendOrPostCallback SearchAccountsOperationCompleted;
private System.Threading.SendOrPostCallback DeleteUserOperationCompleted; private System.Threading.SendOrPostCallback DeleteUserOperationCompleted;
@ -175,6 +178,12 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
/// <remarks/> /// <remarks/>
public event SetUserGeneralSettingsCompletedEventHandler SetUserGeneralSettingsCompleted; public event SetUserGeneralSettingsCompletedEventHandler SetUserGeneralSettingsCompleted;
/// <remarks/>
public event SetUserPrincipalNameCompletedEventHandler SetUserPrincipalNameCompleted;
/// <remarks/>
public event SetUserPasswordCompletedEventHandler SetUserPasswordCompleted;
/// <remarks/> /// <remarks/>
public event SearchAccountsCompletedEventHandler SearchAccountsCompleted; public event SearchAccountsCompletedEventHandler SearchAccountsCompleted;
@ -1336,6 +1345,103 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
} }
} }
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/SetUserPrincipalName", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int SetUserPrincipalName(int itemId, int accountId, string userPrincipalName, bool inherit) {
object[] results = this.Invoke("SetUserPrincipalName", new object[] {
itemId,
accountId,
userPrincipalName,
inherit});
return ((int)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginSetUserPrincipalName(int itemId, int accountId, string userPrincipalName, bool inherit, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("SetUserPrincipalName", new object[] {
itemId,
accountId,
userPrincipalName,
inherit}, callback, asyncState);
}
/// <remarks/>
public int EndSetUserPrincipalName(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
}
/// <remarks/>
public void SetUserPrincipalNameAsync(int itemId, int accountId, string userPrincipalName, bool inherit) {
this.SetUserPrincipalNameAsync(itemId, accountId, userPrincipalName, inherit, null);
}
/// <remarks/>
public void SetUserPrincipalNameAsync(int itemId, int accountId, string userPrincipalName, bool inherit, object userState) {
if ((this.SetUserPrincipalNameOperationCompleted == null)) {
this.SetUserPrincipalNameOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetUserPrincipalNameOperationCompleted);
}
this.InvokeAsync("SetUserPrincipalName", new object[] {
itemId,
accountId,
userPrincipalName,
inherit}, this.SetUserPrincipalNameOperationCompleted, userState);
}
private void OnSetUserPrincipalNameOperationCompleted(object arg) {
if ((this.SetUserPrincipalNameCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.SetUserPrincipalNameCompleted(this, new SetUserPrincipalNameCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/SetUserPassword", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int SetUserPassword(int itemId, int accountId, string password) {
object[] results = this.Invoke("SetUserPassword", new object[] {
itemId,
accountId,
password});
return ((int)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginSetUserPassword(int itemId, int accountId, string password, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("SetUserPassword", new object[] {
itemId,
accountId,
password}, callback, asyncState);
}
/// <remarks/>
public int EndSetUserPassword(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
}
/// <remarks/>
public void SetUserPasswordAsync(int itemId, int accountId, string password) {
this.SetUserPasswordAsync(itemId, accountId, password, null);
}
/// <remarks/>
public void SetUserPasswordAsync(int itemId, int accountId, string password, object userState) {
if ((this.SetUserPasswordOperationCompleted == null)) {
this.SetUserPasswordOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetUserPasswordOperationCompleted);
}
this.InvokeAsync("SetUserPassword", new object[] {
itemId,
accountId,
password}, this.SetUserPasswordOperationCompleted, userState);
}
private void OnSetUserPasswordOperationCompleted(object arg) {
if ((this.SetUserPasswordCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.SetUserPasswordCompleted(this, new SetUserPasswordCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/> /// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/SearchAccounts", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/SearchAccounts", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public OrganizationUser[] SearchAccounts(int itemId, string filterColumn, string filterValue, string sortColumn, bool includeMailboxes) { public OrganizationUser[] SearchAccounts(int itemId, string filterColumn, string filterValue, string sortColumn, bool includeMailboxes) {
@ -2000,6 +2106,58 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
} }
} }
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void SetUserPrincipalNameCompletedEventHandler(object sender, SetUserPrincipalNameCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class SetUserPrincipalNameCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal SetUserPrincipalNameCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public int Result {
get {
this.RaiseExceptionIfNecessary();
return ((int)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void SetUserPasswordCompletedEventHandler(object sender, SetUserPasswordCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class SetUserPasswordCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
internal SetUserPasswordCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
/// <remarks/>
public int Result {
get {
this.RaiseExceptionIfNecessary();
return ((int)(this.results[0]));
}
}
}
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void SearchAccountsCompletedEventHandler(object sender, SearchAccountsCompletedEventArgs e); public delegate void SearchAccountsCompletedEventHandler(object sender, SearchAccountsCompletedEventArgs e);

View file

@ -2354,6 +2354,16 @@ namespace WebsitePanel.EnterpriseServer
); );
} }
public static void UpdateExchangeAccountUserPrincipalName(int accountId, string userPrincipalName)
{
SqlHelper.ExecuteNonQuery(
ConnectionString,
CommandType.StoredProcedure,
"UpdateExchangeAccountUserPrincipalName",
new SqlParameter("@AccountID", accountId),
new SqlParameter("@UserPrincipalName", userPrincipalName));
}
public static IDataReader GetExchangeAccount(int itemId, int accountId) public static IDataReader GetExchangeAccount(int itemId, int accountId)
{ {
return SqlHelper.ExecuteReader( return SqlHelper.ExecuteReader(

View file

@ -1313,8 +1313,13 @@ namespace WebsitePanel.EnterpriseServer
if (String.Compare(account.PrimaryEmailAddress, email.EmailAddress, true) == 0) if (String.Compare(account.PrimaryEmailAddress, email.EmailAddress, true) == 0)
{ {
email.IsPrimary = true; email.IsPrimary = true;
break;
} }
if (String.Compare(account.UserPrincipalName, email.EmailAddress, true) == 0)
{
email.IsUserPrincipalName = true;
}
} }
return emails.ToArray(); return emails.ToArray();

View file

@ -41,6 +41,7 @@ using WebsitePanel.Providers.ResultObjects;
using WebsitePanel.Providers.SharePoint; using WebsitePanel.Providers.SharePoint;
using WebsitePanel.Providers.Common; using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.DNS; using WebsitePanel.Providers.DNS;
using WebsitePanel.Providers.OCS;
using System.IO; using System.IO;
using System.Xml; using System.Xml;
@ -1670,7 +1671,7 @@ namespace WebsitePanel.EnterpriseServer
if (accountCheck < 0) return accountCheck; if (accountCheck < 0) return accountCheck;
// place log record // place log record
TaskManager.StartTask("EXCHANGE", "UPDATE_MAILBOX_GENERAL"); TaskManager.StartTask("ORGANIZATION", "UPDATE_USER_GENERAL");
TaskManager.ItemId = itemId; TaskManager.ItemId = itemId;
try try
@ -1752,6 +1753,162 @@ namespace WebsitePanel.EnterpriseServer
} }
} }
public static int SetUserPrincipalName(int itemId, int accountId, string userPrincipalName, bool inherit)
{
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
if (accountCheck < 0) return accountCheck;
// place log record
TaskManager.StartTask("ORGANIZATION", "SET_USER_USERPRINCIPALNAME");
TaskManager.ItemId = itemId;
try
{
// load organization
Organization org = GetOrganization(itemId);
if (org == null)
return -1;
// check package
int packageCheck = SecurityContext.CheckPackage(org.PackageId, DemandPackage.IsActive);
if (packageCheck < 0) return packageCheck;
// load account
OrganizationUser user = GetUserGeneralSettings(itemId, accountId);
if (user.UserPrincipalName != userPrincipalName)
{
bool userPrincipalNameOwned = false;
ExchangeEmailAddress[] emails = ExchangeServerController.GetMailboxEmailAddresses(itemId, accountId);
foreach (ExchangeEmailAddress mail in emails)
{
if (mail.EmailAddress == userPrincipalName)
{
userPrincipalNameOwned = true;
break;
}
}
if (!userPrincipalNameOwned)
{
if (EmailAddressExists(userPrincipalName))
return BusinessErrorCodes.ERROR_EXCHANGE_EMAIL_EXISTS;
}
}
Organizations orgProxy = GetOrganizationProxy(org.ServiceId);
orgProxy.SetUserPrincipalName(org.OrganizationId,
user.AccountName,
userPrincipalName.ToLower());
DataProvider.UpdateExchangeAccountUserPrincipalName(accountId, userPrincipalName.ToLower());
if (inherit)
{
if (user.AccountType == ExchangeAccountType.Mailbox)
{
ExchangeServerController.AddMailboxEmailAddress(itemId, accountId, userPrincipalName.ToLower());
ExchangeServerController.SetMailboxPrimaryEmailAddress(itemId, accountId, userPrincipalName.ToLower());
}
else
{
if (user.IsLyncUser)
{
if (!DataProvider.LyncUserExists(accountId, userPrincipalName.ToLower()))
{
LyncController.SetLyncUserGeneralSettings(itemId, accountId, userPrincipalName.ToLower(), null);
}
}
else
{
if (user.IsOCSUser)
{
OCSServer ocs = GetOCSProxy(itemId);
string instanceId = DataProvider.GetOCSUserInstanceID(user.AccountId);
ocs.SetUserPrimaryUri(instanceId, userPrincipalName.ToLower());
}
}
}
}
return 0;
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
}
}
public static int SetUserPassword(int itemId, int accountId, string password)
{
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
if (accountCheck < 0) return accountCheck;
// place log record
TaskManager.StartTask("ORGANIZATION", "SET_USER_PASSWORD");
TaskManager.ItemId = itemId;
try
{
// load organization
Organization org = GetOrganization(itemId);
if (org == null)
return -1;
// check package
int packageCheck = SecurityContext.CheckPackage(org.PackageId, DemandPackage.IsActive);
if (packageCheck < 0) return packageCheck;
// load account
ExchangeAccount account = ExchangeServerController.GetAccount(itemId, accountId);
string accountName = GetAccountName(account.AccountName);
Organizations orgProxy = GetOrganizationProxy(org.ServiceId);
orgProxy.SetUserPassword( org.OrganizationId,
accountName,
password);
//account.
if (!String.IsNullOrEmpty(password))
account.AccountPassword = CryptoUtils.Encrypt(password);
else
account.AccountPassword = null;
UpdateAccount(account);
return 0;
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
}
}
private static void UpdateAccount(ExchangeAccount account) private static void UpdateAccount(ExchangeAccount account)
{ {
DataProvider.UpdateExchangeAccount(account.AccountId, account.AccountName, account.AccountType, account.DisplayName, DataProvider.UpdateExchangeAccount(account.AccountId, account.AccountName, account.AccountType, account.DisplayName,
@ -1969,6 +2126,19 @@ namespace WebsitePanel.EnterpriseServer
} }
return res; return res;
} }
private static OCSServer GetOCSProxy(int itemId)
{
Organization org = OrganizationController.GetOrganization(itemId);
int serviceId = PackageController.GetPackageServiceId(org.PackageId, ResourceGroups.OCS);
OCSServer ocs = new OCSServer();
ServiceProviderProxy.Init(ocs, serviceId);
return ocs;
}
} }
} }

View file

@ -195,6 +195,22 @@ namespace WebsitePanel.EnterpriseServer
} }
[WebMethod]
public int SetUserPrincipalName(int itemId, int accountId, string userPrincipalName, bool inherit)
{
return OrganizationController.SetUserPrincipalName(itemId, accountId, userPrincipalName,
inherit);
}
[WebMethod]
public int SetUserPassword(int itemId, int accountId, string password)
{
return OrganizationController.SetUserPassword(itemId, accountId, password);
}
[WebMethod] [WebMethod]
public List<OrganizationUser> SearchAccounts(int itemId, public List<OrganizationUser> SearchAccounts(int itemId,
string filterColumn, string filterValue, string sortColumn, bool includeMailboxes) string filterColumn, string filterValue, string sortColumn, bool includeMailboxes)

View file

@ -58,5 +58,7 @@ namespace WebsitePanel.Providers.HostedSolution
get { return primary; } get { return primary; }
set { primary = value; } set { primary = value; }
} }
} }
} }

View file

@ -51,6 +51,10 @@ namespace WebsitePanel.Providers.HostedSolution
string businessPhone, string fax, string homePhone, string mobilePhone, string pager, string businessPhone, string fax, string homePhone, string mobilePhone, string pager,
string webPage, string notes, string externalEmail); string webPage, string notes, string externalEmail);
void SetUserPassword(string organizationId, string accountName, string password);
void SetUserPrincipalName(string organizationId, string accountName, string userPrincipalName);
bool OrganizationExists(string organizationId); bool OrganizationExists(string organizationId);
void DeleteOrganizationDomain(string organizationDistinguishedName, string domain); void DeleteOrganizationDomain(string organizationDistinguishedName, string domain);

View file

@ -43,13 +43,13 @@ namespace WebsitePanel.Providers.HostedSolution
private string RootOU private string RootOU
{ {
get { return ProviderSettings["RootOU"]; } get { return ProviderSettings["RootOU"]; }
} }
private string RootDomain private string RootDomain
{ {
get { return ServerSettings.ADRootDomain; } get { return ServerSettings.ADRootDomain; }
} }
private string PrimaryDomainController private string PrimaryDomainController
{ {
get { return ProviderSettings["PrimaryDomainController"]; } get { return ProviderSettings["PrimaryDomainController"]; }
@ -68,7 +68,7 @@ namespace WebsitePanel.Providers.HostedSolution
AppendProtocol(sb); AppendProtocol(sb);
AppendDomainController(sb); AppendDomainController(sb);
AppendOUPath(sb, organizationId); AppendOUPath(sb, organizationId);
AppendOUPath(sb, RootOU); AppendOUPath(sb, RootOU);
AppendDomainPath(sb, RootDomain); AppendDomainPath(sb, RootDomain);
return sb.ToString(); return sb.ToString();
@ -118,20 +118,20 @@ namespace WebsitePanel.Providers.HostedSolution
{ {
sb.Append(PrimaryDomainController + "/"); sb.Append(PrimaryDomainController + "/");
} }
private static void AppendCNPath(StringBuilder sb, string organizationId) private static void AppendCNPath(StringBuilder sb, string organizationId)
{ {
if (string.IsNullOrEmpty(organizationId)) if (string.IsNullOrEmpty(organizationId))
return; return;
sb.Append("CN=").Append(organizationId).Append(","); sb.Append("CN=").Append(organizationId).Append(",");
} }
private static void AppendProtocol(StringBuilder sb) private static void AppendProtocol(StringBuilder sb)
{ {
sb.Append("LDAP://"); sb.Append("LDAP://");
} }
private static void AppendOUPath(StringBuilder sb, string ou) private static void AppendOUPath(StringBuilder sb, string ou)
{ {
if (string.IsNullOrEmpty(ou)) if (string.IsNullOrEmpty(ou))
@ -168,29 +168,29 @@ namespace WebsitePanel.Providers.HostedSolution
{ {
return OrganizationExistsInternal(organizationId); return OrganizationExistsInternal(organizationId);
} }
internal bool OrganizationExistsInternal(string organizationId) internal bool OrganizationExistsInternal(string organizationId)
{ {
if (string.IsNullOrEmpty(organizationId)) if (string.IsNullOrEmpty(organizationId))
throw new ArgumentNullException("organizationId"); throw new ArgumentNullException("organizationId");
string orgPath = GetOrganizationPath(organizationId); string orgPath = GetOrganizationPath(organizationId);
return ActiveDirectoryUtils.AdObjectExists(orgPath); return ActiveDirectoryUtils.AdObjectExists(orgPath);
} }
public Organization CreateOrganization(string organizationId) public Organization CreateOrganization(string organizationId)
{ {
return CreateOrganizationInternal(organizationId); return CreateOrganizationInternal(organizationId);
} }
internal Organization CreateOrganizationInternal(string organizationId) internal Organization CreateOrganizationInternal(string organizationId)
{ {
HostedSolutionLog.LogStart("CreateOrganizationInternal"); HostedSolutionLog.LogStart("CreateOrganizationInternal");
HostedSolutionLog.DebugInfo("OrganizationId : {0}", organizationId); HostedSolutionLog.DebugInfo("OrganizationId : {0}", organizationId);
if (string.IsNullOrEmpty(organizationId)) if (string.IsNullOrEmpty(organizationId))
throw new ArgumentNullException("organizationId"); throw new ArgumentNullException("organizationId");
bool ouCreated = false; bool ouCreated = false;
bool groupCreated = false; bool groupCreated = false;
@ -203,18 +203,18 @@ namespace WebsitePanel.Providers.HostedSolution
//Create OU //Create OU
ActiveDirectoryUtils.CreateOrganizationalUnit(organizationId, parentPath); ActiveDirectoryUtils.CreateOrganizationalUnit(organizationId, parentPath);
ouCreated = true; ouCreated = true;
//Create security group //Create security group
ActiveDirectoryUtils.CreateGroup(orgPath, organizationId); ActiveDirectoryUtils.CreateGroup(orgPath, organizationId);
groupCreated = true; groupCreated = true;
org = new Organization(); org = new Organization();
org.OrganizationId = organizationId; org.OrganizationId = organizationId;
org.DistinguishedName = ActiveDirectoryUtils.RemoveADPrefix(orgPath); org.DistinguishedName = ActiveDirectoryUtils.RemoveADPrefix(orgPath);
org.SecurityGroup = ActiveDirectoryUtils.RemoveADPrefix(GetGroupPath(organizationId)); org.SecurityGroup = ActiveDirectoryUtils.RemoveADPrefix(GetGroupPath(organizationId));
} }
catch(Exception ex) catch (Exception ex)
{ {
HostedSolutionLog.LogError(ex); HostedSolutionLog.LogError(ex);
try try
@ -225,7 +225,7 @@ namespace WebsitePanel.Providers.HostedSolution
ActiveDirectoryUtils.DeleteADObject(groupPath); ActiveDirectoryUtils.DeleteADObject(groupPath);
} }
} }
catch(Exception e) catch (Exception e)
{ {
HostedSolutionLog.LogError(e); HostedSolutionLog.LogError(e);
} }
@ -238,21 +238,21 @@ namespace WebsitePanel.Providers.HostedSolution
ActiveDirectoryUtils.DeleteADObject(orgPath); ActiveDirectoryUtils.DeleteADObject(orgPath);
} }
} }
catch(Exception e) catch (Exception e)
{ {
HostedSolutionLog.LogError(e); HostedSolutionLog.LogError(e);
} }
throw; throw;
} }
HostedSolutionLog.LogEnd("CreateOrganizationInternal"); HostedSolutionLog.LogEnd("CreateOrganizationInternal");
return org; return org;
} }
public override void ChangeServiceItemsState(ServiceProviderItem[] items, bool enabled) public override void ChangeServiceItemsState(ServiceProviderItem[] items, bool enabled)
{ {
foreach (ServiceProviderItem item in items) foreach (ServiceProviderItem item in items)
{ {
@ -261,7 +261,7 @@ namespace WebsitePanel.Providers.HostedSolution
if (item is Organization) if (item is Organization)
{ {
Organization org = item as Organization; Organization org = item as Organization;
ChangeOrganizationState(org, enabled); ChangeOrganizationState(org, enabled);
} }
} }
catch (Exception ex) catch (Exception ex)
@ -281,7 +281,7 @@ namespace WebsitePanel.Providers.HostedSolution
string.Format(CultureInfo.InvariantCulture, "(&(objectClass=user)(!{0}=disabled))", string.Format(CultureInfo.InvariantCulture, "(&(objectClass=user)(!{0}=disabled))",
ADAttributes.CustomAttribute2); ADAttributes.CustomAttribute2);
using (DirectorySearcher searcher = new DirectorySearcher(entry, filter)) using (DirectorySearcher searcher = new DirectorySearcher(entry, filter))
{ {
SearchResultCollection resCollection = searcher.FindAll(); SearchResultCollection resCollection = searcher.FindAll();
foreach (SearchResult res in resCollection) foreach (SearchResult res in resCollection)
{ {
@ -303,21 +303,21 @@ namespace WebsitePanel.Providers.HostedSolution
Organization org = item as Organization; Organization org = item as Organization;
DeleteOrganizationInternal(org.OrganizationId); DeleteOrganizationInternal(org.OrganizationId);
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
HostedSolutionLog.LogError(String.Format("Error deleting '{0}' {1}", item.Name, item.GetType().Name), ex); HostedSolutionLog.LogError(String.Format("Error deleting '{0}' {1}", item.Name, item.GetType().Name), ex);
} }
} }
} }
public void DeleteOrganization(string organizationId) public void DeleteOrganization(string organizationId)
{ {
DeleteOrganizationInternal(organizationId); DeleteOrganizationInternal(organizationId);
} }
internal void DeleteOrganizationInternal(string organizationId) internal void DeleteOrganizationInternal(string organizationId)
{ {
HostedSolutionLog.LogStart("DeleteOrganizationInternal"); HostedSolutionLog.LogStart("DeleteOrganizationInternal");
@ -328,11 +328,11 @@ namespace WebsitePanel.Providers.HostedSolution
string groupPath = GetGroupPath(organizationId); string groupPath = GetGroupPath(organizationId);
ActiveDirectoryUtils.DeleteADObject(groupPath); ActiveDirectoryUtils.DeleteADObject(groupPath);
string path = GetOrganizationPath(organizationId); string path = GetOrganizationPath(organizationId);
ActiveDirectoryUtils.DeleteADObject(path, true); ActiveDirectoryUtils.DeleteADObject(path, true);
HostedSolutionLog.LogEnd("DeleteOrganizationInternal"); HostedSolutionLog.LogEnd("DeleteOrganizationInternal");
} }
@ -416,12 +416,12 @@ namespace WebsitePanel.Providers.HostedSolution
{ {
return GetPasswordPolicyInternal(); return GetPasswordPolicyInternal();
} }
internal PasswordPolicyResult GetPasswordPolicyInternal() internal PasswordPolicyResult GetPasswordPolicyInternal()
{ {
HostedSolutionLog.LogStart("GetPasswordPolicyInternal"); HostedSolutionLog.LogStart("GetPasswordPolicyInternal");
PasswordPolicyResult res = new PasswordPolicyResult {IsSuccess = true}; PasswordPolicyResult res = new PasswordPolicyResult { IsSuccess = true };
string[] policyAttributes = new[] {"minPwdLength", string[] policyAttributes = new[] {"minPwdLength",
"pwdProperties", "pwdProperties",
@ -437,30 +437,30 @@ namespace WebsitePanel.Providers.HostedSolution
SearchScope.Base SearchScope.Base
); );
SearchResult result = ds.FindOne(); SearchResult result = ds.FindOne();
PasswordPolicy ret = new PasswordPolicy PasswordPolicy ret = new PasswordPolicy
{ {
MinLength = ((int) result.Properties["minPwdLength"][0]), MinLength = ((int)result.Properties["minPwdLength"][0]),
IsComplexityEnable = ((int) result.Properties["pwdProperties"][0] == 1) IsComplexityEnable = ((int)result.Properties["pwdProperties"][0] == 1)
}; };
res.Value = ret; res.Value = ret;
} }
catch(Exception ex) catch (Exception ex)
{ {
HostedSolutionLog.LogError(ex); HostedSolutionLog.LogError(ex);
res.IsSuccess = false; res.IsSuccess = false;
res.ErrorCodes.Add(ErrorCodes.CANNOT_GET_PASSWORD_COMPLEXITY); res.ErrorCodes.Add(ErrorCodes.CANNOT_GET_PASSWORD_COMPLEXITY);
} }
HostedSolutionLog.LogEnd("GetPasswordPolicyInternal"); HostedSolutionLog.LogEnd("GetPasswordPolicyInternal");
return res; return res;
} }
public void DeleteUser(string loginName, string organizationId) public void DeleteUser(string loginName, string organizationId)
{ {
DeleteUserInternal(loginName, organizationId); DeleteUserInternal(loginName, organizationId);
} }
@ -469,37 +469,37 @@ namespace WebsitePanel.Providers.HostedSolution
HostedSolutionLog.LogStart("DeleteUserInternal"); HostedSolutionLog.LogStart("DeleteUserInternal");
HostedSolutionLog.DebugInfo("loginName : {0}", loginName); HostedSolutionLog.DebugInfo("loginName : {0}", loginName);
HostedSolutionLog.DebugInfo("organizationId : {0}", organizationId); HostedSolutionLog.DebugInfo("organizationId : {0}", organizationId);
if (string.IsNullOrEmpty(loginName)) if (string.IsNullOrEmpty(loginName))
throw new ArgumentNullException("loginName"); throw new ArgumentNullException("loginName");
if (string.IsNullOrEmpty(organizationId)) if (string.IsNullOrEmpty(organizationId))
throw new ArgumentNullException("organizationId"); throw new ArgumentNullException("organizationId");
string path = GetUserPath(organizationId, loginName); string path = GetUserPath(organizationId, loginName);
if (ActiveDirectoryUtils.AdObjectExists(path)) if (ActiveDirectoryUtils.AdObjectExists(path))
ActiveDirectoryUtils.DeleteADObject(path,true); ActiveDirectoryUtils.DeleteADObject(path, true);
HostedSolutionLog.LogEnd("DeleteUserInternal"); HostedSolutionLog.LogEnd("DeleteUserInternal");
} }
public OrganizationUser GetUserGeneralSettings(string loginName, string organizationId) public OrganizationUser GetUserGeneralSettings(string loginName, string organizationId)
{ {
return GetUserGeneralSettingsInternal(loginName, organizationId); return GetUserGeneralSettingsInternal(loginName, organizationId);
} }
internal OrganizationUser GetUserGeneralSettingsInternal(string loginName, string organizationId) internal OrganizationUser GetUserGeneralSettingsInternal(string loginName, string organizationId)
{ {
HostedSolutionLog.LogStart("GetUserGeneralSettingsInternal"); HostedSolutionLog.LogStart("GetUserGeneralSettingsInternal");
HostedSolutionLog.DebugInfo("loginName : {0}", loginName); HostedSolutionLog.DebugInfo("loginName : {0}", loginName);
HostedSolutionLog.DebugInfo("organizationId : {0}", organizationId); HostedSolutionLog.DebugInfo("organizationId : {0}", organizationId);
if (string.IsNullOrEmpty(loginName)) if (string.IsNullOrEmpty(loginName))
throw new ArgumentNullException("loginName"); throw new ArgumentNullException("loginName");
string path = GetUserPath(organizationId, loginName); string path = GetUserPath(organizationId, loginName);
DirectoryEntry entry = ActiveDirectoryUtils.GetADObject(path); DirectoryEntry entry = ActiveDirectoryUtils.GetADObject(path);
OrganizationUser retUser = new OrganizationUser(); OrganizationUser retUser = new OrganizationUser();
retUser.FirstName = ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.FirstName); retUser.FirstName = ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.FirstName);
@ -529,25 +529,25 @@ namespace WebsitePanel.Providers.HostedSolution
retUser.DomainUserName = GetDomainName(ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.SAMAccountName)); retUser.DomainUserName = GetDomainName(ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.SAMAccountName));
retUser.DistinguishedName = ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.DistinguishedName); retUser.DistinguishedName = ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.DistinguishedName);
retUser.Locked = (bool)entry.InvokeGet(ADAttributes.AccountLocked); retUser.Locked = (bool)entry.InvokeGet(ADAttributes.AccountLocked);
retUser.UserPrincipalName = ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.UserPrincipalName); retUser.UserPrincipalName= (string)entry.InvokeGet(ADAttributes.UserPrincipalName);
HostedSolutionLog.LogEnd("GetUserGeneralSettingsInternal"); HostedSolutionLog.LogEnd("GetUserGeneralSettingsInternal");
return retUser; return retUser;
} }
private string GetDomainName(string username) private string GetDomainName(string username)
{ {
string domain = ActiveDirectoryUtils.GetNETBIOSDomainName(RootDomain); string domain = ActiveDirectoryUtils.GetNETBIOSDomainName(RootDomain);
string ret = string.Format(@"{0}\{1}", domain, username); string ret = string.Format(@"{0}\{1}", domain, username);
return ret; return ret;
} }
private OrganizationUser GetManager(DirectoryEntry entry) private OrganizationUser GetManager(DirectoryEntry entry)
{ {
OrganizationUser retUser = null; OrganizationUser retUser = null;
string path = ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.Manager); string path = ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.Manager);
if (!string.IsNullOrEmpty(path)) if (!string.IsNullOrEmpty(path))
{ {
path = ActiveDirectoryUtils.AddADPrefix(path, PrimaryDomainController); path = ActiveDirectoryUtils.AddADPrefix(path, PrimaryDomainController);
if (ActiveDirectoryUtils.AdObjectExists(path)) if (ActiveDirectoryUtils.AdObjectExists(path))
{ {
@ -556,18 +556,18 @@ namespace WebsitePanel.Providers.HostedSolution
retUser.DisplayName = ActiveDirectoryUtils.GetADObjectStringProperty(user, ADAttributes.DisplayName); retUser.DisplayName = ActiveDirectoryUtils.GetADObjectStringProperty(user, ADAttributes.DisplayName);
retUser.AccountName = ActiveDirectoryUtils.GetADObjectStringProperty(user, ADAttributes.Name); retUser.AccountName = ActiveDirectoryUtils.GetADObjectStringProperty(user, ADAttributes.Name);
} }
} }
return retUser; return retUser;
} }
public void SetUserGeneralSettings(string organizationId, string accountName, string displayName, string password, public void SetUserGeneralSettings(string organizationId, string accountName, string displayName, string password,
bool hideFromAddressBook, bool disabled, bool locked, string firstName, string initials, string lastName, bool hideFromAddressBook, bool disabled, bool locked, string firstName, string initials, string lastName,
string address, string city, string state, string zip, string country, string jobTitle, string address, string city, string state, string zip, string country, string jobTitle,
string company, string department, string office, string managerAccountName, string company, string department, string office, string managerAccountName,
string businessPhone, string fax, string homePhone, string mobilePhone, string pager, string businessPhone, string fax, string homePhone, string mobilePhone, string pager,
string webPage, string notes, string externalEmail) string webPage, string notes, string externalEmail)
{ {
SetUserGeneralSettingsInternal(organizationId, accountName, displayName, password, hideFromAddressBook, SetUserGeneralSettingsInternal(organizationId, accountName, displayName, password, hideFromAddressBook,
disabled, locked, firstName, initials, lastName, address, city, state, zip, country, jobTitle, disabled, locked, firstName, initials, lastName, address, city, state, zip, country, jobTitle,
@ -583,10 +583,10 @@ namespace WebsitePanel.Providers.HostedSolution
string webPage, string notes, string externalEmail) string webPage, string notes, string externalEmail)
{ {
string path = GetUserPath(organizationId, accountName); string path = GetUserPath(organizationId, accountName);
DirectoryEntry entry = ActiveDirectoryUtils.GetADObject(path); DirectoryEntry entry = ActiveDirectoryUtils.GetADObject(path);
ActiveDirectoryUtils.SetADObjectProperty(entry, ADAttributes.FirstName, firstName); ActiveDirectoryUtils.SetADObjectProperty(entry, ADAttributes.FirstName, firstName);
ActiveDirectoryUtils.SetADObjectProperty(entry, ADAttributes.LastName, lastName); ActiveDirectoryUtils.SetADObjectProperty(entry, ADAttributes.LastName, lastName);
ActiveDirectoryUtils.SetADObjectProperty(entry, ADAttributes.DisplayName, displayName); ActiveDirectoryUtils.SetADObjectProperty(entry, ADAttributes.DisplayName, displayName);
@ -609,7 +609,7 @@ namespace WebsitePanel.Providers.HostedSolution
ActiveDirectoryUtils.SetADObjectProperty(entry, ADAttributes.Notes, notes); ActiveDirectoryUtils.SetADObjectProperty(entry, ADAttributes.Notes, notes);
ActiveDirectoryUtils.SetADObjectProperty(entry, ADAttributes.ExternalEmail, externalEmail); ActiveDirectoryUtils.SetADObjectProperty(entry, ADAttributes.ExternalEmail, externalEmail);
ActiveDirectoryUtils.SetADObjectProperty(entry, ADAttributes.CustomAttribute2, (disabled ? "disabled" : null)); ActiveDirectoryUtils.SetADObjectProperty(entry, ADAttributes.CustomAttribute2, (disabled ? "disabled" : null));
string manager = string.Empty; string manager = string.Empty;
if (!string.IsNullOrEmpty(managerAccountName)) if (!string.IsNullOrEmpty(managerAccountName))
@ -619,7 +619,7 @@ namespace WebsitePanel.Providers.HostedSolution
} }
ActiveDirectoryUtils.SetADObjectProperty(entry, ADAttributes.Manager, ActiveDirectoryUtils.RemoveADPrefix(manager)); ActiveDirectoryUtils.SetADObjectProperty(entry, ADAttributes.Manager, ActiveDirectoryUtils.RemoveADPrefix(manager));
entry.InvokeSet(ADAttributes.AccountDisabled, disabled); entry.InvokeSet(ADAttributes.AccountDisabled, disabled);
if (!string.IsNullOrEmpty(password)) if (!string.IsNullOrEmpty(password))
entry.Invoke(ADAttributes.SetPassword, password); entry.Invoke(ADAttributes.SetPassword, password);
@ -629,13 +629,44 @@ namespace WebsitePanel.Providers.HostedSolution
bool isLoked = (bool)entry.InvokeGet(ADAttributes.AccountLocked); bool isLoked = (bool)entry.InvokeGet(ADAttributes.AccountLocked);
if (isLoked) if (isLoked)
entry.InvokeSet(ADAttributes.AccountLocked, locked); entry.InvokeSet(ADAttributes.AccountLocked, locked);
} }
entry.CommitChanges(); entry.CommitChanges();
} }
public void SetUserPassword(string organizationId, string accountName, string password)
{
SetUserPasswordInternal(organizationId, accountName, password);
}
internal void SetUserPasswordInternal(string organizationId, string accountName, string password)
{
string path = GetUserPath(organizationId, accountName);
DirectoryEntry entry = ActiveDirectoryUtils.GetADObject(path);
if (!string.IsNullOrEmpty(password))
entry.Invoke(ADAttributes.SetPassword, password);
entry.CommitChanges();
}
public void SetUserPrincipalName(string organizationId, string accountName, string userPrincipalName)
{
SetUserPrincipalNameInternal(organizationId, accountName, userPrincipalName);
}
internal void SetUserPrincipalNameInternal(string organizationId, string accountName, string userPrincipalName)
{
string path = GetUserPath(organizationId, accountName);
DirectoryEntry entry = ActiveDirectoryUtils.GetADObject(path);
ActiveDirectoryUtils.SetADObjectProperty(entry, ADAttributes.UserPrincipalName, userPrincipalName);
entry.CommitChanges();
}
public string GetSamAccountNameByUserPrincipalName(string organizationId, string userPrincipalName) public string GetSamAccountNameByUserPrincipalName(string organizationId, string userPrincipalName)
{ {
@ -679,15 +710,15 @@ namespace WebsitePanel.Providers.HostedSolution
} }
#endregion #endregion
#region Domains #region Domains
public void CreateOrganizationDomain(string organizationDistinguishedName, string domain) public void CreateOrganizationDomain(string organizationDistinguishedName, string domain)
{ {
CreateOrganizationDomainInternal(organizationDistinguishedName, domain); CreateOrganizationDomainInternal(organizationDistinguishedName, domain);
} }
/// <summary> /// <summary>
/// Creates organization domain /// Creates organization domain
/// </summary> /// </summary>
@ -702,7 +733,7 @@ namespace WebsitePanel.Providers.HostedSolution
HostedSolutionLog.LogEnd("CreateOrganizationDomainInternal"); HostedSolutionLog.LogEnd("CreateOrganizationDomainInternal");
} }
public void DeleteOrganizationDomain(string organizationDistinguishedName, string domain) public void DeleteOrganizationDomain(string organizationDistinguishedName, string domain)
{ {
DeleteOrganizationDomainInternal(organizationDistinguishedName, domain); DeleteOrganizationDomainInternal(organizationDistinguishedName, domain);
@ -730,6 +761,6 @@ namespace WebsitePanel.Providers.HostedSolution
return Environment.UserDomainName != Environment.MachineName; return Environment.UserDomainName != Environment.MachineName;
} }
} }
} }

View file

@ -26,10 +26,11 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:2.0.50727.5456 // Runtime Version:2.0.50727.6400
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
@ -37,7 +38,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// //
// This source code was auto-generated by wsdl, Version=2.0.50727.42. // This source code was auto-generated by wsdl, Version=2.0.50727.3038.
// //
namespace WebsitePanel.Providers.HostedSolution { namespace WebsitePanel.Providers.HostedSolution {
using System.Xml.Serialization; using System.Xml.Serialization;
@ -47,12 +48,13 @@ namespace WebsitePanel.Providers.HostedSolution {
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using WebsitePanel.Providers.Common; using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.ResultObjects; using WebsitePanel.Providers.ResultObjects;
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")] [System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="OrganizationsSoap", Namespace="http://tempuri.org/")] [System.Web.Services.WebServiceBindingAttribute(Name="OrganizationsSoap", Namespace="http://tempuri.org/")]
@ -76,6 +78,10 @@ namespace WebsitePanel.Providers.HostedSolution {
private System.Threading.SendOrPostCallback SetUserGeneralSettingsOperationCompleted; private System.Threading.SendOrPostCallback SetUserGeneralSettingsOperationCompleted;
private System.Threading.SendOrPostCallback SetUserPasswordOperationCompleted;
private System.Threading.SendOrPostCallback SetUserPrincipalNameOperationCompleted;
private System.Threading.SendOrPostCallback DeleteOrganizationDomainOperationCompleted; private System.Threading.SendOrPostCallback DeleteOrganizationDomainOperationCompleted;
private System.Threading.SendOrPostCallback CreateOrganizationDomainOperationCompleted; private System.Threading.SendOrPostCallback CreateOrganizationDomainOperationCompleted;
@ -86,7 +92,7 @@ namespace WebsitePanel.Providers.HostedSolution {
/// <remarks/> /// <remarks/>
public Organizations() { public Organizations() {
this.Url = "http://localhost:9006/Organizations.asmx"; this.Url = "http://localhost:9003/Organizations.asmx";
} }
/// <remarks/> /// <remarks/>
@ -110,6 +116,12 @@ namespace WebsitePanel.Providers.HostedSolution {
/// <remarks/> /// <remarks/>
public event SetUserGeneralSettingsCompletedEventHandler SetUserGeneralSettingsCompleted; public event SetUserGeneralSettingsCompletedEventHandler SetUserGeneralSettingsCompleted;
/// <remarks/>
public event SetUserPasswordCompletedEventHandler SetUserPasswordCompleted;
/// <remarks/>
public event SetUserPrincipalNameCompletedEventHandler SetUserPrincipalNameCompleted;
/// <remarks/> /// <remarks/>
public event DeleteOrganizationDomainCompletedEventHandler DeleteOrganizationDomainCompleted; public event DeleteOrganizationDomainCompletedEventHandler DeleteOrganizationDomainCompleted;
@ -627,6 +639,98 @@ namespace WebsitePanel.Providers.HostedSolution {
} }
} }
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/SetUserPassword", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void SetUserPassword(string organizationId, string accountName, string password) {
this.Invoke("SetUserPassword", new object[] {
organizationId,
accountName,
password});
}
/// <remarks/>
public System.IAsyncResult BeginSetUserPassword(string organizationId, string accountName, string password, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("SetUserPassword", new object[] {
organizationId,
accountName,
password}, callback, asyncState);
}
/// <remarks/>
public void EndSetUserPassword(System.IAsyncResult asyncResult) {
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void SetUserPasswordAsync(string organizationId, string accountName, string password) {
this.SetUserPasswordAsync(organizationId, accountName, password, null);
}
/// <remarks/>
public void SetUserPasswordAsync(string organizationId, string accountName, string password, object userState) {
if ((this.SetUserPasswordOperationCompleted == null)) {
this.SetUserPasswordOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetUserPasswordOperationCompleted);
}
this.InvokeAsync("SetUserPassword", new object[] {
organizationId,
accountName,
password}, this.SetUserPasswordOperationCompleted, userState);
}
private void OnSetUserPasswordOperationCompleted(object arg) {
if ((this.SetUserPasswordCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.SetUserPasswordCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/SetUserPrincipalName", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void SetUserPrincipalName(string organizationId, string accountName, string userPrincipalName) {
this.Invoke("SetUserPrincipalName", new object[] {
organizationId,
accountName,
userPrincipalName});
}
/// <remarks/>
public System.IAsyncResult BeginSetUserPrincipalName(string organizationId, string accountName, string userPrincipalName, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("SetUserPrincipalName", new object[] {
organizationId,
accountName,
userPrincipalName}, callback, asyncState);
}
/// <remarks/>
public void EndSetUserPrincipalName(System.IAsyncResult asyncResult) {
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void SetUserPrincipalNameAsync(string organizationId, string accountName, string userPrincipalName) {
this.SetUserPrincipalNameAsync(organizationId, accountName, userPrincipalName, null);
}
/// <remarks/>
public void SetUserPrincipalNameAsync(string organizationId, string accountName, string userPrincipalName, object userState) {
if ((this.SetUserPrincipalNameOperationCompleted == null)) {
this.SetUserPrincipalNameOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetUserPrincipalNameOperationCompleted);
}
this.InvokeAsync("SetUserPrincipalName", new object[] {
organizationId,
accountName,
userPrincipalName}, this.SetUserPrincipalNameOperationCompleted, userState);
}
private void OnSetUserPrincipalNameOperationCompleted(object arg) {
if ((this.SetUserPrincipalNameCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.SetUserPrincipalNameCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/> /// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/DeleteOrganizationDomain", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/DeleteOrganizationDomain", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
@ -804,11 +908,11 @@ namespace WebsitePanel.Providers.HostedSolution {
} }
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void OrganizationExistsCompletedEventHandler(object sender, OrganizationExistsCompletedEventArgs e); public delegate void OrganizationExistsCompletedEventHandler(object sender, OrganizationExistsCompletedEventArgs e);
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")] [System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class OrganizationExistsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { public partial class OrganizationExistsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
@ -830,11 +934,11 @@ namespace WebsitePanel.Providers.HostedSolution {
} }
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void CreateOrganizationCompletedEventHandler(object sender, CreateOrganizationCompletedEventArgs e); public delegate void CreateOrganizationCompletedEventHandler(object sender, CreateOrganizationCompletedEventArgs e);
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")] [System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class CreateOrganizationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { public partial class CreateOrganizationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
@ -856,15 +960,15 @@ namespace WebsitePanel.Providers.HostedSolution {
} }
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void DeleteOrganizationCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); public delegate void DeleteOrganizationCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void CreateUserCompletedEventHandler(object sender, CreateUserCompletedEventArgs e); public delegate void CreateUserCompletedEventHandler(object sender, CreateUserCompletedEventArgs e);
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")] [System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class CreateUserCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { public partial class CreateUserCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
@ -886,15 +990,15 @@ namespace WebsitePanel.Providers.HostedSolution {
} }
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void DeleteUserCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); public delegate void DeleteUserCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetUserGeneralSettingsCompletedEventHandler(object sender, GetUserGeneralSettingsCompletedEventArgs e); public delegate void GetUserGeneralSettingsCompletedEventHandler(object sender, GetUserGeneralSettingsCompletedEventArgs e);
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")] [System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetUserGeneralSettingsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { public partial class GetUserGeneralSettingsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
@ -916,23 +1020,31 @@ namespace WebsitePanel.Providers.HostedSolution {
} }
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void SetUserGeneralSettingsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); public delegate void SetUserGeneralSettingsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void SetUserPasswordCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void SetUserPrincipalNameCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void DeleteOrganizationDomainCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); public delegate void DeleteOrganizationDomainCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void CreateOrganizationDomainCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); public delegate void CreateOrganizationDomainCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetPasswordPolicyCompletedEventHandler(object sender, GetPasswordPolicyCompletedEventArgs e); public delegate void GetPasswordPolicyCompletedEventHandler(object sender, GetPasswordPolicyCompletedEventArgs e);
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")] [System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetPasswordPolicyCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { public partial class GetPasswordPolicyCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
@ -954,11 +1066,11 @@ namespace WebsitePanel.Providers.HostedSolution {
} }
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void GetSamAccountNameByUserPrincipalNameCompletedEventHandler(object sender, GetSamAccountNameByUserPrincipalNameCompletedEventArgs e); public delegate void GetSamAccountNameByUserPrincipalNameCompletedEventHandler(object sender, GetSamAccountNameByUserPrincipalNameCompletedEventArgs e);
/// <remarks/> /// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")] [System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetSamAccountNameByUserPrincipalNameCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { public partial class GetSamAccountNameByUserPrincipalNameCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {

View file

@ -125,6 +125,20 @@ namespace WebsitePanel.Server
} }
[WebMethod, SoapHeader("settings")]
public void SetUserPassword(string organizationId, string accountName, string password)
{
Organization.SetUserPassword(organizationId, accountName, password);
}
[WebMethod, SoapHeader("settings")]
public void SetUserPrincipalName(string organizationId, string accountName, string userPrincipalName)
{
Organization.SetUserPrincipalName(organizationId, accountName, userPrincipalName);
}
[WebMethod, SoapHeader("settings")] [WebMethod, SoapHeader("settings")]
public void DeleteOrganizationDomain(string organizationDistinguishedName, string domain) public void DeleteOrganizationDomain(string organizationDistinguishedName, string domain)
{ {

View file

@ -3083,6 +3083,19 @@
<data name="Success.ORGANIZATION_UPDATE_USER_SETTINGS" xml:space="preserve"> <data name="Success.ORGANIZATION_UPDATE_USER_SETTINGS" xml:space="preserve">
<value>User general settings have been successfully updated.</value> <value>User general settings have been successfully updated.</value>
</data> </data>
<data name="Success.ORGANIZATION_SET_USER_PASSWORD" xml:space="preserve">
<value>User password has been successfully updated.</value>
</data>
<data name="Error.ORGANIZATION_SET_USER_PASSWORD" xml:space="preserve">
<value>Failed to update user password.</value>
</data>
<data name="Success.ORGANIZATION_SET_USER_USERPRINCIPALNAME" xml:space="preserve">
<value>User login name has been successfully updated.</value>
</data>
<data name="Error.ORGANIZATION_SET_USER_USERPRINCIPALNAME" xml:space="preserve">
<value>Failed to update user login name.</value>
</data>
<data name="Success.EXCHANGE_MAILBOX_SET_DEFAULT_EMAIL" xml:space="preserve"> <data name="Success.EXCHANGE_MAILBOX_SET_DEFAULT_EMAIL" xml:space="preserve">
<value>Mailbox primary e-mail address has been changed.</value> <value>Mailbox primary e-mail address has been changed.</value>
</data> </data>

View file

@ -239,4 +239,13 @@
<data name="lblUserPrincipalName" xml:space="preserve"> <data name="lblUserPrincipalName" xml:space="preserve">
<value>Login Name:</value> <value>Login Name:</value>
</data> </data>
<data name="btnSetUserPassword.Text" xml:space="preserve">
<value>Set Password</value>
</data>
<data name="btnSetUserPrincipalName.Text" xml:space="preserve">
<value>Set Login Name</value>
</data>
<data name="chkInherit.Text" xml:space="preserve">
<value>Set login name for services</value>
</data>
</root> </root>

View file

@ -73,7 +73,7 @@
<asp:CheckBox ID="chkSelectAll" runat="server" onclick="javascript:SelectAllCheckboxes(this);" /> <asp:CheckBox ID="chkSelectAll" runat="server" onclick="javascript:SelectAllCheckboxes(this);" />
</HeaderTemplate> </HeaderTemplate>
<ItemTemplate> <ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" Enabled='<%# !(bool)Eval("IsPrimary") %>' /> <asp:CheckBox ID="chkSelect" runat="server" Enabled='<%# !((bool)Eval("IsPrimary") | (bool)Eval("IsUserPrincipalName"))%>' />
</ItemTemplate> </ItemTemplate>
<ItemStyle Width="10px" /> <ItemStyle Width="10px" />
</asp:TemplateField> </asp:TemplateField>
@ -87,7 +87,7 @@
<ItemTemplate> <ItemTemplate>
<div style="text-align:center"> <div style="text-align:center">
&nbsp; &nbsp;
<asp:Image ID="Image1" runat="server" SkinID="Checkbox16" Visible='<%# Eval("IsPrimary") %>' /> <asp:Image ID="Image1" runat="server" SkinID="Checkbox16" Visible='<%# (bool)Eval("IsPrimary")%>' />
</div> </div>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>

View file

@ -182,14 +182,5 @@ namespace WebsitePanel.Portal.ExchangeServer {
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkPmmAllowed; protected global::System.Web.UI.WebControls.CheckBox chkPmmAllowed;
/// <summary>
/// FormComments control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Localize FormComments;
} }
} }

View file

@ -4,7 +4,7 @@
<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> <%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/PasswordControl.ascx" TagName="PasswordControl" TagPrefix="wsp" %> <%@ Register Src="../UserControls/PasswordControl.ascx" TagName="PasswordControl" TagPrefix="wsp" %>
<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../UserControls/CollapsiblePanel.ascx" %> <%@ Register Src="../UserControls/CollapsiblePanel.ascx" TagName="CollapsiblePanel" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> <%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
<%@ Register Src="UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %> <%@ Register Src="UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %>
<%@ Register Src="UserControls/Breadcrumb.ascx" TagName="Breadcrumb" TagPrefix="wsp" %> <%@ Register Src="UserControls/Breadcrumb.ascx" TagName="Breadcrumb" TagPrefix="wsp" %>
@ -47,7 +47,15 @@
<td> <td>
<asp:Label runat="server" ID="lblUserPrincipalName" /> <asp:Label runat="server" ID="lblUserPrincipalName" />
<wsp:EmailAddress id="upn" runat="server" ValidationGroup="CreateMailbox"></wsp:EmailAddress> <wsp:EmailAddress id="upn" runat="server" ValidationGroup="CreateMailbox"></wsp:EmailAddress>
<asp:DropDownList ID="ddlEmailAddresses" runat="server" CssClass="NormalTextBox"></asp:DropDownList>
</td> </td>
<td>
<asp:Button id="btnSetUserPrincipalName" runat="server" Text="Set Login" CssClass="Button1"
meta:resourcekey="btnSetUserPrincipalName" OnClick="btnSetUserPrincipalName_Click"></asp:Button>
</td>
<td>
<asp:CheckBox ID="chkInherit" runat="server" meta:resourcekey="chkInherit" Text="Services inherit Login Name" checked="true"/>
</td>
</tr> </tr>
<tr> <tr>
@ -62,8 +70,13 @@
<tr> <tr>
<td class="FormLabel150" valign="top"><asp:Localize ID="locPassword" runat="server" meta:resourcekey="locPassword" Text="Password:"></asp:Localize></td> <td class="FormLabel150" valign="top"><asp:Localize ID="locPassword" runat="server" meta:resourcekey="locPassword" Text="Password:"></asp:Localize></td>
<td> <td>
<wsp:PasswordControl id="password" runat="server" ValidationGroup="EditMailbox"> <wsp:PasswordControl id="password" runat="server" ValidationGroup="ValidatePassword">
</wsp:PasswordControl> </wsp:PasswordControl>
</td>
<td>
<asp:Button id="btnSetUserPassword" runat="server" Text="Set Password" CssClass="Button1"
meta:resourcekey="btnSetUserPassword" OnClick="btnSetUserPassword_Click" ValidationGroup="ValidatePassword"></asp:Button>
<asp:ValidationSummary ID="ValidationSummary2" runat="server" ShowMessageBox="True" ShowSummary="False" ValidationGroup="ValidatePassword" />
</td> </td>
</tr> </tr>
@ -71,9 +84,6 @@
<tr> <tr>
<td></td> <td></td>
<td> <td>
<asp:CheckBox ID="chkSetPassword" runat="server"
meta:resourcekey="chkSetPassword" Text="Set Password"
oncheckedchanged="chkSetPassword_CheckedChanged" AutoPostBack="True" />
<br /> <br />
<asp:CheckBox ID="chkDisable" runat="server" meta:resourcekey="chkDisable" Text="Disable User" /> <asp:CheckBox ID="chkDisable" runat="server" meta:resourcekey="chkDisable" Text="Disable User" />
<br /> <br />
@ -107,7 +117,7 @@
</table> </table>
<wsp:CollapsiblePanel id="secCompanyInfo" runat="server" <wsp:CollapsiblePanel id="secCompanyInfo" runat="server" IsCollapsed="true"
TargetControlID="CompanyInfo" meta:resourcekey="secCompanyInfo" Text="Company Information"> TargetControlID="CompanyInfo" meta:resourcekey="secCompanyInfo" Text="Company Information">
</wsp:CollapsiblePanel> </wsp:CollapsiblePanel>
<asp:Panel ID="CompanyInfo" runat="server" Height="0" style="overflow:hidden;"> <asp:Panel ID="CompanyInfo" runat="server" Height="0" style="overflow:hidden;">
@ -146,7 +156,7 @@
</asp:Panel> </asp:Panel>
<wsp:CollapsiblePanel id="secContactInfo" runat="server" <wsp:CollapsiblePanel id="secContactInfo" runat="server" IsCollapsed="true"
TargetControlID="ContactInfo" meta:resourcekey="secContactInfo" Text="Contact Information"> TargetControlID="ContactInfo" meta:resourcekey="secContactInfo" Text="Contact Information">
</wsp:CollapsiblePanel> </wsp:CollapsiblePanel>
@ -191,7 +201,7 @@
</table> </table>
</asp:Panel> </asp:Panel>
<wsp:CollapsiblePanel id="secAddressInfo" runat="server" <wsp:CollapsiblePanel id="secAddressInfo" runat="server" IsCollapsed="true"
TargetControlID="AddressInfo" meta:resourcekey="secAddressInfo" Text="Address"> TargetControlID="AddressInfo" meta:resourcekey="secAddressInfo" Text="Address">
</wsp:CollapsiblePanel> </wsp:CollapsiblePanel>
<asp:Panel ID="AddressInfo" runat="server" Height="0" style="overflow:hidden;"> <asp:Panel ID="AddressInfo" runat="server" Height="0" style="overflow:hidden;">
@ -239,7 +249,7 @@
</table> </table>
<wsp:CollapsiblePanel id="secAdvanced" runat="server" <wsp:CollapsiblePanel id="secAdvanced" runat="server" IsCollapsed="true"
TargetControlID="AdvancedInfo" meta:resourcekey="secAdvanced" Text="Advanced"> TargetControlID="AdvancedInfo" meta:resourcekey="secAdvanced" Text="Advanced">
</wsp:CollapsiblePanel> </wsp:CollapsiblePanel>

View file

@ -27,6 +27,7 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System; using System;
using System.Web.UI.WebControls;
using WebsitePanel.EnterpriseServer; using WebsitePanel.EnterpriseServer;
using WebsitePanel.Providers.HostedSolution; using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.Providers.ResultObjects; using WebsitePanel.Providers.ResultObjects;
@ -63,8 +64,6 @@ namespace WebsitePanel.Portal.HostedSolution
} }
} }
password.EditMode = password.ValidationEnabled = false;
// get settings // get settings
OrganizationUser user = ES.Services.Organizations.GetUserGeneralSettings(PanelRequest.ItemID, OrganizationUser user = ES.Services.Organizations.GetUserGeneralSettings(PanelRequest.ItemID,
PanelRequest.AccountID); PanelRequest.AccountID);
@ -127,19 +126,54 @@ namespace WebsitePanel.Portal.HostedSolution
{ {
lblUserPrincipalName.Visible = true; lblUserPrincipalName.Visible = true;
upn.Visible = false; upn.Visible = false;
ddlEmailAddresses.Visible = false;
btnSetUserPrincipalName.Visible = false;
chkInherit.Visible = false;
} }
else else
{ {
lblUserPrincipalName.Visible = false; lblUserPrincipalName.Visible = false;
upn.Visible = true; upn.Visible = false;
if (!string.IsNullOrEmpty(user.UserPrincipalName)) ddlEmailAddresses.Visible = false;
btnSetUserPrincipalName.Visible = true;
chkInherit.Visible = true;
if (user.AccountType == ExchangeAccountType.Mailbox)
{ {
string[] Tmp = user.UserPrincipalName.Split('@'); ddlEmailAddresses.Visible = true;
upn.AccountName = Tmp[0]; WebsitePanel.EnterpriseServer.ExchangeEmailAddress[] emails = ES.Services.ExchangeServer.GetMailboxEmailAddresses(PanelRequest.ItemID, PanelRequest.AccountID);
if (Tmp.Length > 1) foreach (WebsitePanel.EnterpriseServer.ExchangeEmailAddress mail in emails)
{ {
upn.DomainName = Tmp[1]; ListItem li = new ListItem();
li.Text = mail.EmailAddress;
li.Value = mail.EmailAddress;
li.Selected = mail.IsPrimary;
ddlEmailAddresses.Items.Add(li);
}
foreach (ListItem li in ddlEmailAddresses.Items)
{
if (li.Value == user.UserPrincipalName)
{
ddlEmailAddresses.ClearSelection();
li.Selected = true;
break;
}
}
}
else
{
upn.Visible = true;
if (!string.IsNullOrEmpty(user.UserPrincipalName))
{
string[] Tmp = user.UserPrincipalName.Split('@');
upn.AccountName = Tmp[0];
if (Tmp.Length > 1)
{
upn.DomainName = Tmp[1];
}
} }
} }
@ -153,6 +187,8 @@ namespace WebsitePanel.Portal.HostedSolution
chkLocked.Checked = user.Locked; chkLocked.Checked = user.Locked;
password.ValidationEnabled = true;
password.Password = string.Empty;
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -165,17 +201,12 @@ namespace WebsitePanel.Portal.HostedSolution
if (!Page.IsValid) if (!Page.IsValid)
return; return;
string pwd = password.Password;
if (!chkSetPassword.Checked)
pwd = string.Empty;
try try
{ {
int result = ES.Services.Organizations.SetUserGeneralSettings( int result = ES.Services.Organizations.SetUserGeneralSettings(
PanelRequest.ItemID, PanelRequest.AccountID, PanelRequest.ItemID, PanelRequest.AccountID,
txtDisplayName.Text, txtDisplayName.Text,
pwd, string.Empty,
false, false,
chkDisable.Checked, chkDisable.Checked,
chkLocked.Checked, chkLocked.Checked,
@ -230,10 +261,66 @@ namespace WebsitePanel.Portal.HostedSolution
SaveSettings(); SaveSettings();
} }
protected void chkSetPassword_CheckedChanged(object sender, EventArgs e) protected void btnSetUserPrincipalName_Click(object sender, EventArgs e)
{ {
password.EditMode = password.ValidationEnabled = chkSetPassword.Checked; string userPrincipalName = string.Empty;
if (upn.Visible)
userPrincipalName = upn.Email;
else
if (ddlEmailAddresses.Visible)
userPrincipalName = (string)ddlEmailAddresses.SelectedValue;
if (string.IsNullOrEmpty(userPrincipalName)) return;
try
{
int result = ES.Services.Organizations.SetUserPrincipalName(
PanelRequest.ItemID, PanelRequest.AccountID,
userPrincipalName.ToLower(),
chkInherit.Checked);
if (result < 0)
{
messageBox.ShowResultMessage(result);
return;
}
messageBox.ShowSuccessMessage("ORGANIZATION_SET_USER_PRINCIPALNAME");
}
catch (Exception ex)
{
messageBox.ShowErrorMessage("ORGANIZATION_SET_USER_PRINCIPALNAME", ex);
}
}
protected void btnSetUserPassword_Click(object sender, EventArgs e)
{
if (!Page.IsValid)
return;
try
{
int result = ES.Services.Organizations.SetUserPassword(
PanelRequest.ItemID, PanelRequest.AccountID,
password.Password);
if (result < 0)
{
messageBox.ShowResultMessage(result);
return;
}
messageBox.ShowSuccessMessage("ORGANIZATION_SET_USER_PASSWORD");
}
catch (Exception ex)
{
messageBox.ShowErrorMessage("ORGANIZATION_SET_USER_PASSWORD", ex);
}
} }
} }

View file

@ -120,6 +120,33 @@ namespace WebsitePanel.Portal.HostedSolution {
/// </remarks> /// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.EmailAddress upn; protected global::WebsitePanel.Portal.ExchangeServer.UserControls.EmailAddress upn;
/// <summary>
/// ddlEmailAddresses control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.DropDownList ddlEmailAddresses;
/// <summary>
/// btnSetUserPrincipalName control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnSetUserPrincipalName;
/// <summary>
/// chkInherit control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkInherit;
/// <summary> /// <summary>
/// locDisplayName control. /// locDisplayName control.
/// </summary> /// </summary>
@ -166,13 +193,22 @@ namespace WebsitePanel.Portal.HostedSolution {
protected global::WebsitePanel.Portal.PasswordControl password; protected global::WebsitePanel.Portal.PasswordControl password;
/// <summary> /// <summary>
/// chkSetPassword control. /// btnSetUserPassword control.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Auto-generated field. /// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file. /// To modify move field declaration from designer file to code-behind file.
/// </remarks> /// </remarks>
protected global::System.Web.UI.WebControls.CheckBox chkSetPassword; protected global::System.Web.UI.WebControls.Button btnSetUserPassword;
/// <summary>
/// ValidationSummary2 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.ValidationSummary ValidationSummary2;
/// <summary> /// <summary>
/// chkDisable control. /// chkDisable control.

View file

@ -56,8 +56,8 @@ REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\OCSProxy.cs
REM %WSDL% %SERVER_URL%/esOperatingSystems.asmx /out:.\WebsitePanel.EnterpriseServer.Client\OperatingSystemsProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient REM %WSDL% %SERVER_URL%/esOperatingSystems.asmx /out:.\WebsitePanel.EnterpriseServer.Client\OperatingSystemsProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\OperatingSystemsProxy.cs REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\OperatingSystemsProxy.cs
REM %WSDL% %SERVER_URL%/esOrganizations.asmx /out:.\WebsitePanel.EnterpriseServer.Client\OrganizationProxy.cs /namespace:WebsitePanel.EnterpriseServer.HostedSolution /type:webClient %WSDL% %SERVER_URL%/esOrganizations.asmx /out:.\WebsitePanel.EnterpriseServer.Client\OrganizationProxy.cs /namespace:WebsitePanel.EnterpriseServer.HostedSolution /type:webClient
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\OrganizationProxy.cs %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\OrganizationProxy.cs
REM %WSDL% %SERVER_URL%/esPackages.asmx /out:.\WebsitePanel.EnterpriseServer.Client\PackagesProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient REM %WSDL% %SERVER_URL%/esPackages.asmx /out:.\WebsitePanel.EnterpriseServer.Client\PackagesProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\PackagesProxy.cs REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\PackagesProxy.cs
@ -92,8 +92,8 @@ REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\WebServersProxy.cs
REM %WSDL% %SERVER_URL%/esVirtualizationServerForPrivateCloud.asmx /out:.\WebsitePanel.EnterpriseServer.Client\VirtualizationServerProxyForPrivateCloud.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient REM %WSDL% %SERVER_URL%/esVirtualizationServerForPrivateCloud.asmx /out:.\WebsitePanel.EnterpriseServer.Client\VirtualizationServerProxyForPrivateCloud.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\VirtualizationServerProxyForPrivateCloud.cs REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\VirtualizationServerProxyForPrivateCloud.cs
%WSDL% %SERVER_URL%/esLync.asmx /out:.\WebsitePanel.EnterpriseServer.Client\LyncProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient REM %WSDL% %SERVER_URL%/esLync.asmx /out:.\WebsitePanel.EnterpriseServer.Client\LyncProxy.cs /namespace:WebsitePanel.EnterpriseServer /type:webClient
%WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\LyncProxy.cs REM %WSE_CLEAN% .\WebsitePanel.EnterpriseServer.Client\LyncProxy.cs

View file

@ -35,8 +35,8 @@ REM %WSE_CLEAN% .\WebsitePanel.Server.Client\OCSServerProxy.cs
REM %WSDL% %SERVER_URL%/OperatingSystem.asmx /out:.\WebsitePanel.Server.Client\OperatingSystemProxy.cs /namespace:WebsitePanel.Providers.OS /type:webClient /fields REM %WSDL% %SERVER_URL%/OperatingSystem.asmx /out:.\WebsitePanel.Server.Client\OperatingSystemProxy.cs /namespace:WebsitePanel.Providers.OS /type:webClient /fields
REM %WSE_CLEAN% .\WebsitePanel.Server.Client\OperatingSystemProxy.cs REM %WSE_CLEAN% .\WebsitePanel.Server.Client\OperatingSystemProxy.cs
REM %WSDL% %SERVER_URL%/Organizations.asmx /out:.\WebsitePanel.Server.Client\OrganizationProxy.cs /namespace:WebsitePanel.Providers.HostedSolution /type:webClient /fields %WSDL% %SERVER_URL%/Organizations.asmx /out:.\WebsitePanel.Server.Client\OrganizationProxy.cs /namespace:WebsitePanel.Providers.HostedSolution /type:webClient /fields
REM %WSE_CLEAN% .\WebsitePanel.Server.Client\OrganizationProxy.cs %WSE_CLEAN% .\WebsitePanel.Server.Client\OrganizationProxy.cs
REM %WSDL% %SERVER_URL%/ServiceProvider.asmx /out:.\WebsitePanel.Server.Client\ServiceProviderProxy.cs /namespace:WebsitePanel.Providers /type:webClient /fields REM %WSDL% %SERVER_URL%/ServiceProvider.asmx /out:.\WebsitePanel.Server.Client\ServiceProviderProxy.cs /namespace:WebsitePanel.Providers /type:webClient /fields
REM %WSE_CLEAN% .\WebsitePanel.Server.Client\ServiceProviderProxy.cs REM %WSE_CLEAN% .\WebsitePanel.Server.Client\ServiceProviderProxy.cs
@ -56,7 +56,7 @@ REM %WSE_CLEAN% .\WebsitePanel.Server.Client\WebServerProxy.cs
REM %WSDL% %SERVER_URL%/WindowsServer.asmx /out:.\WebsitePanel.Server.Client\WindowsServerProxy.cs /namespace:WebsitePanel.Server /type:webClient /fields REM %WSDL% %SERVER_URL%/WindowsServer.asmx /out:.\WebsitePanel.Server.Client\WindowsServerProxy.cs /namespace:WebsitePanel.Server /type:webClient /fields
REM %WSE_CLEAN% .\WebsitePanel.Server.Client\WindowsServerProxy.cs REM %WSE_CLEAN% .\WebsitePanel.Server.Client\WindowsServerProxy.cs
%WSDL% %SERVER_URL%/LyncServer.asmx /out:.\WebsitePanel.Server.Client\LyncServerProxy.cs /namespace:WebsitePanel.Providers.Lync /type:webClient /fields REM %WSDL% %SERVER_URL%/LyncServer.asmx /out:.\WebsitePanel.Server.Client\LyncServerProxy.cs /namespace:WebsitePanel.Providers.Lync /type:webClient /fields
%WSE_CLEAN% .\WebsitePanel.Server.Client\LyncServerProxy.cs REM %WSE_CLEAN% .\WebsitePanel.Server.Client\LyncServerProxy.cs