diff --git a/WebsitePanel/Database/install_db.sql b/WebsitePanel/Database/install_db.sql index a9774f04..a97d294f 100644 --- a/WebsitePanel/Database/install_db.sql +++ b/WebsitePanel/Database/install_db.sql @@ -44365,7 +44365,7 @@ Hello #user.FirstName#,

-Please, find below details of your control panel account. +Please, find below details of your control panel account. The one time password was generated for you. You should change the password after login.

Control Panel URL

@@ -44374,7 +44374,7 @@ Please, find below details of your control panel account. Control Panel URL Username - Password + One Time Password @@ -44412,11 +44412,11 @@ INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [Property Hello #user.FirstName#, -Please, find below details of your control panel account. +Please, find below details of your control panel account. The one time password was generated for you. You should change the password after login. Control Panel URL: http://panel.AcmeHosting.com Username: #user.Username# -Password: #user.Password# +One Time Password: #user.Password# If you have any questions regarding your hosting account, feel free to contact our support department at any time. diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 18994090..8ae8e21f 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -9910,6 +9910,9 @@ BEGIN (SELECT TOP 1 @item_type_id, @group_id, 'SharePointSiteCollection', TypeName, 100, CalculateDiskSpace, CalculateBandwidth, Suspendable, Disposable, Searchable, Importable, Backupable FROM [dbo].[ServiceItemTypes] WHERE DisplayName = 'SharePointFoundationSiteCollection') END + + + GO UPDATE [dbo].[Quotas] SET GroupID = 45 WHERE QuotaName = 'EnterpriseStorage.DriveMaps' @@ -10157,8 +10160,6 @@ IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [Settin BEGIN INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'UserPasswordExpirationLetter', N'HtmlBody', @UserPasswordExpirationLetterHtmlBody) END -ELSE -UPDATE [dbo].[UserSettings] SET [PropertyValue] = @UserPasswordExpirationLetterHtmlBody WHERE [UserID] = 1 AND [SettingsName]= N'UserPasswordExpirationLetter' AND [PropertyName]= N'HtmlBody' GO @@ -10174,7 +10175,7 @@ END GO IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [SettingsName]= N'UserPasswordExpirationLetter' AND [PropertyName]= N'LogoUrl' ) BEGIN -INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'UserPasswordExpirationLetter', N'LogoUrl', N'https://controlpanel.virtuworks.net/App_Themes/Default/Images/logo.png') +INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'UserPasswordExpirationLetter', N'LogoUrl', N'') END GO @@ -10201,8 +10202,6 @@ IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [Settin BEGIN INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'UserPasswordExpirationLetter', N'TextBody', @UserPasswordExpirationLetterTextBody) END -ELSE -UPDATE [dbo].[UserSettings] SET [PropertyValue] = @UserPasswordExpirationLetterTextBody WHERE [UserID] = 1 AND [SettingsName]= N'UserPasswordExpirationLetter' AND [PropertyName]= N'TextBody' GO @@ -10270,8 +10269,6 @@ IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [Settin BEGIN INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'UserPasswordResetLetter', N'HtmlBody', @UserPasswordResetLetterHtmlBody) END -ELSE -UPDATE [dbo].[UserSettings] SET [PropertyValue] = @UserPasswordResetLetterHtmlBody WHERE [UserID] = 1 AND [SettingsName]= N'UserPasswordResetLetter' AND [PropertyName]= N'HtmlBody' GO @@ -10287,7 +10284,7 @@ END GO IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [SettingsName]= N'UserPasswordResetLetter' AND [PropertyName]= N'LogoUrl' ) BEGIN -INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'UserPasswordResetLetter', N'LogoUrl', N'https://controlpanel.virtuworks.net/App_Themes/Default/Images/logo.png') +INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'UserPasswordResetLetter', N'LogoUrl', N'') END GO @@ -10314,8 +10311,6 @@ IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [Settin BEGIN INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'UserPasswordResetLetter', N'TextBody', @UserPasswordResetLetterTextBody) END -ELSE -UPDATE [dbo].[UserSettings] SET [PropertyValue] = @UserPasswordResetLetterTextBody WHERE [UserID] = 1 AND [SettingsName]= N'UserPasswordResetLetter' AND [PropertyName]= N'TextBody' GO @@ -10331,8 +10326,6 @@ IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [Settin BEGIN INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'UserPasswordResetLetter', N'PasswordResetLinkSmsBody', @UserPasswordResetSMSBody) END -ELSE -UPDATE [dbo].[UserSettings] SET [PropertyValue] = @UserPasswordResetSMSBody WHERE [UserID] = 1 AND [SettingsName]= N'UserPasswordResetLetter' AND [PropertyName]= N'PasswordResetLinkSmsBody' GO -- USER PASSWORD RESET EMAIL PINCODE TEMPLATE @@ -10396,8 +10389,6 @@ IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [Settin BEGIN INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'UserPasswordResetPincodeLetter', N'HtmlBody', @UserPasswordResetPincodeLetterHtmlBody) END -ELSE -UPDATE [dbo].[UserSettings] SET [PropertyValue] = @UserPasswordResetPincodeLetterHtmlBody WHERE [UserID] = 1 AND [SettingsName]= N'UserPasswordResetPincodeLetter' AND [PropertyName]= N'HtmlBody' GO @@ -10413,7 +10404,7 @@ END GO IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [SettingsName]= N'UserPasswordResetPincodeLetter' AND [PropertyName]= N'LogoUrl' ) BEGIN -INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'UserPasswordResetPincodeLetter', N'LogoUrl', N'https://controlpanel.virtuworks.net/App_Themes/Default/Images/logo.png') +INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'UserPasswordResetPincodeLetter', N'LogoUrl', N'') END GO @@ -10440,8 +10431,6 @@ IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [Settin BEGIN INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'UserPasswordResetPincodeLetter', N'TextBody', @UserPasswordResetPincodeLetterTextBody) END -ELSE -UPDATE [dbo].[UserSettings] SET [PropertyValue] = @UserPasswordResetPincodeLetterTextBody WHERE [UserID] = 1 AND [SettingsName]= N'UserPasswordResetPincodeLetter' AND [PropertyName]= N'TextBody' GO DECLARE @UserPasswordPincodeSMSBody nvarchar(2500) @@ -10454,17 +10443,135 @@ IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [Settin BEGIN INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'UserPasswordResetPincodeLetter', N'PasswordResetPincodeSmsBody', @UserPasswordPincodeSMSBody) END -ELSE -UPDATE [dbo].[UserSettings] SET [PropertyValue] = @UserPasswordPincodeSMSBody WHERE [UserID] = 1 AND [SettingsName]= N'UserPasswordResetPincodeLetter' AND [PropertyName]= N'PasswordResetPincodeSmsBody' GO + +-- USER PASSWORD REQUEST EMAIL TEMPLATE + +IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [SettingsName]= N'OrganizationUserPasswordRequestLetter' AND [PropertyName]= N'From' ) +BEGIN +INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'OrganizationUserPasswordRequestLetter', N'From', N'support@HostingCompany.com') +END +GO + +DECLARE @OrganizationUserPasswordRequestLetterHtmlBody nvarchar(2500) + +Set @OrganizationUserPasswordRequestLetterHtmlBody = N' + + Password request notification + + + +
+
+ +
+

Password request notification

+ + +

+Hello #user.FirstName#, +

+
+ +

+Your account have been created. In order to create a password for your account, please follow next link: +

+ +#passwordResetLink# + +

+If you have any questions regarding your hosting account, feel free to contact our support department at any time. +

+ +

+Best regards +

+
+'; + +IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [SettingsName]= N'OrganizationUserPasswordRequestLetter' AND [PropertyName]= N'HtmlBody' ) +BEGIN +INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'OrganizationUserPasswordRequestLetter', N'HtmlBody', @OrganizationUserPasswordRequestLetterHtmlBody) +END +GO + + +IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [SettingsName]= N'OrganizationUserPasswordRequestLetter' AND [PropertyName]= N'Priority' ) +BEGIN +INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'OrganizationUserPasswordRequestLetter', N'Priority', N'Normal') +END +GO +IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [SettingsName]= N'OrganizationUserPasswordRequestLetter' AND [PropertyName]= N'Subject' ) +BEGIN +INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'OrganizationUserPasswordRequestLetter', N'Subject', N'Password request notification') +END +GO +IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [SettingsName]= N'OrganizationUserPasswordRequestLetter' AND [PropertyName]= N'LogoUrl' ) +BEGIN +INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'OrganizationUserPasswordRequestLetter', N'LogoUrl', N'') +END +GO + + +DECLARE @OrganizationUserPasswordRequestLetterTextBody nvarchar(2500) + +Set @OrganizationUserPasswordRequestLetterTextBody = N'========================================= + Password request notification +========================================= + + +Hello #user.FirstName#, + + +Your account have been created. In order to create a password for your account, please follow next link: + +#passwordResetLink# + +If you have any questions regarding your hosting account, feel free to contact our support department at any time. + +Best regards' + +IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [SettingsName]= N'OrganizationUserPasswordRequestLetter' AND [PropertyName]= N'TextBody' ) +BEGIN +INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'OrganizationUserPasswordRequestLetter', N'TextBody', @OrganizationUserPasswordRequestLetterTextBody) +END +GO + +DECLARE @OrganizationUserPasswordRequestLetterSMSBody nvarchar(2500) + +Set @OrganizationUserPasswordRequestLetterSMSBody = N' +User have been created. Password request url: +#passwordResetLink#' + +IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [SettingsName]= N'OrganizationUserPasswordRequestLetter' AND [PropertyName]= N'SMSBody' ) +BEGIN +INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'OrganizationUserPasswordRequestLetter', N'SMSBody', @OrganizationUserPasswordRequestLetterSMSBody) +END +GO + + + -- Exchange setup EMAIL TEMPLATE IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [SettingsName]= N'ExchangeMailboxSetupLetter' AND [PropertyName]= N'From' ) BEGIN -INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'ExchangeMailboxSetupLetter', N'From', N'orders@virtuworks.com') +INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'ExchangeMailboxSetupLetter', N'From', N'') END GO @@ -10500,7 +10607,7 @@ Set @ExchangeMailboxSetupLetterHtmlBody = N' -VirtuWorks: Run Your Business In The Cloud + @@ -10515,11 +10622,11 @@ Set @ExchangeMailboxSetupLetterHtmlBody = N' -Visit VirtuWorks.com -Account Management -Control Panel -Support -Contact Us + + + + + @@ -10551,7 +10658,7 @@ Set @ExchangeMailboxSetupLetterHtmlBody = N' @@ -10590,15 +10697,15 @@ Set @ExchangeMailboxSetupLetterHtmlBody = N'https://mail.virtuworks.net/owa +

Outlook (Windows Clients)

- To configure Outlook 2013 to work with the VirtuWorks servers, please reference: + To configure Outlook 2013 to work with the servers, please reference:

- http://www.virtuworks.com/how-to-configure-my-outlook-2010-client-to-work-with-my-velum-hosted-exchange-account/ +

If you need to download and install the Outlook client:

@@ -10609,16 +10716,16 @@ Set @ExchangeMailboxSetupLetterHtmlBody = N' Download URL: - Outlook 2013 - 32bit + - Outlook 2013 - 64bit + KEY: - HPN4P-JKC89-VCCWD-24CD2-9P8H7 + @@ -10645,13 +10752,13 @@ Set @ExchangeMailboxSetupLetterHtmlBody = N'Control Panel.

+ Passwords can be changed at any time using Webmail or the Control Panel.

Control Panel

- If you need to change the details of your account, you can easily do this using Control Panel.

+ If you need to change the details of your account, you can easily do this using Control Panel.

Support

- You have 2 options, email help@virtuworks.com or use the web interface at http://www.virtuworks.com/support

+ You have 2 options, email or use the web interface at

@@ -10679,9 +10786,9 @@ Set @ExchangeMailboxSetupLetterHtmlBody = N' -Visit VirtuWorks.com
Learn more about the services VirtuWorks can provide to improve your business. -Privacy Policy
VirtuWorks follows strict guidelines in protecting your privacy. Learn about our Privacy Policy. -Contact Us
Questions? For more information, contact us. +
Learn more about the services can provide to improve your business. +Privacy Policy
follows strict guidelines in protecting your privacy. Learn about our Privacy Policy. +Contact Us
Questions? For more information, contact us. @@ -10720,7 +10827,7 @@ END GO IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [SettingsName]= N'ExchangeMailboxSetupLetter' AND [PropertyName]= N'Subject' ) BEGIN -INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'ExchangeMailboxSetupLetter', N'Subject', N'Virtuworks Hosted Exchange Mailbox Setup') +INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'ExchangeMailboxSetupLetter', N'Subject', N' Hosted Exchange Mailbox Setup') END GO @@ -10730,7 +10837,7 @@ DECLARE @ExchangeMailboxSetupLetterTextBody nvarchar(2500) Set @ExchangeMailboxSetupLetterTextBody = N' Hello #Account.DisplayName#, -Thanks for choosing VirtuWorks as your Exchange hosting provider. +Thanks for choosing as your Exchange hosting provider. User Accounts @@ -10756,22 +10863,21 @@ In order for us to accept mail for your domain, you will need to point your MX r Webmail (OWA, Outlook Web Access) ================================= -https://mail.virtuworks.net/owa + ================================= Outlook (Windows Clients) ================================= -To configure Outlook 2010 to work with VirtuWorks servers, please reference: +To configure Outlook 2010 to work with servers, please reference: + -https://portal.virtuworks.net/whmcs/knowledgebase.php?action=displayarticle&id=2 If you need to download and install the Outlook 2010 client: Outlook 2010 Download URL: -32 Bit - http://www.virtuworks.net/downloads/Outlook2010-32bit.zip -64 Bit - http://www.virtuworks.net/downloads/Outlook2010-64bit.zip -KEY: HXGFV-DY3HM-4W2BQ-3R7KQ-K8P49 + +KEY: ================================= ActiveSync, iPhone, iPad @@ -10786,21 +10892,21 @@ Your username: #SamUsername# Password Changes ================================= -Passwords can be changed at any time using Webmail or the Control Panel (https://controlpanel.virtuworks.net). +Passwords can be changed at any time using Webmail or the Control Panel ================================= Control Panel ================================= -If you need to change the details of your account, you can easily do this using the Control Panel (https://controlpanel.virtuworks.net). +If you need to change the details of your account, you can easily do this using the Control Panel ================================= Support ================================= -You have 2 options, email help@virtuworks.com or use the web interface at http://www.virtuworks.com/contact/' +You have 2 options, email or use the web interface at ' IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [SettingsName]= N'ExchangeMailboxSetupLetter' AND [PropertyName]= N'TextBody' ) BEGIN @@ -12330,4 +12436,144 @@ CLOSE @curSpace DEALLOCATE @curSpace CLOSE @curUsers DEALLOCATE @curUsers -RETURN \ No newline at end of file +RETURN + + +IF EXISTS (SELECT TOP 1 * FROM ServiceItemTypes WHERE DisplayName = 'SharePointEnterpriseSiteCollection') +BEGIN + DECLARE @item_type_id AS INT + SELECT @item_type_id = ItemTypeId FROM ServiceItemTypes WHERE DisplayName = 'SharePointEnterpriseSiteCollection' + UPDATE [dbo].[Quotas] SET ItemTypeID = @item_type_id WHERE QuotaId = 550 +END +GO + +-- OneTimePassword +IF NOT EXISTS(select 1 from sys.columns COLS INNER JOIN sys.objects OBJS ON OBJS.object_id=COLS.object_id and OBJS.type='U' AND OBJS.name='Users' AND COLS.name='OneTimePasswordState') +BEGIN +ALTER TABLE [dbo].[Users] ADD + [OneTimePasswordState] int NULL +END +GO + +IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'SetUserOneTimePassword') +DROP PROCEDURE SetUserOneTimePassword +GO +CREATE PROCEDURE [dbo].[SetUserOneTimePassword] +( + @UserID int, + @Password nvarchar(200), + @OneTimePasswordState int +) +AS +UPDATE Users +SET Password = @Password, OneTimePasswordState = @OneTimePasswordState +WHERE UserID = @UserID +RETURN +GO + +ALTER PROCEDURE [dbo].[GetUserByUsernameInternally] +( + @Username nvarchar(50) +) +AS + SELECT + U.UserID, + U.RoleID, + U.StatusID, + U.SubscriberNumber, + U.LoginStatusId, + U.FailedLogins, + U.OwnerID, + U.Created, + U.Changed, + U.IsDemo, + U.Comments, + U.IsPeer, + U.Username, + U.Password, + U.FirstName, + U.LastName, + U.Email, + U.SecondaryEmail, + U.Address, + U.City, + U.State, + U.Country, + U.Zip, + U.PrimaryPhone, + U.SecondaryPhone, + U.Fax, + U.InstantMessenger, + U.HtmlMail, + U.CompanyName, + U.EcommerceEnabled, + U.[AdditionalParams], + U.OneTimePasswordState + FROM Users AS U + WHERE U.Username = @Username + + RETURN +GO + +ALTER PROCEDURE [dbo].[GetUserByIdInternally] +( + @UserID int +) +AS + SELECT + U.UserID, + U.RoleID, + U.StatusID, + U.SubscriberNumber, + U.LoginStatusId, + U.FailedLogins, + U.OwnerID, + U.Created, + U.Changed, + U.IsDemo, + U.Comments, + U.IsPeer, + U.Username, + U.Password, + U.FirstName, + U.LastName, + U.Email, + U.SecondaryEmail, + U.Address, + U.City, + U.State, + U.Country, + U.Zip, + U.PrimaryPhone, + U.SecondaryPhone, + U.Fax, + U.InstantMessenger, + U.HtmlMail, + U.CompanyName, + U.EcommerceEnabled, + U.[AdditionalParams], + U.OneTimePasswordState + FROM Users AS U + WHERE U.UserID = @UserID + + RETURN +GO + +ALTER PROCEDURE [dbo].[ChangeUserPassword] +( + @ActorID int, + @UserID int, + @Password nvarchar(200) +) +AS + +-- check actor rights +IF dbo.CanUpdateUserDetails(@ActorID, @UserID) = 0 +RETURN + +UPDATE Users +SET Password = @Password, OneTimePasswordState = 0 +WHERE UserID = @UserID + +RETURN +GO \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Common/BusinessErrorCodes.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Common/BusinessErrorCodes.cs index dc4f432d..6b74dda9 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Common/BusinessErrorCodes.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Common/BusinessErrorCodes.cs @@ -67,6 +67,9 @@ namespace WebsitePanel.EnterpriseServer public const int ERROR_USER_ACCOUNT_DISABLED = -114; public const int ERROR_USER_ACCOUNT_LOCKEDOUT = -115; + + public const int ERROR_USER_EXPIRED_ONETIMEPASSWORD = -116; + #endregion #region Packages diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Common/BusinessSuccessCodes.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Common/BusinessSuccessCodes.cs new file mode 100644 index 00000000..b2650f6e --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Common/BusinessSuccessCodes.cs @@ -0,0 +1,43 @@ +// Copyright (c) 2015, 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 BusinessSuccessCodes + { + #region Users + + public const int SUCCESS_USER_ONETIMEPASSWORD = 100; + + #endregion + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Users/OneTimePasswordStates.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Users/OneTimePasswordStates.cs new file mode 100644 index 00000000..bf80149f --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Users/OneTimePasswordStates.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace WebsitePanel.EnterpriseServer +{ + public enum OneTimePasswordStates + { + None = 0, + Active = 1, + Expired = 2, + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Users/UserInfo.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Users/UserInfo.cs index 1850c5bf..c8bd79b8 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Users/UserInfo.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Users/UserInfo.cs @@ -385,68 +385,19 @@ namespace WebsitePanel.EnterpriseServer public class UserInfoInternal : UserInfo { private string password; + private string oneTimePassword; + private OneTimePasswordStates oneTimePasswordState; public string Password { get { return this.password; } set { this.password = value; } } + + public OneTimePasswordStates OneTimePasswordState + { + get { return oneTimePasswordState; } + set { oneTimePasswordState = value; } + } }; -} - - - - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esAuthentication.asmx.cs(51): public int AuthenticateUser(string username, string password, string ip) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esAuthentication.asmx.cs(57): public UserInfo GetUserByUsernamePassword(string username, string password, string ip) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esAuthentication.asmx.cs(63): public int ChangeUserPasswordByUsername(string username, string oldPassword, string newPassword, string ip) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esAuthentication.asmx.cs(69): public int SendPasswordReminder(string username, string ip) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esAuthentication.asmx.cs(81): public int SetupControlPanelAccounts(string passwordA, string passwordB, string ip) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esBlackBerry.asmx.cs(92): public ResultObject SetActivationPasswordWithExpirationTime(int itemId, int accountId, string password, int time) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esExchangeServer.asmx.cs(221): public bool CheckAccountCredentials(int itemId, string email, string password) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esExchangeServer.asmx.cs(231): public int CreateMailbox(int itemId, int accountId, ExchangeAccountType accountType, string accountName, string displayName, - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esExchangeServer.asmx.cs(231): string name, string domain, string password, bool sendSetupInstructions, string setupInstructionMailAddress, int mailboxPlanId, int archivedPlanId, string subscriberNumber, bool EnableArchiving) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esOrganizations.asmx.cs(195): public ResultObject SendResetUserPasswordLinkSms(int itemId, int accountId, string reason, string phoneTo = null) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esOrganizations.asmx.cs(197): return OrganizationController.SendResetUserPasswordLinkSms(itemId, accountId, reason, phoneTo); - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esOrganizations.asmx.cs(202): public ResultObject SendResetUserPasswordPincodeSms(Guid token, string phoneTo = null) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esOrganizations.asmx.cs(204): return OrganizationController.SendResetUserPasswordPincodeSms(token, phoneTo); - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esOrganizations.asmx.cs(259): public int CreateUser(int itemId, string displayName, string name, string domain, string password, string subscriberNumber, bool sendNotification, string to) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esOrganizations.asmx.cs(262): return OrganizationController.CreateUser(itemId, displayName, name, domain, password, subscriberNumber, true, sendNotification, to, out accountName); - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esOrganizations.asmx.cs(266): public int ImportUser(int itemId, string accountName, string displayName, string name, string domain, string password, string subscriberNumber) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esOrganizations.asmx.cs(268): return OrganizationController.ImportUser(itemId, accountName, displayName, name, domain, password, subscriberNumber); - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esOrganizations.asmx.cs(293): string password, bool hideAddressBook, bool disabled, bool locked, string firstName, string initials, - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esOrganizations.asmx.cs(298): bool userMustChangePassword) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esOrganizations.asmx.cs(301): password, hideAddressBook, disabled, locked, firstName, initials, - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esOrganizations.asmx.cs(305): webPage, notes, externalEmail, subscriberNumber, levelId, isVIP, userMustChangePassword); - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esOrganizations.asmx.cs(318): public int SetUserPassword(int itemId, int accountId, string password) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esOrganizations.asmx.cs(320): return OrganizationController.SetUserPassword(itemId, accountId, password); - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esOrganizations.asmx.cs(353): public PasswordPolicyResult GetPasswordPolicy(int itemId) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esOrganizations.asmx.cs(355): return OrganizationController.GetPasswordPolicy(itemId); - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esOrganizations.asmx.cs(359): public void SendResetUserPasswordEmail(int itemId, int accountId, string reason, string mailTo, bool finalStep) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esOrganizations.asmx.cs(361): OrganizationController.SendResetUserPasswordEmail(itemId, accountId, reason, mailTo, finalStep); - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esPackages.asmx.cs(449): public int CreateUserWizard(int parentPackageId, string username, string password, - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esPackages.asmx.cs(456): return UserCreationWizard.CreateUserAccount(parentPackageId, username, password, - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esServers.asmx.cs(108): public int CheckServerAvailable(string serverUrl, string password) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esServers.asmx.cs(110): return ServerController.CheckServerAvailable(serverUrl, password); - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esServers.asmx.cs(126): public int UpdateServerConnectionPassword(int serverId, string password) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esServers.asmx.cs(128): return ServerController.UpdateServerConnectionPassword(serverId, password); - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esServers.asmx.cs(132): public int UpdateServerADPassword(int serverId, string adPassword) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esServers.asmx.cs(134): return ServerController.UpdateServerADPassword(serverId, adPassword); - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esUsers.asmx.cs(152): string password, - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esUsers.asmx.cs(178): user.Password = password; - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esUsers.asmx.cs(272): public int ChangeUserPassword(int userId, string password) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esUsers.asmx.cs(274): return UserController.ChangeUserPassword(userId, password); - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esWebServers.asmx.cs(127): return WebServerController.InstallFrontPage(siteItemId, username, password); - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esWebServers.asmx.cs(137): public int ChangeFrontPagePassword(int siteItemId, string password) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esWebServers.asmx.cs(139): return WebServerController.ChangeFrontPagePassword(siteItemId, password); - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esWebServers.asmx.cs(337): public ResultObject GrantWebDeployPublishingAccess(int siteItemId, string accountName, string accountPassword) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esWebServers.asmx.cs(339): return WebServerController.GrantWebDeployPublishingAccess(siteItemId, accountName, accountPassword); - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esWebServers.asmx.cs(361): public ResultObject ChangeWebDeployPublishingPassword(int siteItemId, string newAccountPassword) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esWebServers.asmx.cs(363): return WebServerController.ChangeWebDeployPublishingPassword(siteItemId, newAccountPassword); - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esWebServers.asmx.cs(536): public ResultObject GrantWebManagementAccess(int siteItemId, string accountName, string accountPassword) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esWebServers.asmx.cs(538): return WebServerController.GrantWebManagementAccess(siteItemId, accountName, accountPassword); - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esWebServers.asmx.cs(548): public ResultObject ChangeWebManagementAccessPassword(int siteItemId, string accountPassword) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esWebServers.asmx.cs(550): return WebServerController.ChangeWebManagementAccessPassword(siteItemId, accountPassword); - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esWebServers.asmx.cs(567): public ResultObject InstallPfx(byte[] certificate, int siteItemId, string password) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esWebServers.asmx.cs(569): return WebServerController.InstallPfx(certificate, siteItemId, password); - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esWebServers.asmx.cs(597): public byte[] ExportCertificate(int siteId, string serialNumber, string password) - //C:\Work\WSPExpert\WebsitePanel\Sources\WebsitePanel.EnterpriseServer\esWebServers.asmx.cs(599): return WebServerController.ExportCertificate(siteId, serialNumber, password); \ No newline at end of file +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Users/UserSettings.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Users/UserSettings.cs index aeaff4d3..c4d011eb 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Users/UserSettings.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Users/UserSettings.cs @@ -67,6 +67,7 @@ namespace WebsitePanel.EnterpriseServer public const string RDS_POLICY = "RdsPolicy"; public const string USER_PASSWORD_EXPIRATION_LETTER = "UserPasswordExpirationLetter"; public const string USER_PASSWORD_RESET_LETTER = "UserPasswordResetLetter"; + public const string USER_PASSWORD_REQUEST_LETTER = "OrganizationUserPasswordRequestLetter"; public const string USER_PASSWORD_RESET_PINCODE_LETTER = "UserPasswordResetPincodeLetter"; public const string HOSTED_ORGANIZATION_PASSWORD_POLICY = "MailboxPasswordPolicy"; diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/WebsitePanel.EnterpriseServer.Base.csproj b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/WebsitePanel.EnterpriseServer.Base.csproj index 3a24cbb4..1e101918 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/WebsitePanel.EnterpriseServer.Base.csproj +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/WebsitePanel.EnterpriseServer.Base.csproj @@ -69,6 +69,7 @@ VersionInfo.cs + Code @@ -165,6 +166,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/OrganizationProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/OrganizationProxy.cs index 3d729acc..33f50dec 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/OrganizationProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/OrganizationProxy.cs @@ -12,7 +12,6 @@ // This source code was auto-generated by wsdl, Version=2.0.50727.3038. // - using WebsitePanel.EnterpriseServer.Base.HostedSolution; using WebsitePanel.Providers; using WebsitePanel.Providers.Common; @@ -37,6 +36,10 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution { [System.Xml.Serialization.XmlIncludeAttribute(typeof(ServiceProviderItem))] public partial class esOrganizations : Microsoft.Web.Services3.WebServicesClientProtocol { + private System.Threading.SendOrPostCallback UpdateSupportServiceLevelOperationCompleted; + + private System.Threading.SendOrPostCallback DeleteSupportServiceLevelOperationCompleted; + private System.Threading.SendOrPostCallback AddSupportServiceLevelOperationCompleted; private System.Threading.SendOrPostCallback GetSupportServiceLevelOperationCompleted; @@ -93,6 +96,10 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution { private System.Threading.SendOrPostCallback SendResetUserPasswordPincodeEmailOperationCompleted; + private System.Threading.SendOrPostCallback SendUserPasswordRequestSmsOperationCompleted; + + private System.Threading.SendOrPostCallback SendUserPasswordRequestEmailOperationCompleted; + private System.Threading.SendOrPostCallback AddOrganizationDomainOperationCompleted; private System.Threading.SendOrPostCallback ChangeOrganizationDomainTypeOperationCompleted; @@ -165,15 +172,17 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution { private System.Threading.SendOrPostCallback GetSupportServiceLevelsOperationCompleted; - private System.Threading.SendOrPostCallback UpdateSupportServiceLevelOperationCompleted; - - private System.Threading.SendOrPostCallback DeleteSupportServiceLevelOperationCompleted; - /// public esOrganizations() { this.Url = "http://localhost:9002/esOrganizations.asmx"; } + /// + public event UpdateSupportServiceLevelCompletedEventHandler UpdateSupportServiceLevelCompleted; + + /// + public event DeleteSupportServiceLevelCompletedEventHandler DeleteSupportServiceLevelCompleted; + /// public event AddSupportServiceLevelCompletedEventHandler AddSupportServiceLevelCompleted; @@ -258,6 +267,12 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution { /// public event SendResetUserPasswordPincodeEmailCompletedEventHandler SendResetUserPasswordPincodeEmailCompleted; + /// + public event SendUserPasswordRequestSmsCompletedEventHandler SendUserPasswordRequestSmsCompleted; + + /// + public event SendUserPasswordRequestEmailCompletedEventHandler SendUserPasswordRequestEmailCompleted; + /// public event AddOrganizationDomainCompletedEventHandler AddOrganizationDomainCompleted; @@ -367,10 +382,90 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution { public event GetSupportServiceLevelsCompletedEventHandler GetSupportServiceLevelsCompleted; /// - public event UpdateSupportServiceLevelCompletedEventHandler UpdateSupportServiceLevelCompleted; + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/UpdateSupportServiceLevel", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public void UpdateSupportServiceLevel(int levelID, string levelName, string levelDescription) { + this.Invoke("UpdateSupportServiceLevel", new object[] { + levelID, + levelName, + levelDescription}); + } /// - public event DeleteSupportServiceLevelCompletedEventHandler DeleteSupportServiceLevelCompleted; + public System.IAsyncResult BeginUpdateSupportServiceLevel(int levelID, string levelName, string levelDescription, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("UpdateSupportServiceLevel", new object[] { + levelID, + levelName, + levelDescription}, callback, asyncState); + } + + /// + public void EndUpdateSupportServiceLevel(System.IAsyncResult asyncResult) { + this.EndInvoke(asyncResult); + } + + /// + public void UpdateSupportServiceLevelAsync(int levelID, string levelName, string levelDescription) { + this.UpdateSupportServiceLevelAsync(levelID, levelName, levelDescription, null); + } + + /// + public void UpdateSupportServiceLevelAsync(int levelID, string levelName, string levelDescription, object userState) { + if ((this.UpdateSupportServiceLevelOperationCompleted == null)) { + this.UpdateSupportServiceLevelOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdateSupportServiceLevelOperationCompleted); + } + this.InvokeAsync("UpdateSupportServiceLevel", new object[] { + levelID, + levelName, + levelDescription}, this.UpdateSupportServiceLevelOperationCompleted, userState); + } + + private void OnUpdateSupportServiceLevelOperationCompleted(object arg) { + if ((this.UpdateSupportServiceLevelCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.UpdateSupportServiceLevelCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/DeleteSupportServiceLevel", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public ResultObject DeleteSupportServiceLevel(int levelId) { + object[] results = this.Invoke("DeleteSupportServiceLevel", new object[] { + levelId}); + return ((ResultObject)(results[0])); + } + + /// + public System.IAsyncResult BeginDeleteSupportServiceLevel(int levelId, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("DeleteSupportServiceLevel", new object[] { + levelId}, callback, asyncState); + } + + /// + public ResultObject EndDeleteSupportServiceLevel(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); + } + + /// + public void DeleteSupportServiceLevelAsync(int levelId) { + this.DeleteSupportServiceLevelAsync(levelId, null); + } + + /// + public void DeleteSupportServiceLevelAsync(int levelId, object userState) { + if ((this.DeleteSupportServiceLevelOperationCompleted == null)) { + this.DeleteSupportServiceLevelOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDeleteSupportServiceLevelOperationCompleted); + } + this.InvokeAsync("DeleteSupportServiceLevel", new object[] { + levelId}, this.DeleteSupportServiceLevelOperationCompleted, userState); + } + + private void OnDeleteSupportServiceLevelOperationCompleted(object arg) { + if ((this.DeleteSupportServiceLevelCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.DeleteSupportServiceLevelCompleted(this, new DeleteSupportServiceLevelCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/AddSupportServiceLevel", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] @@ -1603,6 +1698,107 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution { } } + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/SendUserPasswordRequestSms", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public ResultObject SendUserPasswordRequestSms(int itemId, int accountId, string reason, string phoneTo) { + object[] results = this.Invoke("SendUserPasswordRequestSms", new object[] { + itemId, + accountId, + reason, + phoneTo}); + return ((ResultObject)(results[0])); + } + + /// + public System.IAsyncResult BeginSendUserPasswordRequestSms(int itemId, int accountId, string reason, string phoneTo, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("SendUserPasswordRequestSms", new object[] { + itemId, + accountId, + reason, + phoneTo}, callback, asyncState); + } + + /// + public ResultObject EndSendUserPasswordRequestSms(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); + } + + /// + public void SendUserPasswordRequestSmsAsync(int itemId, int accountId, string reason, string phoneTo) { + this.SendUserPasswordRequestSmsAsync(itemId, accountId, reason, phoneTo, null); + } + + /// + public void SendUserPasswordRequestSmsAsync(int itemId, int accountId, string reason, string phoneTo, object userState) { + if ((this.SendUserPasswordRequestSmsOperationCompleted == null)) { + this.SendUserPasswordRequestSmsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSendUserPasswordRequestSmsOperationCompleted); + } + this.InvokeAsync("SendUserPasswordRequestSms", new object[] { + itemId, + accountId, + reason, + phoneTo}, this.SendUserPasswordRequestSmsOperationCompleted, userState); + } + + private void OnSendUserPasswordRequestSmsOperationCompleted(object arg) { + if ((this.SendUserPasswordRequestSmsCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SendUserPasswordRequestSmsCompleted(this, new SendUserPasswordRequestSmsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/SendUserPasswordRequestEmail", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public void SendUserPasswordRequestEmail(int itemId, int accountId, string reason, string mailTo, bool finalStep) { + this.Invoke("SendUserPasswordRequestEmail", new object[] { + itemId, + accountId, + reason, + mailTo, + finalStep}); + } + + /// + public System.IAsyncResult BeginSendUserPasswordRequestEmail(int itemId, int accountId, string reason, string mailTo, bool finalStep, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("SendUserPasswordRequestEmail", new object[] { + itemId, + accountId, + reason, + mailTo, + finalStep}, callback, asyncState); + } + + /// + public void EndSendUserPasswordRequestEmail(System.IAsyncResult asyncResult) { + this.EndInvoke(asyncResult); + } + + /// + public void SendUserPasswordRequestEmailAsync(int itemId, int accountId, string reason, string mailTo, bool finalStep) { + this.SendUserPasswordRequestEmailAsync(itemId, accountId, reason, mailTo, finalStep, null); + } + + /// + public void SendUserPasswordRequestEmailAsync(int itemId, int accountId, string reason, string mailTo, bool finalStep, object userState) { + if ((this.SendUserPasswordRequestEmailOperationCompleted == null)) { + this.SendUserPasswordRequestEmailOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSendUserPasswordRequestEmailOperationCompleted); + } + this.InvokeAsync("SendUserPasswordRequestEmail", new object[] { + itemId, + accountId, + reason, + mailTo, + finalStep}, this.SendUserPasswordRequestEmailOperationCompleted, userState); + } + + private void OnSendUserPasswordRequestEmailOperationCompleted(object arg) { + if ((this.SendUserPasswordRequestEmailCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.SendUserPasswordRequestEmailCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/AddOrganizationDomain", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public int AddOrganizationDomain(int itemId, string domainName) { @@ -3517,98 +3713,42 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution { } } - /// - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/UpdateSupportServiceLevel", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public void UpdateSupportServiceLevel(int levelID, string levelName, string levelDescription) { - this.Invoke("UpdateSupportServiceLevel", new object[] { - levelID, - levelName, - levelDescription}); - } - - /// - public System.IAsyncResult BeginUpdateSupportServiceLevel(int levelID, string levelName, string levelDescription, System.AsyncCallback callback, object asyncState) { - return this.BeginInvoke("UpdateSupportServiceLevel", new object[] { - levelID, - levelName, - levelDescription}, callback, asyncState); - } - - /// - public void EndUpdateSupportServiceLevel(System.IAsyncResult asyncResult) { - this.EndInvoke(asyncResult); - } - - /// - public void UpdateSupportServiceLevelAsync(int levelID, string levelName, string levelDescription) { - this.UpdateSupportServiceLevelAsync(levelID, levelName, levelDescription, null); - } - - /// - public void UpdateSupportServiceLevelAsync(int levelID, string levelName, string levelDescription, object userState) { - if ((this.UpdateSupportServiceLevelOperationCompleted == null)) { - this.UpdateSupportServiceLevelOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdateSupportServiceLevelOperationCompleted); - } - this.InvokeAsync("UpdateSupportServiceLevel", new object[] { - levelID, - levelName, - levelDescription}, this.UpdateSupportServiceLevelOperationCompleted, userState); - } - - private void OnUpdateSupportServiceLevelOperationCompleted(object arg) { - if ((this.UpdateSupportServiceLevelCompleted != null)) { - System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); - this.UpdateSupportServiceLevelCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); - } - } - - /// - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/DeleteSupportServiceLevel", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public ResultObject DeleteSupportServiceLevel(int levelId) { - object[] results = this.Invoke("DeleteSupportServiceLevel", new object[] { - levelId}); - return ((ResultObject)(results[0])); - } - - /// - public System.IAsyncResult BeginDeleteSupportServiceLevel(int levelId, System.AsyncCallback callback, object asyncState) { - return this.BeginInvoke("DeleteSupportServiceLevel", new object[] { - levelId}, callback, asyncState); - } - - /// - public ResultObject EndDeleteSupportServiceLevel(System.IAsyncResult asyncResult) { - object[] results = this.EndInvoke(asyncResult); - return ((ResultObject)(results[0])); - } - - /// - public void DeleteSupportServiceLevelAsync(int levelId) { - this.DeleteSupportServiceLevelAsync(levelId, null); - } - - /// - public void DeleteSupportServiceLevelAsync(int levelId, object userState) { - if ((this.DeleteSupportServiceLevelOperationCompleted == null)) { - this.DeleteSupportServiceLevelOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDeleteSupportServiceLevelOperationCompleted); - } - this.InvokeAsync("DeleteSupportServiceLevel", new object[] { - levelId}, this.DeleteSupportServiceLevelOperationCompleted, userState); - } - - private void OnDeleteSupportServiceLevelOperationCompleted(object arg) { - if ((this.DeleteSupportServiceLevelCompleted != null)) { - System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); - this.DeleteSupportServiceLevelCompleted(this, new DeleteSupportServiceLevelCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); - } - } - /// public new void CancelAsync(object userState) { base.CancelAsync(userState); } } + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void UpdateSupportServiceLevelCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void DeleteSupportServiceLevelCompletedEventHandler(object sender, DeleteSupportServiceLevelCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class DeleteSupportServiceLevelCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal DeleteSupportServiceLevelCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public ResultObject Result { + get { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void AddSupportServiceLevelCompletedEventHandler(object sender, AddSupportServiceLevelCompletedEventArgs e); @@ -4227,6 +4367,36 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution { } } + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void SendUserPasswordRequestSmsCompletedEventHandler(object sender, SendUserPasswordRequestSmsCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class SendUserPasswordRequestSmsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal SendUserPasswordRequestSmsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public ResultObject Result { + get { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void SendUserPasswordRequestEmailCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void AddOrganizationDomainCompletedEventHandler(object sender, AddOrganizationDomainCompletedEventArgs e); @@ -5096,34 +5266,4 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution { } } } - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] - public delegate void UpdateSupportServiceLevelCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] - public delegate void DeleteSupportServiceLevelCompletedEventHandler(object sender, DeleteSupportServiceLevelCompletedEventArgs e); - - /// - [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] - [System.Diagnostics.DebuggerStepThroughAttribute()] - [System.ComponentModel.DesignerCategoryAttribute("code")] - public partial class DeleteSupportServiceLevelCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { - - private object[] results; - - internal DeleteSupportServiceLevelCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : - base(exception, cancelled, userState) { - this.results = results; - } - - /// - public ResultObject Result { - get { - this.RaiseExceptionIfNecessary(); - return ((ResultObject)(this.results[0])); - } - } - } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs index f15a1b1c..a273af30 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/RemoteDesktopServicesProxy.cs @@ -20,8 +20,8 @@ namespace WebsitePanel.EnterpriseServer { using System.Diagnostics; using WebsitePanel.Providers.RemoteDesktopServices; using WebsitePanel.Providers.Common; - using WebsitePanel.EnterpriseServer.Base.RDS; using WebsitePanel.Providers.HostedSolution; + using WebsitePanel.EnterpriseServer.Base.RDS; /// @@ -139,6 +139,8 @@ namespace WebsitePanel.EnterpriseServer { private System.Threading.SendOrPostCallback ShadowSessionOperationCompleted; + private System.Threading.SendOrPostCallback ImportCollectionOperationCompleted; + /// public esRemoteDesktopServices() { this.Url = "http://localhost:9002/esRemoteDesktopServices.asmx"; @@ -306,6 +308,9 @@ namespace WebsitePanel.EnterpriseServer { /// public event ShadowSessionCompletedEventHandler ShadowSessionCompleted; + /// + public event ImportCollectionCompletedEventHandler ImportCollectionCompleted; + /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetRdsCollection", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public RdsCollection GetRdsCollection(int collectionId) { @@ -2723,6 +2728,50 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/ImportCollection", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public ResultObject ImportCollection(int itemId, string collectionName) { + object[] results = this.Invoke("ImportCollection", new object[] { + itemId, + collectionName}); + return ((ResultObject)(results[0])); + } + + /// + public System.IAsyncResult BeginImportCollection(int itemId, string collectionName, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("ImportCollection", new object[] { + itemId, + collectionName}, callback, asyncState); + } + + /// + public ResultObject EndImportCollection(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((ResultObject)(results[0])); + } + + /// + public void ImportCollectionAsync(int itemId, string collectionName) { + this.ImportCollectionAsync(itemId, collectionName, null); + } + + /// + public void ImportCollectionAsync(int itemId, string collectionName, object userState) { + if ((this.ImportCollectionOperationCompleted == null)) { + this.ImportCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnImportCollectionOperationCompleted); + } + this.InvokeAsync("ImportCollection", new object[] { + itemId, + collectionName}, this.ImportCollectionOperationCompleted, userState); + } + + private void OnImportCollectionOperationCompleted(object arg) { + if ((this.ImportCollectionCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ImportCollectionCompleted(this, new ImportCollectionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// public new void CancelAsync(object userState) { base.CancelAsync(userState); @@ -4132,4 +4181,30 @@ namespace WebsitePanel.EnterpriseServer { } } } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void ImportCollectionCompletedEventHandler(object sender, ImportCollectionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class ImportCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal ImportCollectionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public ResultObject Result { + get { + this.RaiseExceptionIfNecessary(); + return ((ResultObject)(this.results[0])); + } + } + } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/SystemProxy.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/SystemProxy.cs index d96d0a27..9cf076a6 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/SystemProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Client/SystemProxy.cs @@ -31,6 +31,8 @@ namespace WebsitePanel.EnterpriseServer { private System.Threading.SendOrPostCallback GetSystemSettingsActiveOperationCompleted; + private System.Threading.SendOrPostCallback CheckIsTwilioEnabledOperationCompleted; + private System.Threading.SendOrPostCallback SetSystemSettingsOperationCompleted; /// @@ -44,6 +46,9 @@ namespace WebsitePanel.EnterpriseServer { /// public event GetSystemSettingsActiveCompletedEventHandler GetSystemSettingsActiveCompleted; + /// + public event CheckIsTwilioEnabledCompletedEventHandler CheckIsTwilioEnabledCompleted; + /// public event SetSystemSettingsCompletedEventHandler SetSystemSettingsCompleted; @@ -132,6 +137,44 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/CheckIsTwilioEnabled", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public bool CheckIsTwilioEnabled() { + object[] results = this.Invoke("CheckIsTwilioEnabled", new object[0]); + return ((bool)(results[0])); + } + + /// + public System.IAsyncResult BeginCheckIsTwilioEnabled(System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("CheckIsTwilioEnabled", new object[0], callback, asyncState); + } + + /// + public bool EndCheckIsTwilioEnabled(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((bool)(results[0])); + } + + /// + public void CheckIsTwilioEnabledAsync() { + this.CheckIsTwilioEnabledAsync(null); + } + + /// + public void CheckIsTwilioEnabledAsync(object userState) { + if ((this.CheckIsTwilioEnabledOperationCompleted == null)) { + this.CheckIsTwilioEnabledOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCheckIsTwilioEnabledOperationCompleted); + } + this.InvokeAsync("CheckIsTwilioEnabled", new object[0], this.CheckIsTwilioEnabledOperationCompleted, userState); + } + + private void OnCheckIsTwilioEnabledOperationCompleted(object arg) { + if ((this.CheckIsTwilioEnabledCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.CheckIsTwilioEnabledCompleted(this, new CheckIsTwilioEnabledCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/SetSystemSettings", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] public int SetSystemSettings(string settingsName, SystemSettings settings) { @@ -234,6 +277,32 @@ namespace WebsitePanel.EnterpriseServer { } } + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void CheckIsTwilioEnabledCompletedEventHandler(object sender, CheckIsTwilioEnabledCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class CheckIsTwilioEnabledCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal CheckIsTwilioEnabledCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public bool Result { + get { + this.RaiseExceptionIfNecessary(); + return ((bool)(this.results[0])); + } + } + } + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void SetSystemSettingsCompletedEventHandler(object sender, SetSystemSettingsCompletedEventArgs e); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs index 8c42edb9..a5549230 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Data/DataProvider.cs @@ -382,6 +382,15 @@ namespace WebsitePanel.EnterpriseServer new SqlParameter("@password", password)); } + public static void SetUserOneTimePassword(int userId, string password, int auths) + { + SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, + ObjectQualifier + "SetUserOneTimePassword", + new SqlParameter("@UserID", userId), + new SqlParameter("@Password", password), + new SqlParameter("@OneTimePasswordState", auths)); + } + #endregion #region User Settings diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs index 05fbb37b..e33e9be2 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/HostedSolution/OrganizationController.cs @@ -1632,6 +1632,73 @@ namespace WebsitePanel.EnterpriseServer return result; } + public static ResultObject SendUserPasswordRequestSms(int itemId, int accountId, string reason, string phoneTo = null) + { + var result = TaskManager.StartResultTask("ORGANIZATION", "SEND_USER_PASSWORD_REQUEST_SMS", + itemId); + + try + { + + // load organization + Organization org = GetOrganization(itemId); + + if (org == null) + { + throw new Exception(string.Format("Organization not found (ItemId = {0})", itemId)); + } + + UserInfo owner = PackageController.GetPackageOwner(org.PackageId); + OrganizationUser user = OrganizationController.GetUserGeneralSettingsWithExtraData(itemId, accountId); + + user.ItemId = itemId; + + if (string.IsNullOrEmpty(phoneTo)) + { + phoneTo = user.MobilePhone; + } + + UserSettings settings = UserController.GetUserSettings(owner.UserId, UserSettings.USER_PASSWORD_REQUEST_LETTER); + + + string body = settings["SMSBody"]; + + var pincode = GeneratePincode(); + Guid token; + + var items = new Hashtable(); + + items["passwordResetLink"] = GenerateUserPasswordResetLink(user.ItemId, user.AccountId, out token, pincode); + + body = PackageController.EvaluateTemplate(body, items); + + TaskManager.Write("Organization ID : " + user.ItemId); + TaskManager.Write("Account : " + user.DisplayName); + TaskManager.Write("Reason : " + reason); + TaskManager.Write("SmsTo : " + phoneTo); + + // send Sms message + var response = SendSms(phoneTo, body); + + if (response.RestException != null) + { + throw new Exception(response.RestException.Message); + } + + SetAccessTokenResponse(token, pincode); + } + catch (Exception ex) + { + TaskManager.WriteError(ex); + TaskManager.CompleteResultTask(result); + result.AddError("", ex); + return result; + } + + TaskManager.CompleteResultTask(); + return result; + } + public static ResultObject SendResetUserPasswordPincodeSms(Guid token, string phoneTo = null) { var result = TaskManager.StartResultTask("ORGANIZATION", "SEND_USER_PASSWORD_RESET_SMS_PINCODE"); @@ -1851,6 +1918,33 @@ namespace WebsitePanel.EnterpriseServer SendUserPasswordEmail(owner, user, reason, mailTo, logoUrl, UserSettings.USER_PASSWORD_RESET_LETTER, "USER_PASSWORD_RESET_LETTER", finalStep); } + public static void SendUserPasswordRequestEmail(int itemId, int accountId, string reason, string mailTo, bool finalStep) + { + // load organization + Organization org = GetOrganization(itemId); + + if (org == null) + { + throw new Exception(string.Format("Organization not found (ItemId = {0})", itemId)); + } + + UserInfo owner = PackageController.GetPackageOwner(org.PackageId); + OrganizationUser user = OrganizationController.GetUserGeneralSettingsWithExtraData(itemId, accountId); + + user.ItemId = itemId; + + if (string.IsNullOrEmpty(mailTo)) + { + mailTo = user.PrimaryEmailAddress; + } + + var generalSettings = OrganizationController.GetOrganizationGeneralSettings(itemId); + + var logoUrl = generalSettings != null ? generalSettings.OrganizationLogoUrl : string.Empty; + + SendUserPasswordEmail(owner, user, reason, mailTo, logoUrl, UserSettings.USER_PASSWORD_REQUEST_LETTER, "USER_PASSWORD_REQUEST_LETTER", finalStep); + } + public static void SendUserExpirationPasswordEmail(UserInfo owner, OrganizationUser user, string reason, string mailTo, string logoUrl) { @@ -1919,8 +2013,6 @@ namespace WebsitePanel.EnterpriseServer } } - - public static AccessToken GetAccessToken(Guid accessToken, AccessTokenTypes type) { return ObjectUtils.FillObjectFromDataReader(DataProvider.GetAccessTokenByAccessToken(accessToken, type)); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs index b2388d93..88bb4567 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesController.cs @@ -137,7 +137,7 @@ namespace WebsitePanel.EnterpriseServer } public static List GetCollectionRdsServers(int collectionId) - { + { return GetCollectionRdsServersInternal(collectionId); } @@ -304,12 +304,7 @@ namespace WebsitePanel.EnterpriseServer public static List GetRdsServices() { return GetRdsServicesInternal(); - } - - private static List GetRdsServicesInternal() - { - return ObjectUtils.CreateListFromDataSet(DataProvider.GetServicesByGroupName(SecurityContext.User.UserId, ResourceGroups.RDS)); - } + } public static string GetRdsSetupLetter(int itemId, int? accountId) { @@ -336,6 +331,80 @@ namespace WebsitePanel.EnterpriseServer return ShadowSessionInternal(itemId, sessionId, control); } + public static ResultObject ImportCollection(int itemId, string collectionName) + { + return ImportCollectionInternal(itemId, collectionName); + } + + private static ResultObject ImportCollectionInternal(int itemId, string collectionName) + { + var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "SHADOW_RDS_SESSION"); + + try + { + Organization org = OrganizationController.GetOrganization(itemId); + + if (org == null) + { + result.IsSuccess = false; + result.AddError("IMPORT_RDS_COLLECTION", new NullReferenceException("Organization not found")); + + return result; + } + + var existingCollections = GetRdsCollectionsPaged(itemId, "", "", "", 0, Int32.MaxValue).Collections; + + if (existingCollections.Select(e => e.Name.ToLower()).Contains(collectionName.ToLower())) + { + result.IsSuccess = false; + throw new InvalidOperationException(string.Format("Collection {0} already exists in database", collectionName)); + } + + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId)); + var collection = rds.GetExistingCollection(collectionName); + var newCollection = new RdsCollection + { + Name = collection.CollectionName, + Description = collection.Description, + DisplayName = collection.CollectionName + }; + + newCollection.Id = DataProvider.AddRDSCollection(itemId, newCollection.Name, newCollection.Description, newCollection.DisplayName); + newCollection.Settings = RemoteDesktopServicesHelpers.ParseCollectionSettings(collection.CollectionSettings); + newCollection.Settings.RdsCollectionId = newCollection.Id; + newCollection.Settings.Id = DataProvider.AddRdsCollectionSettings(newCollection.Settings); + var existingSessionHosts = GetRdsServersPagedInternal("", "", "", 1, 1000).Servers; + RemoteDesktopServicesHelpers.FillSessionHosts(collection.SessionHosts, existingSessionHosts, newCollection.Id, itemId); + newCollection.Servers = ObjectUtils.CreateListFromDataReader(DataProvider.GetRDSServersByCollectionId(newCollection.Id)).ToList(); + UserInfo user = PackageController.GetPackageOwner(org.PackageId); + var organizationUsers = OrganizationController.GetOrganizationUsersPaged(itemId, null, null, null, 0, Int32.MaxValue).PageUsers.Select(u => u.SamAccountName.Split('\\').Last().ToLower()); + var newUsers = organizationUsers.Where(x => collection.UserGroups.Select(a => a.PropertyValue.ToString().Split('\\').Last().ToLower()).Contains(x)); + + rds.ImportCollection(org.OrganizationId, newCollection, newUsers.ToArray()); + + var emptySettings = RemoteDesktopServicesHelpers.GetEmptyGpoSettings(); + string xml = RemoteDesktopServicesHelpers.GetSettingsXml(emptySettings); + DataProvider.UpdateRdsServerSettings(newCollection.Id, string.Format("Collection-{0}-Settings", newCollection.Id), xml); + } + catch (Exception ex) + { + throw TaskManager.WriteError(ex); + } + finally + { + if (!result.IsSuccess) + { + TaskManager.CompleteResultTask(result); + } + else + { + TaskManager.CompleteResultTask(); + } + } + + return result; + } + private static ResultObject ShadowSessionInternal(int itemId, string sessionId, bool control) { var result = TaskManager.StartResultTask("REMOTE_DESKTOP_SERVICES", "SHADOW_RDS_SESSION"); @@ -352,7 +421,7 @@ namespace WebsitePanel.EnterpriseServer return result; } - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId)); rds.ShadowSession(sessionId, control); } catch (Exception ex) @@ -405,10 +474,10 @@ namespace WebsitePanel.EnterpriseServer try { var collection = ObjectUtils.FillObjectFromDataReader(DataProvider.GetRDSCollectionById(serverId)); - var rds = GetRemoteDesktopServices(GetRdsServiceId(collection.ItemId)); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(GetRdsServiceId(collection.ItemId)); Organization org = OrganizationController.GetOrganization(collection.ItemId); rds.ApplyGPO(org.OrganizationId, collection.Name, settings); - string xml = GetSettingsXml(settings); + string xml = RemoteDesktopServicesHelpers.GetSettingsXml(settings); DataProvider.UpdateRdsServerSettings(serverId, settingsName, xml); @@ -442,8 +511,8 @@ namespace WebsitePanel.EnterpriseServer { return null; } - - string result = EvaluateMailboxTemplate(body, org, accountId, itemId); + + string result = RemoteDesktopServicesHelpers.EvaluateMailboxTemplate(body, org, accountId, itemId); return user.HtmlMail ? result : result.Replace("\n", "
"); } @@ -492,9 +561,9 @@ namespace WebsitePanel.EnterpriseServer { to = user.Email; } - - subject = EvaluateMailboxTemplate(subject, org, accountId, itemId); - body = EvaluateMailboxTemplate(body, org, accountId, itemId); + + subject = RemoteDesktopServicesHelpers.EvaluateMailboxTemplate(subject, org, accountId, itemId); + body = RemoteDesktopServicesHelpers.EvaluateMailboxTemplate(body, org, accountId, itemId); return MailHelper.SendMessage(from, to, cc, subject, body, priority, isHtml); } @@ -506,7 +575,7 @@ namespace WebsitePanel.EnterpriseServer try { int serviceId = GetRdsServiceId(rdsServer.ItemId); - var rds = GetRemoteDesktopServices(serviceId); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(serviceId); var certificate = GetRdsCertificateByServiceIdInternal(serviceId); var array = Convert.FromBase64String(certificate.Hash); @@ -605,7 +674,7 @@ namespace WebsitePanel.EnterpriseServer result.AddError("", new NullReferenceException("Organization not found")); } - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId)); rds.GetCollection(collection.Name); } @@ -630,8 +699,8 @@ namespace WebsitePanel.EnterpriseServer { return result; } - - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId)); var organizationUsers = OrganizationController.GetOrganizationUsersPaged(collection.ItemId, null, null, null, 0, Int32.MaxValue).PageUsers; var organizationAdmins = rds.GetRdsCollectionLocalAdmins(org.OrganizationId, collection.Name); @@ -655,7 +724,7 @@ namespace WebsitePanel.EnterpriseServer return result; } - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId)); var servers = ObjectUtils.CreateListFromDataReader(DataProvider.GetRDSServersByCollectionId(collection.Id)).ToList(); rds.SaveRdsCollectionLocalAdmins(users.Select(u => u.AccountName).ToArray(), servers.Select(s => s.FqdName).ToArray(), org.OrganizationId, collection.Name); @@ -730,7 +799,7 @@ namespace WebsitePanel.EnterpriseServer return -1; } - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId)); foreach(var server in collection.Servers) { @@ -744,41 +813,15 @@ namespace WebsitePanel.EnterpriseServer throw TaskManager.WriteError(new Exception(string.Format("Unable to connect to {0} server.", server.FqdName))); } } - - collection.Name = GetFormattedCollectionName(collection.DisplayName, org.OrganizationId); - collection.Settings = new RdsCollectionSettings - { - DisconnectedSessionLimitMin = 0, - ActiveSessionLimitMin = 0, - IdleSessionLimitMin = 0, - BrokenConnectionAction = BrokenConnectionActionValues.Disconnect.ToString(), - AutomaticReconnectionEnabled = true, - TemporaryFoldersDeletedOnExit = true, - TemporaryFoldersPerSession = true, - ClientDeviceRedirectionOptions = string.Join(",", new List - { - ClientDeviceRedirectionOptionValues.AudioVideoPlayBack.ToString(), - ClientDeviceRedirectionOptionValues.AudioRecording.ToString(), - ClientDeviceRedirectionOptionValues.SmartCard.ToString(), - ClientDeviceRedirectionOptionValues.Clipboard.ToString(), - ClientDeviceRedirectionOptionValues.Drive.ToString(), - ClientDeviceRedirectionOptionValues.PlugAndPlayDevice.ToString() - }.ToArray()), - ClientPrinterRedirected = true, - ClientPrinterAsDefault = true, - RDEasyPrintDriverEnabled = true, - MaxRedirectedMonitors = 16, - EncryptionLevel = EncryptionLevel.ClientCompatible.ToString(), - SecurityLayer = SecurityLayerValues.Negotiate.ToString(), - AuthenticateUsingNLA = true - }; + collection.Name = RemoteDesktopServicesHelpers.GetFormattedCollectionName(collection.DisplayName, org.OrganizationId); + collection.Settings = RemoteDesktopServicesHelpers.GetDefaultCollectionSettings(); rds.CreateCollection(org.OrganizationId, collection); - var defaultGpoSettings = GetDefaultGpoSettings(); + var defaultGpoSettings = RemoteDesktopServicesHelpers.GetDefaultGpoSettings(); rds.ApplyGPO(org.OrganizationId, collection.Name, defaultGpoSettings); collection.Id = DataProvider.AddRDSCollection(itemId, collection.Name, collection.Description, collection.DisplayName); - string xml = GetSettingsXml(defaultGpoSettings); + string xml = RemoteDesktopServicesHelpers.GetSettingsXml(defaultGpoSettings); DataProvider.UpdateRdsServerSettings(collection.Id, string.Format("Collection-{0}-Settings", collection.Id), xml); collection.Settings.RdsCollectionId = collection.Id; @@ -824,7 +867,7 @@ namespace WebsitePanel.EnterpriseServer return result; } - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId)); var existingServers = ObjectUtils.CreateListFromDataReader(DataProvider.GetRDSServersByCollectionId(collection.Id)).ToList(); var removedServers = existingServers.Where(x => !collection.Servers.Select(y => y.Id).Contains(x.Id)); @@ -876,8 +919,8 @@ namespace WebsitePanel.EnterpriseServer result.AddError("", new NullReferenceException("Organization not found")); return result; } - - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId)); rds.EditRdsCollectionSettings(collection); var collectionSettings = ObjectUtils.FillObjectFromDataReader(DataProvider.GetRdsCollectionSettingsByCollectionId(collection.Id)); @@ -948,7 +991,7 @@ namespace WebsitePanel.EnterpriseServer return result; } - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId)); var servers = ObjectUtils.CreateListFromDataReader(DataProvider.GetRDSServersByCollectionId(collection.Id)).ToArray(); rds.RemoveCollection(org.OrganizationId, collection.Name, servers); @@ -991,7 +1034,7 @@ namespace WebsitePanel.EnterpriseServer return result; } - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId)); result.AddRange(rds.GetAvailableRemoteApplications(collectionName)); } @@ -1027,7 +1070,7 @@ namespace WebsitePanel.EnterpriseServer foreach (var tmpServer in tmpServers) { - FillRdsServerData(tmpServer); + RemoteDesktopServicesHelpers.FillRdsServerData(tmpServer); } result.Servers = tmpServers.ToArray(); @@ -1046,7 +1089,7 @@ namespace WebsitePanel.EnterpriseServer return result; } - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(organization.PackageId)); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(organization.PackageId)); var userSessions = rds.GetRdsUserSessions(collection.Name).ToList(); var organizationUsers = OrganizationController.GetOrganizationUsersPaged(collection.ItemId, null, null, null, 0, Int32.MaxValue).PageUsers; @@ -1074,7 +1117,7 @@ namespace WebsitePanel.EnterpriseServer return result; } - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId)); var existingServers = rds.GetServersExistingInCollections(); DataSet ds = DataProvider.GetRDSServersPaged(null, null, filterColumn, filterValue, sortColumn, startRow, maximumRows); @@ -1100,7 +1143,7 @@ namespace WebsitePanel.EnterpriseServer return result; } - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId)); result = rds.GetRdsCollectionSessionHosts(collection.Name).ToList(); return result; @@ -1157,7 +1200,7 @@ namespace WebsitePanel.EnterpriseServer return result; } - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId)); var rdsServer = GetRdsServer(rdsSeverId); @@ -1189,32 +1232,7 @@ namespace WebsitePanel.EnterpriseServer } return result; - } - - private static int GetOrganizationRdsUsersCountInternal(int itemId) - { - return DataProvider.GetOrganizationRdsUsersCount(itemId); - } - - private static int GetOrganizationRdsServersCountInternal(int itemId) - { - return DataProvider.GetOrganizationRdsServersCount(itemId); - } - - private static int GetOrganizationRdsCollectionsCountInternal(int itemId) - { - return DataProvider.GetOrganizationRdsCollectionsCount(itemId); - } - - private static List GetCollectionRdsServersInternal(int collectionId) - { - return ObjectUtils.CreateListFromDataReader(DataProvider.GetRDSServersByCollectionId(collectionId)).ToList(); - } - - private static List GetOrganizationRdsServersInternal(int itemId) - { - return ObjectUtils.CreateListFromDataReader(DataProvider.GetRDSServersByItemId(itemId)).ToList(); - } + } private static ResultObject AddRdsServerInternal(RdsServer rdsServer) { @@ -1223,7 +1241,7 @@ namespace WebsitePanel.EnterpriseServer try { int serviceId = GetRdsMainServiceId(); - var rds = GetRemoteDesktopServices(serviceId); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(serviceId); if (rds.CheckRDSServerAvaliable(rdsServer.FqdName)) { @@ -1275,7 +1293,7 @@ namespace WebsitePanel.EnterpriseServer return result; } - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId)); if (!rds.CheckSessionHostFeatureInstallation(rdsServer.FqdName)) { @@ -1320,7 +1338,7 @@ namespace WebsitePanel.EnterpriseServer return result; } - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId)); rds.RemoveSessionHostServerFromCollection(org.OrganizationId, rdsCollection.Name, rdsServer); @@ -1387,7 +1405,7 @@ namespace WebsitePanel.EnterpriseServer return result; } - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId)); RdsServer rdsServer = GetRdsServer(serverId); rds.MoveRdsServerToTenantOU(rdsServer.FqdName, org.OrganizationId); @@ -1428,7 +1446,7 @@ namespace WebsitePanel.EnterpriseServer } var rdsServer = ObjectUtils.FillObjectFromDataReader(DataProvider.GetRDSServerById(rdsServerId)); - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId)); rds.RemoveRdsServerFromTenantOU(rdsServer.FqdName, org.OrganizationId); DataProvider.RemoveRDSServerFromOrganization(rdsServerId); } @@ -1498,7 +1516,7 @@ namespace WebsitePanel.EnterpriseServer return result; } - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId)); var collection = GetRdsCollection(collectionId); @@ -1571,7 +1589,7 @@ namespace WebsitePanel.EnterpriseServer return result; } - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId)); var collection = ObjectUtils.FillObjectFromDataReader(DataProvider.GetRDSCollectionById(collectionId)); var users = rds.GetApplicationUsers(collection.Name, remoteApp.Alias); result.AddRange(users); @@ -1594,7 +1612,7 @@ namespace WebsitePanel.EnterpriseServer } var collection = ObjectUtils.FillObjectFromDataReader(DataProvider.GetRDSCollectionById(collectionId)); - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId)); rds.SetApplicationUsers(collection.Name, remoteApp, users.ToArray()); } catch (Exception ex) @@ -1631,8 +1649,8 @@ namespace WebsitePanel.EnterpriseServer return result; } - - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId)); rds.LogOffRdsUser(unifiedSessionId, hostServer); } catch (Exception ex) @@ -1669,7 +1687,7 @@ namespace WebsitePanel.EnterpriseServer return result; } - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId)); if (!string.IsNullOrEmpty(remoteApp.Alias)) { @@ -1696,41 +1714,7 @@ namespace WebsitePanel.EnterpriseServer } return result; - } - - private static RdsServerInfo GetRdsServerInfoInternal(int? itemId, string fqdnName) - { - int serviceId = GetRdsServiceId(itemId); - var result = new RdsServerInfo(); - - if (serviceId != -1) - { - var rds = GetRemoteDesktopServices(serviceId); - result = rds.GetRdsServerInfo(fqdnName); - } - - return result; - } - - private static string GetRdsServerStatusInternal(int? itemId, string fqdnName) - { - var result = "Unavailable"; - var serviceId = GetRdsServiceId(itemId); - - try - { - if (serviceId != -1) - { - var rds = GetRemoteDesktopServices(serviceId); - result = rds.GetRdsServerStatus(fqdnName); - } - } - catch - { - } - - return result; - } + } private static ResultObject ShutDownRdsServerInternal(int? itemId, string fqdnName) { @@ -1742,7 +1726,7 @@ namespace WebsitePanel.EnterpriseServer if (serviceId != -1) { - var rds = GetRemoteDesktopServices(serviceId); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(serviceId); rds.ShutDownRdsServer(fqdnName); } } @@ -1775,7 +1759,7 @@ namespace WebsitePanel.EnterpriseServer if (serviceId != -1) { - var rds = GetRemoteDesktopServices(serviceId); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(serviceId); rds.RestartRdsServer(fqdnName); } } @@ -1810,7 +1794,7 @@ namespace WebsitePanel.EnterpriseServer return result; } - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId)); result.AddRange(rds.GetCollectionRemoteApplications(collectionName)); @@ -1832,7 +1816,7 @@ namespace WebsitePanel.EnterpriseServer return result; } - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId)); rds.RemoveRemoteApplication(collection.Name, application); } @@ -1869,7 +1853,7 @@ namespace WebsitePanel.EnterpriseServer return result; } - var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId)); + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId)); var collection = GetRdsCollection(collectionId); @@ -1911,35 +1895,7 @@ namespace WebsitePanel.EnterpriseServer } return result; - } - - private static RdsCollection FillRdsCollection(RdsCollection collection) - { - collection.Servers = GetCollectionRdsServers(collection.Id) ?? new List(); - - return collection; - } - - private static RdsServer FillRdsServerData(RdsServer server) - { - server.Address = GetServerIp(server.FqdName).ToString(); - - return server; - } - - private static System.Net.IPAddress GetServerIp(string hostname, AddressFamily addressFamily = AddressFamily.InterNetwork) - { - var address = GetServerIps(hostname); - - return address.FirstOrDefault(x => x.AddressFamily == addressFamily); - } - - private static IEnumerable GetServerIps(string hostname) - { - var address = Dns.GetHostAddresses(hostname); - - return address; - } + } private static ResultObject DeleteRemoteDesktopServiceInternal(int itemId) { @@ -1980,49 +1936,43 @@ namespace WebsitePanel.EnterpriseServer return result; } - private static int GetRemoteDesktopServiceID(int packageId) + private static int GetOrganizationRdsUsersCountInternal(int itemId) { - return PackageController.GetPackageServiceId(packageId, ResourceGroups.RDS); - } - - private static int GetRdsServiceId(int? itemId) - { - int serviceId = -1; - - if (itemId.HasValue) - { - Organization org = OrganizationController.GetOrganization(itemId.Value); - - if (org == null) - { - return serviceId; - } - - serviceId = GetRemoteDesktopServiceID(org.PackageId); - } - else - { - serviceId = GetRdsMainServiceId(); - } - - return serviceId; + return DataProvider.GetOrganizationRdsUsersCount(itemId); } - private static RemoteDesktopServices GetRemoteDesktopServices(int serviceId) + private static int GetOrganizationRdsServersCountInternal(int itemId) { - var rds = new RemoteDesktopServices(); - ServiceProviderProxy.Init(rds, serviceId); - - return rds; + return DataProvider.GetOrganizationRdsServersCount(itemId); } - private static int GetRdsMainServiceId() + private static int GetOrganizationRdsCollectionsCountInternal(int itemId) { - var settings = SystemController.GetSystemSettings(WebsitePanel.EnterpriseServer.SystemSettings.RDS_SETTINGS); + return DataProvider.GetOrganizationRdsCollectionsCount(itemId); + } + + private static List GetCollectionRdsServersInternal(int collectionId) + { + return ObjectUtils.CreateListFromDataReader(DataProvider.GetRDSServersByCollectionId(collectionId)).ToList(); + } + + private static List GetOrganizationRdsServersInternal(int itemId) + { + return ObjectUtils.CreateListFromDataReader(DataProvider.GetRDSServersByItemId(itemId)).ToList(); + } + + private static List GetRdsServicesInternal() + { + return ObjectUtils.CreateListFromDataSet(DataProvider.GetServicesByGroupName(SecurityContext.User.UserId, ResourceGroups.RDS)); + } + + protected static int GetRdsMainServiceId() + { + var settings = SystemController.GetSystemSettings(WebsitePanel.EnterpriseServer.SystemSettings.RDS_SETTINGS); if (!string.IsNullOrEmpty(settings["RdsMainController"])) { - return Convert.ToInt32(settings["RdsMainController"]); + return Convert.ToInt32(settings["RdsMainController"]); } var rdsServices = GetRdsServicesInternal(); @@ -2035,146 +1985,68 @@ namespace WebsitePanel.EnterpriseServer return -1; } - private static string GetFormattedCollectionName(string displayName, string organizationId) + protected static RdsCollection FillRdsCollection(RdsCollection collection) { - return string.Format("{0}-{1}", organizationId, displayName.Replace(" ", "_")); + collection.Servers = GetCollectionRdsServersInternal(collection.Id) ?? new List(); + + return collection; } - private static string EvaluateMailboxTemplate(string template, Organization org, int? accountId, int itemId) + protected static int GetRdsServiceId(int? itemId) { - OrganizationUser user = null; + int serviceId = -1; - if (accountId.HasValue) + if (itemId.HasValue) { - user = OrganizationController.GetAccount(itemId, accountId.Value); - } + Organization org = OrganizationController.GetOrganization(itemId.Value); - Hashtable items = new Hashtable(); - items["Organization"] = org; - - if (user != null) - { - items["account"] = user; - } - - return PackageController.EvaluateTemplate(template, items); - } - - private static RdsServerSettings GetDefaultGpoSettings() - { - var defaultSettings = UserController.GetUserSettings(SecurityContext.User.UserId, UserSettings.RDS_POLICY); - var settings = new RdsServerSettings(); - - settings.Settings.Add(new RdsServerSetting - { - PropertyName = RdsServerSettings.LOCK_SCREEN_TIMEOUT, - PropertyValue = defaultSettings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_VALUE], - ApplyAdministrators = Convert.ToBoolean(defaultSettings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_ADMINISTRATORS]), - ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_USERS]) - }); - - settings.Settings.Add(new RdsServerSetting - { - PropertyName = RdsServerSettings.REMOVE_RUN_COMMAND, - PropertyValue = "", - ApplyAdministrators = Convert.ToBoolean(defaultSettings[RdsServerSettings.REMOVE_RUN_COMMAND_ADMINISTRATORS]), - ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.REMOVE_RUN_COMMAND_USERS]) - }); - - settings.Settings.Add(new RdsServerSetting - { - PropertyName = RdsServerSettings.REMOVE_POWERSHELL_COMMAND, - PropertyValue = "", - ApplyAdministrators = Convert.ToBoolean(defaultSettings[RdsServerSettings.REMOVE_POWERSHELL_COMMAND_ADMINISTRATORS]), - ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.REMOVE_POWERSHELL_COMMAND_USERS]) - }); - - settings.Settings.Add(new RdsServerSetting - { - PropertyName = RdsServerSettings.HIDE_C_DRIVE, - PropertyValue = "", - ApplyAdministrators = Convert.ToBoolean(defaultSettings[RdsServerSettings.HIDE_C_DRIVE_ADMINISTRATORS]), - ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.HIDE_C_DRIVE_USERS]) - }); - - settings.Settings.Add(new RdsServerSetting - { - PropertyName = RdsServerSettings.REMOVE_SHUTDOWN_RESTART, - PropertyValue = "", - ApplyAdministrators = Convert.ToBoolean(defaultSettings[RdsServerSettings.REMOVE_SHUTDOWN_RESTART_ADMINISTRATORS]), - ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.REMOVE_SHUTDOWN_RESTART_USERS]) - }); - - settings.Settings.Add(new RdsServerSetting - { - PropertyName = RdsServerSettings.DISABLE_TASK_MANAGER, - PropertyValue = "", - ApplyAdministrators = Convert.ToBoolean(defaultSettings[RdsServerSettings.DISABLE_TASK_MANAGER_ADMINISTRATORS]), - ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.DISABLE_TASK_MANAGER_USERS]) - }); - - settings.Settings.Add(new RdsServerSetting - { - PropertyName = RdsServerSettings.CHANGE_DESKTOP_DISABLED, - PropertyValue = "", - ApplyAdministrators = Convert.ToBoolean(defaultSettings[RdsServerSettings.CHANGE_DESKTOP_DISABLED_ADMINISTRATORS]), - ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.CHANGE_DESKTOP_DISABLED_USERS]) - }); - - settings.Settings.Add(new RdsServerSetting - { - PropertyName = RdsServerSettings.SCREEN_SAVER_DISABLED, - PropertyValue = "", - ApplyAdministrators = Convert.ToBoolean(defaultSettings[RdsServerSettings.SCREEN_SAVER_DISABLED_ADMINISTRATORS]), - ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.SCREEN_SAVER_DISABLED_USERS]) - }); - - settings.Settings.Add(new RdsServerSetting - { - PropertyName = RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION, - PropertyValue = "", - ApplyAdministrators = Convert.ToBoolean(defaultSettings[RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION_ADMINISTRATORS]), - ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION_Users]) - }); - - settings.Settings.Add(new RdsServerSetting - { - PropertyName = RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION, - PropertyValue = "", - ApplyAdministrators = Convert.ToBoolean(defaultSettings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_ADMINISTRATORS]), - ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_Users]) - }); - - settings.Settings.Add(new RdsServerSetting - { - PropertyName = RdsServerSettings.DISABLE_CMD, - PropertyValue = "", - ApplyAdministrators = Convert.ToBoolean(defaultSettings[RdsServerSettings.DISABLE_CMD_ADMINISTRATORS]), - ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.DISABLE_CMD_USERS]) - }); - - return settings; - } - - private static string GetSettingsXml(RdsServerSettings settings) - { - XmlDocument doc = new XmlDocument(); - XmlElement nodeProps = doc.CreateElement("properties"); - - if (settings != null) - { - foreach (var setting in settings.Settings) + if (org == null) { - XmlElement nodeProp = doc.CreateElement("property"); - nodeProp.SetAttribute("name", setting.PropertyName); - nodeProp.SetAttribute("value", setting.PropertyValue); - nodeProp.SetAttribute("applyUsers", setting.ApplyUsers ? "1" : "0"); - nodeProp.SetAttribute("applyAdministrators", setting.ApplyAdministrators ? "1" : "0"); - nodeProps.AppendChild(nodeProp); + return serviceId; + } + + serviceId = RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId); + } + else + { + serviceId = GetRdsMainServiceId(); + } + + return serviceId; + } + + private static RdsServerInfo GetRdsServerInfoInternal(int? itemId, string fqdnName) + { + int serviceId = GetRdsServiceId(itemId); + var result = new RdsServerInfo(); + + if (serviceId != -1) + { + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(serviceId); + result = rds.GetRdsServerInfo(fqdnName); + } + + return result; + } + + private static string GetRdsServerStatusInternal(int? itemId, string fqdnName) + { + var result = "Unavailable"; + var serviceId = GetRdsServiceId(itemId); + + try + { + if (serviceId != -1) + { + var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(serviceId); + result = rds.GetRdsServerStatus(fqdnName); } } + catch + { + } - return nodeProps.OuterXml; - } + return result; + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesHelpers.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesHelpers.cs new file mode 100644 index 00000000..e18e9a73 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/RemoteDesktopServices/RemoteDesktopServicesHelpers.cs @@ -0,0 +1,357 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.NetworkInformation; +using System.Net.Sockets; +using System.Text; +using System.Xml; +using WebsitePanel.EnterpriseServer.Base.RDS; +using WebsitePanel.Providers.HostedSolution; +using WebsitePanel.Providers.RemoteDesktopServices; + +namespace WebsitePanel.EnterpriseServer +{ + public class RemoteDesktopServicesHelpers + { + public static string GetFormattedCollectionName(string displayName, string organizationId) + { + return string.Format("{0}-{1}", organizationId, displayName.Replace(" ", "_")); + } + + public static string EvaluateMailboxTemplate(string template, Organization org, int? accountId, int itemId) + { + OrganizationUser user = null; + + if (accountId.HasValue) + { + user = OrganizationController.GetAccount(itemId, accountId.Value); + } + + Hashtable items = new Hashtable(); + items["Organization"] = org; + + if (user != null) + { + items["account"] = user; + } + + return PackageController.EvaluateTemplate(template, items); + } + + public static RdsCollectionSettings GetDefaultCollectionSettings() + { + return new RdsCollectionSettings + { + DisconnectedSessionLimitMin = 0, + ActiveSessionLimitMin = 0, + IdleSessionLimitMin = 0, + BrokenConnectionAction = BrokenConnectionActionValues.Disconnect.ToString(), + AutomaticReconnectionEnabled = true, + TemporaryFoldersDeletedOnExit = true, + TemporaryFoldersPerSession = true, + ClientDeviceRedirectionOptions = string.Join(",", new List + { + ClientDeviceRedirectionOptionValues.AudioVideoPlayBack.ToString(), + ClientDeviceRedirectionOptionValues.AudioRecording.ToString(), + ClientDeviceRedirectionOptionValues.SmartCard.ToString(), + ClientDeviceRedirectionOptionValues.Clipboard.ToString(), + ClientDeviceRedirectionOptionValues.Drive.ToString(), + ClientDeviceRedirectionOptionValues.PlugAndPlayDevice.ToString() + }.ToArray()), + ClientPrinterRedirected = true, + ClientPrinterAsDefault = true, + RDEasyPrintDriverEnabled = true, + MaxRedirectedMonitors = 16, + EncryptionLevel = EncryptionLevel.ClientCompatible.ToString(), + SecurityLayer = SecurityLayerValues.Negotiate.ToString(), + AuthenticateUsingNLA = true + }; + } + + public static RdsServerSettings GetDefaultGpoSettings() + { + var defaultSettings = UserController.GetUserSettings(SecurityContext.User.UserId, UserSettings.RDS_POLICY); + var settings = new RdsServerSettings(); + + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.LOCK_SCREEN_TIMEOUT, + PropertyValue = defaultSettings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_VALUE], + ApplyAdministrators = Convert.ToBoolean(defaultSettings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_ADMINISTRATORS]), + ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_USERS]) + }); + + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.REMOVE_RUN_COMMAND, + PropertyValue = "", + ApplyAdministrators = Convert.ToBoolean(defaultSettings[RdsServerSettings.REMOVE_RUN_COMMAND_ADMINISTRATORS]), + ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.REMOVE_RUN_COMMAND_USERS]) + }); + + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.REMOVE_POWERSHELL_COMMAND, + PropertyValue = "", + ApplyAdministrators = Convert.ToBoolean(defaultSettings[RdsServerSettings.REMOVE_POWERSHELL_COMMAND_ADMINISTRATORS]), + ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.REMOVE_POWERSHELL_COMMAND_USERS]) + }); + + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.HIDE_C_DRIVE, + PropertyValue = "", + ApplyAdministrators = Convert.ToBoolean(defaultSettings[RdsServerSettings.HIDE_C_DRIVE_ADMINISTRATORS]), + ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.HIDE_C_DRIVE_USERS]) + }); + + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.REMOVE_SHUTDOWN_RESTART, + PropertyValue = "", + ApplyAdministrators = Convert.ToBoolean(defaultSettings[RdsServerSettings.REMOVE_SHUTDOWN_RESTART_ADMINISTRATORS]), + ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.REMOVE_SHUTDOWN_RESTART_USERS]) + }); + + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.DISABLE_TASK_MANAGER, + PropertyValue = "", + ApplyAdministrators = Convert.ToBoolean(defaultSettings[RdsServerSettings.DISABLE_TASK_MANAGER_ADMINISTRATORS]), + ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.DISABLE_TASK_MANAGER_USERS]) + }); + + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.CHANGE_DESKTOP_DISABLED, + PropertyValue = "", + ApplyAdministrators = Convert.ToBoolean(defaultSettings[RdsServerSettings.CHANGE_DESKTOP_DISABLED_ADMINISTRATORS]), + ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.CHANGE_DESKTOP_DISABLED_USERS]) + }); + + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.SCREEN_SAVER_DISABLED, + PropertyValue = "", + ApplyAdministrators = Convert.ToBoolean(defaultSettings[RdsServerSettings.SCREEN_SAVER_DISABLED_ADMINISTRATORS]), + ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.SCREEN_SAVER_DISABLED_USERS]) + }); + + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION, + PropertyValue = "", + ApplyAdministrators = Convert.ToBoolean(defaultSettings[RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION_ADMINISTRATORS]), + ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION_Users]) + }); + + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION, + PropertyValue = "", + ApplyAdministrators = Convert.ToBoolean(defaultSettings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_ADMINISTRATORS]), + ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_Users]) + }); + + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.DISABLE_CMD, + PropertyValue = "", + ApplyAdministrators = Convert.ToBoolean(defaultSettings[RdsServerSettings.DISABLE_CMD_ADMINISTRATORS]), + ApplyUsers = Convert.ToBoolean(defaultSettings[RdsServerSettings.DISABLE_CMD_USERS]) + }); + + return settings; + } + + public static RdsServerSettings GetEmptyGpoSettings() + { + var defaultSettings = UserController.GetUserSettings(SecurityContext.User.UserId, UserSettings.RDS_POLICY); + var settings = new RdsServerSettings(); + + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.LOCK_SCREEN_TIMEOUT, + PropertyValue = defaultSettings[RdsServerSettings.LOCK_SCREEN_TIMEOUT_VALUE] + }); + + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.REMOVE_RUN_COMMAND, + PropertyValue = "" + }); + + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.REMOVE_POWERSHELL_COMMAND, + PropertyValue = "" + }); + + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.HIDE_C_DRIVE, + PropertyValue = "" + }); + + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.REMOVE_SHUTDOWN_RESTART, + PropertyValue = "" + }); + + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.DISABLE_TASK_MANAGER, + PropertyValue = "" + }); + + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.CHANGE_DESKTOP_DISABLED, + PropertyValue = "" + }); + + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.SCREEN_SAVER_DISABLED, + PropertyValue = "" + }); + + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.RDS_VIEW_WITHOUT_PERMISSION, + PropertyValue = "" + }); + + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION, + PropertyValue = "" + }); + + settings.Settings.Add(new RdsServerSetting + { + PropertyName = RdsServerSettings.DISABLE_CMD, + PropertyValue = "" + }); + + return settings; + } + + public static string GetSettingsXml(RdsServerSettings settings) + { + XmlDocument doc = new XmlDocument(); + XmlElement nodeProps = doc.CreateElement("properties"); + + if (settings != null) + { + foreach (var setting in settings.Settings) + { + XmlElement nodeProp = doc.CreateElement("property"); + nodeProp.SetAttribute("name", setting.PropertyName); + nodeProp.SetAttribute("value", setting.PropertyValue); + nodeProp.SetAttribute("applyUsers", setting.ApplyUsers ? "1" : "0"); + nodeProp.SetAttribute("applyAdministrators", setting.ApplyAdministrators ? "1" : "0"); + nodeProps.AppendChild(nodeProp); + } + } + + return nodeProps.OuterXml; + } + + public static int GetRemoteDesktopServiceID(int packageId) + { + return PackageController.GetPackageServiceId(packageId, ResourceGroups.RDS); + } + + public static RemoteDesktopServices GetRemoteDesktopServices(int serviceId) + { + var rds = new RemoteDesktopServices(); + ServiceProviderProxy.Init(rds, serviceId); + + return rds; + } + + public static RdsServer FillRdsServerData(RdsServer server) + { + server.Address = GetServerIp(server.FqdName).ToString(); + + return server; + } + + public static System.Net.IPAddress GetServerIp(string hostname, AddressFamily addressFamily = AddressFamily.InterNetwork) + { + var address = GetServerIps(hostname); + + return address.FirstOrDefault(x => x.AddressFamily == addressFamily); + } + + public static RdsCollectionSettings ParseCollectionSettings(List settings) + { + var collectionSettings = new RdsCollectionSettings(); + var properties = typeof(RdsCollectionSettings).GetProperties().Where(p => p.Name.ToLower() != "id" && p.Name.ToLower() != "rdscollectionid"); + + foreach (var prop in properties) + { + var values = settings.Where(s => s.PropertyName.Equals(prop.Name, StringComparison.InvariantCultureIgnoreCase)); + + if (values.Count() == 1) + { + switch(prop.Name.ToLower()) + { + case "brokenconnectionaction": + prop.SetValue(collectionSettings, ((BrokenConnectionActionValues)values.First().PropertyValue).ToString(), null); + break; + case "clientdeviceredirectionoptions": + prop.SetValue(collectionSettings, ((ClientDeviceRedirectionOptionValues)values.First().PropertyValue).ToString(), null); + break; + case "encryptionlevel": + prop.SetValue(collectionSettings, ((EncryptionLevel)values.First().PropertyValue).ToString(), null); + break; + case "securitylayer": + prop.SetValue(collectionSettings, ((SecurityLayerValues)values.First().PropertyValue).ToString(), null); + break; + default: + prop.SetValue(collectionSettings, Convert.ChangeType(values.First().PropertyValue, prop.PropertyType), null); + break; + } + } + } + + return collectionSettings; + } + + public static void FillSessionHosts(IEnumerable sessionHosts, IEnumerable existingSessionHosts, int collectionId, int itemId) + { + var domainName = string.Format(".{0}", IPGlobalProperties.GetIPGlobalProperties().DomainName); + + foreach (var sessionHost in sessionHosts) + { + var existingSessionHost = existingSessionHosts.FirstOrDefault(e => e.FqdName.Equals(sessionHost, StringComparison.InvariantCultureIgnoreCase)); + int serverId = -1; + + if (existingSessionHost == null) + { + var serverName = sessionHost.Replace(domainName, ""); + serverId = DataProvider.AddRDSServer(serverName, sessionHost, ""); + } + else + { + serverId = existingSessionHost.Id; + } + + DataProvider.AddRDSServerToOrganization(itemId, serverId); + DataProvider.AddRDSServerToCollection(serverId, collectionId); + } + } + + private static IEnumerable GetServerIps(string hostname) + { + var address = Dns.GetHostAddresses(hostname); + + return address; + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/System/SystemController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/System/SystemController.cs index 1da3365d..2301a79c 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/System/SystemController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/System/SystemController.cs @@ -202,5 +202,15 @@ namespace WebsitePanel.EnterpriseServer TaskManager.CompleteTask(); } } + + public static bool CheckIsTwilioEnabled() + { + var settings = SystemController.GetSystemSettingsActive(SystemSettings.TWILIO_SETTINGS, false); + + return settings != null + && !string.IsNullOrEmpty(settings.GetValueOrDefault(SystemSettings.TWILIO_ACCOUNTSID_KEY, string.Empty)) + && !string.IsNullOrEmpty(settings.GetValueOrDefault(SystemSettings.TWILIO_AUTHTOKEN_KEY, string.Empty)) + && !string.IsNullOrEmpty(settings.GetValueOrDefault(SystemSettings.TWILIO_PHONEFROM_KEY, string.Empty)); + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Users/Helpers/OneTimePasswordHelper.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Users/Helpers/OneTimePasswordHelper.cs new file mode 100644 index 00000000..3e515ddb --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Users/Helpers/OneTimePasswordHelper.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace WebsitePanel.EnterpriseServer +{ + public class OneTimePasswordHelper + { + public static string SetOneTimePassword(int userId) + { + int passwordLength = 12; // default length + + // load password policy + UserSettings userSettings = UserController.GetUserSettings(userId, UserSettings.WEBSITEPANEL_POLICY); + string passwordPolicy = userSettings["PasswordPolicy"]; + + if (!String.IsNullOrEmpty(passwordPolicy)) + { + // get third parameter - max length + try + { + passwordLength = Utils.ParseInt(passwordPolicy.Split(';')[2].Trim(), passwordLength); + } + catch { /* skip */ } + } + + // generate password + var password = Utils.GetRandomString(passwordLength); + + DataProvider.SetUserOneTimePassword(userId, CryptoUtils.Encrypt(password), (int) OneTimePasswordStates.Active); + + return password; + } + + public static void FireSuccessAuth(UserInfoInternal user) + { + DataProvider.SetUserOneTimePassword(user.UserId, CryptoUtils.Encrypt(user.Password), (int) OneTimePasswordStates.Expired); + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Users/UserController.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Users/UserController.cs index fabe98bc..7c5b85f3 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Users/UserController.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/Users/UserController.cs @@ -57,6 +57,8 @@ namespace WebsitePanel.EnterpriseServer try { + int result = 0; + // try to get user from database UserInfoInternal user = GetUserInternally(username); @@ -99,16 +101,31 @@ namespace WebsitePanel.EnterpriseServer // compare user passwords - if (CryptoUtils.SHA1(user.Password) != password) + if (CryptoUtils.SHA1(user.Password) == password) + { + switch (user.OneTimePasswordState) + { + case OneTimePasswordStates.Active: + result = BusinessSuccessCodes.SUCCESS_USER_ONETIMEPASSWORD; + OneTimePasswordHelper.FireSuccessAuth(user); + break; + case OneTimePasswordStates.Expired: + if (lockOut >= 0) DataProvider.UpdateUserFailedLoginAttempt(user.UserId, lockOut, false); + TaskManager.WriteWarning("Expired one time password"); + return BusinessErrorCodes.ERROR_USER_EXPIRED_ONETIMEPASSWORD; + break; + } + } + else { if (lockOut >= 0) DataProvider.UpdateUserFailedLoginAttempt(user.UserId, lockOut, false); TaskManager.WriteWarning("Wrong password"); - return BusinessErrorCodes.ERROR_USER_WRONG_PASSWORD; + return BusinessErrorCodes.ERROR_USER_WRONG_PASSWORD; } - else - DataProvider.UpdateUserFailedLoginAttempt(user.UserId, lockOut, true); + + DataProvider.UpdateUserFailedLoginAttempt(user.UserId, lockOut, true); // check status if (user.Status == UserStatus.Cancelled) @@ -123,7 +140,7 @@ namespace WebsitePanel.EnterpriseServer return BusinessErrorCodes.ERROR_USER_ACCOUNT_PENDING; } - return 0; + return result; } catch (Exception ex) @@ -155,7 +172,7 @@ namespace WebsitePanel.EnterpriseServer } // compare user passwords - if (CryptoUtils.SHA1(user.Password) == password) + if (CryptoUtils.SHA1(user.Password) == password) return new UserInfo(user); return null; @@ -210,7 +227,7 @@ namespace WebsitePanel.EnterpriseServer try { // try to get user from database - UserInfo user = GetUserInternally(username); + UserInfoInternal user = GetUserInternally(username); if (user == null) { TaskManager.WriteWarning("Account not found"); @@ -232,18 +249,20 @@ namespace WebsitePanel.EnterpriseServer if (body == null || body == "") return BusinessErrorCodes.ERROR_SETTINGS_PASSWORD_LETTER_EMPTY_BODY; + + // One Time Password feature + user.Password = OneTimePasswordHelper.SetOneTimePassword(user.UserId); - // set template context items - Hashtable items = new Hashtable(); - items["user"] = user; - items["Email"] = true; + // set template context items + Hashtable items = new Hashtable(); + items["user"] = user; + items["Email"] = true; - // get reseller details + // get reseller details UserInfoInternal reseller = UserController.GetUser(user.OwnerId); if (reseller != null) { - reseller.Password = ""; - items["reseller"] = reseller; + items["reseller"] = new UserInfo(reseller); } subject = PackageController.EvaluateTemplate(subject, items); @@ -264,52 +283,40 @@ namespace WebsitePanel.EnterpriseServer } } + internal static UserInfoInternal GetUserInternally(int userId) { - // try to get user from database - UserInfoInternal user = ObjectUtils.FillObjectFromDataReader( - DataProvider.GetUserByIdInternally(userId)); - - if (user != null) - user.Password = CryptoUtils.Decrypt(user.Password); - return user; + return GetUser(DataProvider.GetUserByIdInternally(userId)); } internal static UserInfoInternal GetUserInternally(string username) { - // try to get user from database - UserInfoInternal user = ObjectUtils.FillObjectFromDataReader( - DataProvider.GetUserByUsernameInternally(username)); - - if (user != null) - { - user.Password = CryptoUtils.Decrypt(user.Password); - } - return user; + return GetUser(DataProvider.GetUserByUsernameInternally(username)); } public static UserInfoInternal GetUser(int userId) { - // try to get user from database - UserInfoInternal user = ObjectUtils.FillObjectFromDataReader( - DataProvider.GetUserById(SecurityContext.User.UserId, userId)); - - if (user != null) - user.Password = CryptoUtils.Decrypt(user.Password); - return user; + return GetUser(DataProvider.GetUserById(SecurityContext.User.UserId, userId)); } public static UserInfoInternal GetUser(string username) { - // try to get user from database - UserInfoInternal user = ObjectUtils.FillObjectFromDataReader( - DataProvider.GetUserByUsername(SecurityContext.User.UserId, username)); - - if (user != null) - user.Password = CryptoUtils.Decrypt(user.Password); - return user; + return GetUser(DataProvider.GetUserByUsername(SecurityContext.User.UserId, username)); } + private static UserInfoInternal GetUser(IDataReader reader) + { + // try to get user from database + UserInfoInternal user = ObjectUtils.FillObjectFromDataReader(reader); + + if (user != null) + { + user.Password = CryptoUtils.Decrypt(user.Password); + } + + return user; + } + public static List GetUserParents(int userId) { // get users from database diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/WebsitePanel.EnterpriseServer.Code.csproj b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/WebsitePanel.EnterpriseServer.Code.csproj index 1532ee8a..4287066b 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/WebsitePanel.EnterpriseServer.Code.csproj +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/WebsitePanel.EnterpriseServer.Code.csproj @@ -146,6 +146,7 @@ + @@ -182,6 +183,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esOrganizations.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esOrganizations.asmx.cs index 3e6c1188..8e87cb8b 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esOrganizations.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esOrganizations.asmx.cs @@ -211,6 +211,18 @@ namespace WebsitePanel.EnterpriseServer } + [WebMethod] + public ResultObject SendUserPasswordRequestSms(int itemId, int accountId, string reason, string phoneTo) + { + return OrganizationController.SendUserPasswordRequestSms(itemId, accountId, reason, phoneTo); + } + + [WebMethod] + public void SendUserPasswordRequestEmail(int itemId, int accountId, string reason, string mailTo, bool finalStep) + { + OrganizationController.SendUserPasswordRequestEmail(itemId, accountId, reason, mailTo, finalStep); + } + #endregion #region Domains diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs index b99ea321..e509dd99 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esRemoteDesktopServices.asmx.cs @@ -386,5 +386,11 @@ namespace WebsitePanel.EnterpriseServer { return RemoteDesktopServicesController.ShadowSession(itemId, sessionId, control); } + + [WebMethod] + public ResultObject ImportCollection(int itemId, string collectionName) + { + return RemoteDesktopServicesController.ImportCollection(itemId, collectionName); + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esSystem.asmx.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esSystem.asmx.cs index 26c44aee..48b23cc0 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esSystem.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer/esSystem.asmx.cs @@ -59,6 +59,12 @@ namespace WebsitePanel.EnterpriseServer return SystemController.GetSystemSettingsActive(settingsName, decrypt); } + [WebMethod] + public bool CheckIsTwilioEnabled() + { + return SystemController.CheckIsTwilioEnabled(); + } + [WebMethod] public int SetSystemSettings(string settingsName, SystemSettings settings) { diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs index 2cfe5b06..67dbde9c 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/IRemoteDesktopServices.cs @@ -84,5 +84,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices void ApplyGPO(string organizationId, string collectionName, RdsServerSettings serverSettings); void ShadowSession(string sessionId, bool control); void MoveSessionHostsToCollectionOU(List servers, string collectionName, string organizationId); + ImportedRdsCollection GetExistingCollection(string collectionName); + void ImportCollection(string organizationId, RdsCollection collection, List users); } } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/ImportedRdsCollection.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/ImportedRdsCollection.cs new file mode 100644 index 00000000..a1c4b64a --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/ImportedRdsCollection.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using WebsitePanel.EnterpriseServer.Base.RDS; + +namespace WebsitePanel.Providers.RemoteDesktopServices +{ + public class ImportedRdsCollection + { + public string CollectionName { get; set; } + public string Description { get; set; } + public List CollectionSettings { get; set; } + public List UserGroups { get; set; } + public List SessionHosts { get; set; } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsCollectionSetting.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsCollectionSetting.cs new file mode 100644 index 00000000..c0930b40 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsCollectionSetting.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace WebsitePanel.Providers.RemoteDesktopServices +{ + public class RdsCollectionSetting + { + public string PropertyName { get; set; } + + public object PropertyValue { get; set; } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServerSettings.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServerSettings.cs index ad175a46..c132a79f 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServerSettings.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/RemoteDesktopServices/RdsServerSettings.cs @@ -48,6 +48,7 @@ namespace WebsitePanel.EnterpriseServer.Base.RDS public const string DISABLE_CMD = "DisableCMD"; public const string DISABLE_CMD_ADMINISTRATORS = "DisableCMDAdministrators"; public const string DISABLE_CMD_USERS = "DisableCMDUsers"; + public const string ALLOWCONNECTIONSIMPORT = "AllowConnectionsImport"; public string SettingsName { get; set; } public int ServerId { get; set; } diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj index 80c567d5..71bd8ac8 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/WebsitePanel.Providers.Base.csproj @@ -134,10 +134,12 @@ + + diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/RdsRunspaceExtensions.cs b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/RdsRunspaceExtensions.cs new file mode 100644 index 00000000..78498d3c --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/RdsRunspaceExtensions.cs @@ -0,0 +1,169 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Management.Automation; +using System.Management.Automation.Runspaces; +using System.Text; +using WebsitePanel.Server.Utils; + +namespace WebsitePanel.Providers.RemoteDesktopServices +{ + public static class RdsRunspaceExtensions + { + public static RdsCollection GetCollection(this Runspace runspace, string collectionName, string connectionBroker, string primaryDomainController) + { + RdsCollection collection = null; + Command cmd = new Command("Get-RDSessionCollection"); + cmd.Parameters.Add("CollectionName", collectionName); + cmd.Parameters.Add("ConnectionBroker", connectionBroker); + + var collectionPs = ExecuteShellCommand(runspace, cmd, false, primaryDomainController).FirstOrDefault(); + + if (collectionPs != null) + { + collection = new RdsCollection(); + collection.Name = Convert.ToString(GetPSObjectProperty(collectionPs, "CollectionName")); + collection.Description = Convert.ToString(GetPSObjectProperty(collectionPs, "CollectionDescription")); + } + + return collection; + } + + public static List GetCollectionSettings(this Runspace runspace, string collectionName, string connectionBroker, string primaryDomainController, out object[] errors) + { + var result = new List(); + var errorsList = new List(); + + result.AddRange(GetCollectionSettings(runspace, collectionName, connectionBroker, primaryDomainController, "Connection", out errors)); + errorsList.AddRange(errors); + result.AddRange(GetCollectionSettings(runspace, collectionName, connectionBroker, primaryDomainController, "UserProfileDisk", out errors)); + errorsList.AddRange(errors); + result.AddRange(GetCollectionSettings(runspace, collectionName, connectionBroker, primaryDomainController, "Security", out errors)); + errorsList.AddRange(errors); + result.AddRange(GetCollectionSettings(runspace, collectionName, connectionBroker, primaryDomainController, "LoadBalancing", out errors)); + errorsList.AddRange(errors); + result.AddRange(GetCollectionSettings(runspace, collectionName, connectionBroker, primaryDomainController, "Client", out errors)); + errorsList.AddRange(errors); + errors = errorsList.ToArray(); + + return result; + } + + public static List GetCollectionUserGroups(this Runspace runspace, string collectionName, string connectionBroker, string primaryDomainController, out object[] errors) + { + return GetCollectionSettings(runspace, collectionName, connectionBroker, primaryDomainController, "UserGroup", out errors); + } + + public static List GetSessionHosts(this Runspace runspace, string collectionName, string connectionBroker, string primaryDomainController, out object[] errors) + { + Command cmd = new Command("Get-RDSessionHost"); + cmd.Parameters.Add("CollectionName", collectionName); + cmd.Parameters.Add("ConnectionBroker", connectionBroker); + + var psObjects = ExecuteShellCommand(runspace, cmd, false, primaryDomainController, out errors); + var rdsServers = new List(); + + if (psObjects != null) + { + foreach(var psObject in psObjects) + { + rdsServers.Add(GetPSObjectProperty(psObject, "SessionHost").ToString()); + } + } + + return rdsServers; + } + + private static List GetCollectionSettings(this Runspace runspace, string collectionName, string connectionBroker, string primaryDomainController, string param, out object[] errors) + { + Command cmd = new Command("Get-RDSessionCollectionConfiguration"); + cmd.Parameters.Add("CollectionName", collectionName); + cmd.Parameters.Add("ConnectionBroker", connectionBroker); + + if (!string.IsNullOrEmpty(param)) + { + cmd.Parameters.Add(param, true); + } + + var psObject = ExecuteShellCommand(runspace, cmd, false, primaryDomainController, out errors).FirstOrDefault(); + + var properties = typeof(RdsCollectionSettings).GetProperties().Select(p => p.Name.ToLower()); + var collectionSettings = new RdsCollectionSettings(); + var result = new List(); + + if (psObject != null) + { + foreach (var prop in psObject.Properties) + { + if (prop.Name.ToLower() != "id" && prop.Name.ToLower() != "rdscollectionid") + { + result.Add(new RdsCollectionSetting + { + PropertyName = prop.Name, + PropertyValue = prop.Value + }); + } + } + } + + return result; + } + + private static Collection ExecuteShellCommand(Runspace runSpace, Command cmd, bool useDomainController, string primaryDomainController) + { + object[] errors; + return ExecuteShellCommand(runSpace, cmd, useDomainController, primaryDomainController, out errors); + } + + private static Collection ExecuteShellCommand(Runspace runSpace, Command cmd, bool useDomainController, string primaryDomainController, + out object[] errors) + { + Log.WriteStart("ExecuteShellCommand"); + List errorList = new List(); + + if (useDomainController) + { + CommandParameter dc = new CommandParameter("DomainController", primaryDomainController); + if (!cmd.Parameters.Contains(dc)) + { + cmd.Parameters.Add(dc); + } + } + + Collection results = null; + // Create a pipeline + Pipeline pipeLine = runSpace.CreatePipeline(); + using (pipeLine) + { + // Add the command + pipeLine.Commands.Add(cmd); + // Execute the pipeline and save the objects returned. + results = pipeLine.Invoke(); + + // Log out any errors in the pipeline execution + // NOTE: These errors are NOT thrown as exceptions! + // Be sure to check this to ensure that no errors + // happened while executing the command. + if (pipeLine.Error != null && pipeLine.Error.Count > 0) + { + foreach (object item in pipeLine.Error.ReadToEnd()) + { + errorList.Add(item); + string errorMessage = string.Format("Invoke error: {0}", item); + Log.WriteWarning(errorMessage); + } + } + } + pipeLine = null; + errors = errorList.ToArray(); + Log.WriteEnd("ExecuteShellCommand"); + return results; + } + + private static object GetPSObjectProperty(PSObject obj, string name) + { + return obj.Members[name].Value; + } + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/WebsitePanel.Providers.RemoteDesktopServices.Windows2012.csproj b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/WebsitePanel.Providers.RemoteDesktopServices.Windows2012.csproj index 66dd13d8..4b112526 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/WebsitePanel.Providers.RemoteDesktopServices.Windows2012.csproj +++ b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/WebsitePanel.Providers.RemoteDesktopServices.Windows2012.csproj @@ -46,6 +46,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs index 233fe6a2..dd287158 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs @@ -486,19 +486,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices try { runSpace = OpenRunspace(); - - Command cmd = new Command("Get-RDSessionCollection"); - cmd.Parameters.Add("CollectionName", collectionName); - cmd.Parameters.Add("ConnectionBroker", ConnectionBroker); - - var collectionPs = ExecuteShellCommand(runSpace, cmd, false).FirstOrDefault(); - - if (collectionPs != null) - { - collection = new RdsCollection(); - collection.Name = Convert.ToString(GetPSObjectProperty(collectionPs, "CollectionName")); - collection.Description = Convert.ToString(GetPSObjectProperty(collectionPs, "CollectionDescription")); - } + collection = runSpace.GetCollection(collectionName, ConnectionBroker, PrimaryDomainController); } finally { @@ -1656,6 +1644,124 @@ namespace WebsitePanel.Providers.RemoteDesktopServices #endregion + #region Import Collection + + public ImportedRdsCollection GetExistingCollection(string collectionName) + { + Runspace runspace = null; + ImportedRdsCollection result; + + try + { + runspace = OpenRunspace(); + var collection = runspace.GetCollection(collectionName, ConnectionBroker, PrimaryDomainController); + result = new ImportedRdsCollection + { + CollectionName = collection.Name, + Description = collection.Description + }; + + if (collection == null) + { + throw new NullReferenceException(string.Format("Collection \"{0}\" not found", collectionName)); + } + + object[] errors; + result.CollectionSettings = runspace.GetCollectionSettings(collectionName, ConnectionBroker, PrimaryDomainController, out errors).ToList(); + + if (errors.Any()) + { + throw new Exception(string.Format("Collection not imported:\r\n{0}", string.Join("r\\n\\", errors.Select(e => e.ToString()).ToArray()))); + } + + result.SessionHosts = runspace.GetSessionHosts(collectionName, ConnectionBroker, PrimaryDomainController, out errors); + + if (errors.Any()) + { + throw new Exception(string.Format("Collection not imported:\r\n{0}", string.Join("r\\n\\", errors.Select(e => e.ToString()).ToArray()))); + } + + result.UserGroups = runspace.GetCollectionUserGroups(collectionName, ConnectionBroker, PrimaryDomainController, out errors).ToList(); + + if (errors.Any()) + { + throw new Exception(string.Format("Collection not imported:\r\n{0}", string.Join("r\\n\\", errors.Select(e => e.ToString()).ToArray()))); + } + } + finally + { + CloseRunspace(runspace); + } + + return result; + } + + public void ImportCollection(string organizationId, RdsCollection collection, List users) + { + Runspace runSpace = null; + + try + { + runSpace = OpenRunspace(); + var orgPath = GetOrganizationPath(organizationId); + CheckOrCreateAdGroup(GetComputerGroupPath(organizationId, collection.Name), orgPath, GetComputersGroupName(collection.Name), RdsCollectionComputersGroupDescription); + CheckOrCreateHelpDeskComputerGroup(); + string helpDeskGroupSamAccountName = CheckOrCreateAdGroup(GetHelpDeskGroupPath(RDSHelpDeskGroup), GetRootOUPath(), RDSHelpDeskGroup, RDSHelpDeskGroupDescription); + string groupName = GetLocalAdminsGroupName(collection.Name); + string groupPath = GetGroupPath(organizationId, collection.Name, groupName); + string localAdminsGroupSamAccountName = CheckOrCreateAdGroup(groupPath, GetOrganizationPath(organizationId), groupName, WspAdministratorsGroupDescription); + CheckOrCreateAdGroup(GetUsersGroupPath(organizationId, collection.Name), orgPath, GetUsersGroupName(collection.Name), RdsCollectionUsersGroupDescription); + + var capPolicyName = GetPolicyName(organizationId, collection.Name, RdsPolicyTypes.RdCap); + var rapPolicyName = GetPolicyName(organizationId, collection.Name, RdsPolicyTypes.RdRap); + + foreach (var gateway in Gateways) + { + CreateHelpDeskRdCapForce(runSpace, gateway); + CreateHelpDeskRdRapForce(runSpace, gateway); + + if (!CentralNps) + { + CreateRdCapForce(runSpace, gateway, capPolicyName, collection.Name, new List { GetUsersGroupName(collection.Name) }); + } + + CreateRdRapForce(runSpace, gateway, rapPolicyName, collection.Name, new List { GetUsersGroupName(collection.Name) }); + } + + if (CentralNps) + { + CreateCentralNpsPolicy(runSpace, CentralNpsHost, capPolicyName, collection.Name, organizationId); + } + + //add user group to collection + AddUserGroupsToCollection(runSpace, collection.Name, new List { GetUsersGroupName(collection.Name) }); + + //add session servers to group + foreach (var rdsServer in collection.Servers) + { + MoveSessionHostToCollectionOU(rdsServer.Name, collection.Name, organizationId); + AddAdGroupToLocalAdmins(runSpace, rdsServer.FqdName, helpDeskGroupSamAccountName); + AddAdGroupToLocalAdmins(runSpace, rdsServer.FqdName, localAdminsGroupSamAccountName); + AddComputerToCollectionAdComputerGroup(organizationId, collection.Name, rdsServer); + } + + string collectionComputersPath = GetComputerGroupPath(organizationId, collection.Name); + CreatePolicy(runSpace, organizationId, string.Format("{0}-administrators", collection.Name), + new DirectoryEntry(GetGroupPath(organizationId, collection.Name, GetLocalAdminsGroupName(collection.Name))), new DirectoryEntry(collectionComputersPath), collection.Name); + CreatePolicy(runSpace, organizationId, string.Format("{0}-users", collection.Name), new DirectoryEntry(GetUsersGroupPath(organizationId, collection.Name)) + , new DirectoryEntry(collectionComputersPath), collection.Name); + CreateHelpDeskPolicy(runSpace, new DirectoryEntry(GetHelpDeskGroupPath(RDSHelpDeskGroup)), new DirectoryEntry(collectionComputersPath), organizationId, collection.Name); + + SetUsersInCollection(organizationId, collection.Name, users); + } + finally + { + CloseRunspace(runSpace); + } + } + + #endregion + private void AddRdsServerToDeployment(Runspace runSpace, RdsServer server) { Command cmd = new Command("Add-RDserver"); @@ -2723,6 +2829,11 @@ namespace WebsitePanel.Providers.RemoteDesktopServices cmd.Parameters.Add("CollectionName", collection.Name); cmd.Parameters.Add("ConnectionBroker", ConnectionBroker); + if (string.IsNullOrEmpty(collection.Settings.ClientDeviceRedirectionOptions)) + { + collection.Settings.ClientDeviceRedirectionOptions = "None"; + } + var properties = collection.Settings.GetType().GetProperties(); foreach(var prop in properties) @@ -2733,7 +2844,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices if (value != null) { - cmd.Parameters.Add(prop.Name, value); + cmd.Parameters.Add(prop.Name, value); } } } diff --git a/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs b/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs index bbd90595..d07b437c 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server.Client/RemoteDesktopServicesProxy.cs @@ -108,6 +108,10 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { private System.Threading.SendOrPostCallback MoveSessionHostsToCollectionOUOperationCompleted; + private System.Threading.SendOrPostCallback GetExistingCollectionOperationCompleted; + + private System.Threading.SendOrPostCallback ImportCollectionOperationCompleted; + /// public RemoteDesktopServices() { this.Url = "http://localhost:9003/RemoteDesktopServices.asmx"; @@ -230,6 +234,12 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { /// public event MoveSessionHostsToCollectionOUCompletedEventHandler MoveSessionHostsToCollectionOUCompleted; + /// + public event GetExistingCollectionCompletedEventHandler GetExistingCollectionCompleted; + + /// + public event ImportCollectionCompletedEventHandler ImportCollectionCompleted; + /// [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/CreateCollection", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] @@ -1933,6 +1943,94 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { } } + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/GetExistingCollection", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public ImportedRdsCollection GetExistingCollection(string collectionName) { + object[] results = this.Invoke("GetExistingCollection", new object[] { + collectionName}); + return ((ImportedRdsCollection)(results[0])); + } + + /// + public System.IAsyncResult BeginGetExistingCollection(string collectionName, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("GetExistingCollection", new object[] { + collectionName}, callback, asyncState); + } + + /// + public ImportedRdsCollection EndGetExistingCollection(System.IAsyncResult asyncResult) { + object[] results = this.EndInvoke(asyncResult); + return ((ImportedRdsCollection)(results[0])); + } + + /// + public void GetExistingCollectionAsync(string collectionName) { + this.GetExistingCollectionAsync(collectionName, null); + } + + /// + public void GetExistingCollectionAsync(string collectionName, object userState) { + if ((this.GetExistingCollectionOperationCompleted == null)) { + this.GetExistingCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetExistingCollectionOperationCompleted); + } + this.InvokeAsync("GetExistingCollection", new object[] { + collectionName}, this.GetExistingCollectionOperationCompleted, userState); + } + + private void OnGetExistingCollectionOperationCompleted(object arg) { + if ((this.GetExistingCollectionCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.GetExistingCollectionCompleted(this, new GetExistingCollectionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + + /// + [System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")] + [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/server/ImportCollection", RequestNamespace="http://smbsaas/websitepanel/server/", ResponseNamespace="http://smbsaas/websitepanel/server/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] + public void ImportCollection(string organizationId, RdsCollection collection, string[] users) { + this.Invoke("ImportCollection", new object[] { + organizationId, + collection, + users}); + } + + /// + public System.IAsyncResult BeginImportCollection(string organizationId, RdsCollection collection, string[] users, System.AsyncCallback callback, object asyncState) { + return this.BeginInvoke("ImportCollection", new object[] { + organizationId, + collection, + users}, callback, asyncState); + } + + /// + public void EndImportCollection(System.IAsyncResult asyncResult) { + this.EndInvoke(asyncResult); + } + + /// + public void ImportCollectionAsync(string organizationId, RdsCollection collection, string[] users) { + this.ImportCollectionAsync(organizationId, collection, users, null); + } + + /// + public void ImportCollectionAsync(string organizationId, RdsCollection collection, string[] users, object userState) { + if ((this.ImportCollectionOperationCompleted == null)) { + this.ImportCollectionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnImportCollectionOperationCompleted); + } + this.InvokeAsync("ImportCollection", new object[] { + organizationId, + collection, + users}, this.ImportCollectionOperationCompleted, userState); + } + + private void OnImportCollectionOperationCompleted(object arg) { + if ((this.ImportCollectionCompleted != null)) { + System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); + this.ImportCollectionCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); + } + } + /// public new void CancelAsync(object userState) { base.CancelAsync(userState); @@ -2578,4 +2676,34 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { /// [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] public delegate void MoveSessionHostsToCollectionOUCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void GetExistingCollectionCompletedEventHandler(object sender, GetExistingCollectionCompletedEventArgs e); + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] + public partial class GetExistingCollectionCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { + + private object[] results; + + internal GetExistingCollectionCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : + base(exception, cancelled, userState) { + this.results = results; + } + + /// + public ImportedRdsCollection Result { + get { + this.RaiseExceptionIfNecessary(); + return ((ImportedRdsCollection)(this.results[0])); + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")] + public delegate void ImportCollectionCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e); } diff --git a/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs b/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs index e28846eb..d7449faa 100644 --- a/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs +++ b/WebsitePanel/Sources/WebsitePanel.Server/RemoteDesktopServices.asmx.cs @@ -711,5 +711,37 @@ namespace WebsitePanel.Server throw; } } + + [WebMethod, SoapHeader("settings")] + public ImportedRdsCollection GetExistingCollection(string collectionName) + { + try + { + Log.WriteStart("'{0}' GetExistingCollection", ProviderSettings.ProviderName); + return RDSProvider.GetExistingCollection(collectionName); + Log.WriteEnd("'{0}' GetExistingCollection", ProviderSettings.ProviderName); + } + catch (Exception ex) + { + Log.WriteError(String.Format("'{0}' GetExistingCollection", ProviderSettings.ProviderName), ex); + throw; + } + } + + [WebMethod, SoapHeader("settings")] + public void ImportCollection(string organizationId, RdsCollection collection, List users) + { + try + { + Log.WriteStart("'{0}' ImportCollection", ProviderSettings.ProviderName); + RDSProvider.ImportCollection(organizationId, collection, users); + Log.WriteEnd("'{0}' ImportCollection", ProviderSettings.ProviderName); + } + catch (Exception ex) + { + Log.WriteError(String.Format("'{0}' ImportCollection", ProviderSettings.ProviderName), ex); + throw; + } + } } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.Designer.cs b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.Designer.cs index 57565d1d..4c1d4299 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.Designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.Designer.cs @@ -88,11 +88,11 @@ namespace WebsitePanel.WebDavPortal.Resources { } /// - /// Looks up a localized string similar to Address Inforamtion. + /// Looks up a localized string similar to Address Information. /// - public static string AddressInforamtion { + public static string AddressInformation { get { - return ResourceManager.GetString("AddressInforamtion", resourceCulture); + return ResourceManager.GetString("AddressInformation", resourceCulture); } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.resx b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.resx index e5779ae5..1f4ec733 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Resources/UI.resx @@ -123,8 +123,8 @@ Address - - Address Inforamtion + + Address Information Back diff --git a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Account/UserProfile.cshtml b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Account/UserProfile.cshtml index 401acd3c..86282004 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Account/UserProfile.cshtml +++ b/WebsitePanel/Sources/WebsitePanel.WebDavPortal/Views/Account/UserProfile.cshtml @@ -169,7 +169,7 @@ diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config index 7933d0cc..8a21c2f2 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/ESModule_ControlsHierarchy.config @@ -158,6 +158,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config index 70e8407b..890072ed 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_Data/WebsitePanel_Modules.config @@ -401,7 +401,8 @@ - + + @@ -606,6 +607,7 @@ + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx index 25d3ee9f..5788b660 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/App_GlobalResources/WebsitePanel_SharedResources.ascx.resx @@ -4581,6 +4581,9 @@ User account is Suspended + + You should change your one time password. + Hostname pattern is not specified. Could not create VPS with blank hostname. @@ -5787,6 +5790,9 @@ Error creating rds collection. You need to add at least 1 rds server to collection + + Error importing rds collection. Collection not found + Resource Mailboxes per Organization @@ -5823,6 +5829,9 @@ Collection not created + + Collection not imported + Session host certificate not installed diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/Code/PortalUtils.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/Code/PortalUtils.cs index d3c706c0..9031ad43 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/Code/PortalUtils.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/Code/PortalUtils.cs @@ -382,7 +382,7 @@ namespace WebsitePanel.Portal else return BusinessErrorCodes.ERROR_USER_ACCOUNT_ROLE_NOT_ALLOWED; } - return 0; + return authResult; } } catch (Exception ex) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsRdsPolicy.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsRdsPolicy.ascx.resx index 4e783a67..2f01e647 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsRdsPolicy.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsRdsPolicy.ascx.resx @@ -120,9 +120,15 @@ Administrators + + Allow + Users + + Connections Import + Changing Desktop Disabled diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsUserPasswordRequestLetter.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsUserPasswordRequestLetter.ascx.resx new file mode 100644 index 00000000..34c63a90 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SettingsUserPasswordRequestLetter.ascx.resx @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + High + + + Low + + + Normal + + + From: + + + HTML Body: + + + Logo Url: + + + No Changes HTML Body: + + + No Changes Text Body: + + + Password Reset Link Sms Body: + + + Password Reset Link Pincode Body: + + + Priority: + + + Subject: + + + Text Body: + + + SMS + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SystemSettings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SystemSettings.ascx.resx index 0df8b577..776683cc 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SystemSettings.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/SystemSettings.ascx.resx @@ -172,7 +172,7 @@ Webdav Portal URL - Webdav Portal + Organization Password Reset Module Yes diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/UserAccountMailTemplateSettings.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/UserAccountMailTemplateSettings.ascx.resx index 3329ebf5..5a024ed4 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/UserAccountMailTemplateSettings.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/UserAccountMailTemplateSettings.ascx.resx @@ -159,4 +159,7 @@ Organization User Password Reset Pincode Letter + + Organization User Password Request Letter + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx index 7568dc46..55926fa6 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx @@ -8,6 +8,7 @@ <%@ Register Src="UserControls/Breadcrumb.ascx" TagName="Breadcrumb" TagPrefix="wsp" %> <%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> <%@ Register Src="UserControls/MailboxPlanSelector.ascx" TagName="MailboxPlanSelector" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/SendToControl.ascx" TagName="SendToControl" TagPrefix="wsp" %> @@ -105,12 +106,17 @@ - + + + + + + - + - + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.cs index 5608b564..e9926fae 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.cs @@ -27,6 +27,7 @@ // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using System; +using System.Web.Security; using WebsitePanel.EnterpriseServer; using WebsitePanel.Providers.HostedSolution; using WebsitePanel.Providers.ResultObjects; @@ -161,12 +162,19 @@ namespace WebsitePanel.Portal.ExchangeServer string subscriberNumber = IsNewUser ? txtSubscriberNumber.Text.Trim() : userSelector.GetSubscriberNumber(); + var passwordString = password.Password; + + if (sendToControl.IsRequestSend && IsNewUser) + { + passwordString = Membership.GeneratePassword(16, 3); + } + accountId = ES.Services.ExchangeServer.CreateMailbox(PanelRequest.ItemID, accountId, type, accountName, displayName, name, domain, - password.Password, + passwordString, chkSendInstructions.Checked, sendInstructionEmail.Text, Convert.ToInt32(mailboxPlanSelector.MailboxPlanId), @@ -187,6 +195,15 @@ namespace WebsitePanel.Portal.ExchangeServer } } + if (sendToControl.SendEmail && IsNewUser) + { + ES.Services.Organizations.SendUserPasswordRequestEmail(PanelRequest.ItemID, accountId, "User creation", sendToControl.Email, true); + } + else if (sendToControl.SendMobile && IsNewUser) + { + ES.Services.Organizations.SendUserPasswordRequestSms(PanelRequest.ItemID, accountId, "User creation", sendToControl.Mobile); + } + Response.Redirect(EditUrl("AccountID", accountId.ToString(), "mailbox_settings", "SpaceID=" + PanelSecurity.PackageId.ToString(), "ItemID=" + PanelRequest.ItemID.ToString())); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.designer.cs index 013a6f68..f49d06f1 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/ExchangeCreateMailbox.ascx.designer.cs @@ -228,6 +228,24 @@ namespace WebsitePanel.Portal.ExchangeServer { /// protected global::WebsitePanel.Portal.ExchangeServer.UserControls.EmailAddress email; + /// + /// sendToControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SendToControl sendToControl; + + /// + /// PasswordBlock control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow PasswordBlock; + /// /// locPassword control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationCreateUser.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationCreateUser.ascx index a69cef4f..8f4282d1 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationCreateUser.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationCreateUser.ascx @@ -5,106 +5,122 @@ <%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> <%@ Register Src="../UserControls/QuotaViewer.ascx" TagName="QuotaViewer" TagPrefix="wsp" %> <%@ Register Src="../UserControls/EmailControl.ascx" TagName="EmailControl" TagPrefix="wsp" %> +<%@ Register Src="../UserControls/SendToControl.ascx" TagName="SendToControl" TagPrefix="wsp" %>
- + if (document.getElementById("<%= txtLastName.ClientID %>").value != '') + document.getElementById("<%= txtDisplayName.ClientID %>").value = document.getElementById("<%= txtDisplayName.ClientID %>").value + document.getElementById("<%= txtLastName.ClientID %>").value; + } +
-
-
-
-
-
-
- - -
-
- - - - - + + + + + + + + + + + + + + + + + + + + + + + + +
- -   +
+
+
+
+
+
+ + +
+ + +
+ + + + + - - - - - - - - - - - - - - - - - - - - - - -
+ + +   - -
- -
- - -
- - -
- - -
- - - -
+ +
+ + +
+ + + +
+ + + +
+ + + +
+ +
+ + + + +
- - - - - -
- -
- -
- - + + + + + + +
+ + +
-
-
-
-
-
\ No newline at end of file + + +
+ + +
+ + + + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationCreateUser.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationCreateUser.ascx.cs index 217ac7f0..9bb7ba68 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationCreateUser.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationCreateUser.ascx.cs @@ -27,6 +27,7 @@ // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. using System; +using System.Web.Security; using WebsitePanel.EnterpriseServer; using WebsitePanel.Providers.ResultObjects; using WebsitePanel.Providers.HostedSolution; @@ -98,10 +99,17 @@ namespace WebsitePanel.Portal.HostedSolution try { + var passwordString = password.Password; + + if (sendToControl.IsRequestSend) + { + passwordString = Membership.GeneratePassword(16, 3); + } + int accountId = ES.Services.Organizations.CreateUser(PanelRequest.ItemID, txtDisplayName.Text.Trim(), email.AccountName.ToLower(), email.DomainName.ToLower(), - password.Password, + passwordString, txtSubscriberNumber.Text.Trim(), chkSendInstructions.Checked, sendInstructionEmail.Text); @@ -119,6 +127,15 @@ namespace WebsitePanel.Portal.HostedSolution } } + if (sendToControl.SendEmail) + { + ES.Services.Organizations.SendUserPasswordRequestEmail(PanelRequest.ItemID, accountId, "User creation", sendToControl.Email, true); + } + else if (sendToControl.SendMobile) + { + ES.Services.Organizations.SendUserPasswordRequestSms(PanelRequest.ItemID, accountId, "User creation", sendToControl.Mobile); + } + Response.Redirect(EditUrl("AccountID", accountId.ToString(), "edit_user", "SpaceID=" + PanelSecurity.PackageId, "ItemID=" + PanelRequest.ItemID, diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationCreateUser.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationCreateUser.ascx.designer.cs index 727d7527..38dfdde8 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationCreateUser.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ExchangeServer/OrganizationCreateUser.ascx.designer.cs @@ -48,6 +48,15 @@ namespace WebsitePanel.Portal.HostedSolution { ///
protected global::System.Web.UI.WebControls.Localize locTitle; + /// + /// CreateUserUpdatePanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.UpdatePanel CreateUserUpdatePanel; + /// /// messageBox control. /// @@ -183,6 +192,24 @@ namespace WebsitePanel.Portal.HostedSolution { ///
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.EmailAddress email; + /// + /// sendToControl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SendToControl sendToControl; + + /// + /// PasswordBlock control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow PasswordBlock; + /// /// locPassword control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Login.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Login.ascx.cs index 866f8426..2846d625 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Login.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Login.ascx.cs @@ -186,6 +186,11 @@ namespace WebsitePanel.Portal { ShowWarningMessage("WrongLogin"); } + else if (loginStatus == BusinessSuccessCodes.SUCCESS_USER_ONETIMEPASSWORD) + { + // One time password should be changed after login + Response.Redirect(EditUrl("UserID", PanelSecurity.LoggedUserId.ToString(), "change_onetimepassword", "onetimepassword=true"), true); + } else { // redirect by shortcut diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSCollections.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSCollections.ascx.resx index 3a2deaac..fe45f728 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSCollections.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSCollections.ascx.resx @@ -150,4 +150,7 @@ Total Remote Desktop Collections Created: + + Import RDS Collection + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSImportCollection.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSImportCollection.ascx.resx new file mode 100644 index 00000000..46f650df --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/App_LocalResources/RDSImportCollection.ascx.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Import + + + Import RDSCollection + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx index a5369d97..37e1deae 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx @@ -22,6 +22,8 @@
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx.cs index 3ca6445f..7fc90d67 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx.cs @@ -30,6 +30,7 @@ using System; using System.Linq; using System.Web.UI.WebControls; using WebsitePanel.EnterpriseServer; +using WebsitePanel.EnterpriseServer.Base.RDS; using WebsitePanel.Providers.Common; using WebsitePanel.Providers.HostedSolution; using WebsitePanel.Providers.OS; @@ -53,6 +54,14 @@ namespace WebsitePanel.Portal.RDS { btnAddCollection.Enabled = (!(cntx.Quotas[Quotas.RDS_COLLECTIONS].QuotaAllocatedValue <= gvRDSCollections.Rows.Count) || (cntx.Quotas[Quotas.RDS_COLLECTIONS].QuotaAllocatedValue == -1)); } + + var defaultSettings = ES.Services.Users.GetUserSettings(PanelSecurity.EffectiveUserId, UserSettings.RDS_POLICY); + var allowImport = Convert.ToBoolean(defaultSettings[RdsServerSettings.ALLOWCONNECTIONSIMPORT]); + + if (!allowImport) + { + btnImportCollection.Visible = false; + } } private void BindQuota(PackageContext cntx) @@ -83,6 +92,12 @@ namespace WebsitePanel.Portal.RDS "SpaceID=" + PanelSecurity.PackageId)); } + protected void btnImportCollection_Click(object sender, EventArgs e) + { + Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "rds_import_collection", + "SpaceID=" + PanelSecurity.PackageId)); + } + protected void gvRDSCollections_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteItem") diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx.designer.cs index 44424f9b..92aaed71 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCollections.ascx.designer.cs @@ -57,6 +57,15 @@ namespace WebsitePanel.Portal.RDS { /// protected global::System.Web.UI.WebControls.Button btnAddCollection; + /// + /// btnImportCollection control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnImportCollection; + /// /// SearchPanel control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx index 9549a550..afaa344b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSCreateCollection.ascx @@ -15,7 +15,7 @@
- +
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSImportCollection.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSImportCollection.ascx new file mode 100644 index 00000000..b6a58e70 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSImportCollection.ascx @@ -0,0 +1,38 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RDSImportCollection.ascx.cs" Inherits="WebsitePanel.Portal.RDS.RDSImportCollection" %> +<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %> +<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../UserControls/CollapsiblePanel.ascx" %> + +<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %> + + +
+
+
+
+
+
+
+ + +
+
+ + + + + + + +
+ + +
+ +
+ +
+
+
+
+
+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSImportCollection.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSImportCollection.ascx.cs new file mode 100644 index 00000000..8a5ff1b7 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSImportCollection.ascx.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace WebsitePanel.Portal.RDS +{ + public partial class RDSImportCollection : WebsitePanelModuleBase + { + protected void Page_Load(object sender, EventArgs e) + { + + } + + protected void btnSave_Click(object sender, EventArgs e) + { + if (!Page.IsValid) + { + return; + } + + try + { + ES.Services.RDS.ImportCollection(PanelRequest.ItemID, txtCollectionName.Text); + Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "rds_collections", "SpaceID=" + PanelSecurity.PackageId)); + } + catch (Exception ex) + { + ShowErrorMessage("RDSCOLLECTION_NOT_IMPORTED", ex); + } + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSImportCollection.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSImportCollection.ascx.designer.cs new file mode 100644 index 00000000..0a5d18e3 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/RDS/RDSImportCollection.ascx.designer.cs @@ -0,0 +1,78 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.RDS { + + + public partial class RDSImportCollection { + + /// + /// imgAddRDSServer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Image imgAddRDSServer; + + /// + /// locTitle control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locTitle; + + /// + /// messageBox control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox; + + /// + /// locCollectionName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locCollectionName; + + /// + /// txtCollectionName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtCollectionName; + + /// + /// valCollectionName control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator valCollectionName; + + /// + /// btnSave control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button btnSave; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx index 1f3300e5..a197dc73 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx @@ -180,4 +180,15 @@
- \ No newline at end of file + + + + + + + +
+ +
+
+
diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.cs index 3e28ef23..e4cb2829 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.cs @@ -53,6 +53,7 @@ namespace WebsitePanel.Portal cbDisableCmdUsers.Checked = Convert.ToBoolean(settings[RdsServerSettings.DISABLE_CMD_USERS]); ddTreshold.SelectedValue = settings[RdsServerSettings.DRIVE_SPACE_THRESHOLD_VALUE]; + cbAllowImport.Checked = Convert.ToBoolean(settings[RdsServerSettings.ALLOWCONNECTIONSIMPORT]); } public void SaveSettings(UserSettings settings) @@ -81,6 +82,7 @@ namespace WebsitePanel.Portal settings[RdsServerSettings.RDS_CONTROL_WITHOUT_PERMISSION_Users] = cbControlSessionUsers.Checked.ToString(); settings[RdsServerSettings.DISABLE_CMD_ADMINISTRATORS] = cbDisableCmdAdministrators.Checked.ToString(); settings[RdsServerSettings.DISABLE_CMD_USERS] = cbDisableCmdUsers.Checked.ToString(); + settings[RdsServerSettings.ALLOWCONNECTIONSIMPORT] = cbAllowImport.Checked.ToString(); } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.designer.cs index 9ecc5ff4..d1eea2a7 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsRdsPolicy.ascx.designer.cs @@ -443,5 +443,32 @@ namespace WebsitePanel.Portal { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBox cbDisableCmdAdministrators; + + /// + /// secAllowImport control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::WebsitePanel.Portal.CollapsiblePanel secAllowImport; + + /// + /// allowImportPanel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Panel allowImportPanel; + + /// + /// cbAllowImport control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbAllowImport; } } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsUserPasswordRequestLetter.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsUserPasswordRequestLetter.ascx new file mode 100644 index 00000000..a8eb6054 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsUserPasswordRequestLetter.ascx @@ -0,0 +1,55 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SettingsUserPasswordRequestLetter.ascx.cs" Inherits="WebsitePanel.Portal.SettingsUserPasswordRequestLetter" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + High + Normal + Low + +
+


+


+


+
\ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsUserPasswordRequestLetter.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsUserPasswordRequestLetter.ascx.cs new file mode 100644 index 00000000..7a1e2596 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsUserPasswordRequestLetter.ascx.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using WebsitePanel.EnterpriseServer; + +namespace WebsitePanel.Portal +{ + public partial class SettingsUserPasswordRequestLetter : WebsitePanelControlBase, IUserSettingsEditorControl + { + public void BindSettings(UserSettings settings) + { + txtFrom.Text = settings["From"]; + txtSubject.Text = settings["Subject"]; + Utils.SelectListItem(ddlPriority, settings["Priority"]); + txtHtmlBody.Text = settings["HtmlBody"]; + txtTextBody.Text = settings["TextBody"]; + txtLogoUrl.Text = settings["LogoUrl"]; + + txtSmsBody.Text = settings["SMSBody"]; + } + + public void SaveSettings(UserSettings settings) + { + settings["From"] = txtFrom.Text; + settings["Subject"] = txtSubject.Text; + settings["Priority"] = ddlPriority.SelectedValue; + settings["HtmlBody"] = txtHtmlBody.Text; + settings["TextBody"] = txtTextBody.Text; + settings["LogoUrl"] = txtLogoUrl.Text; + + settings["SMSBody"] = txtSmsBody.Text; + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsUserPasswordRequestLetter.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsUserPasswordRequestLetter.ascx.designer.cs new file mode 100644 index 00000000..69efede1 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/SettingsUserPasswordRequestLetter.ascx.designer.cs @@ -0,0 +1,141 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal { + + + public partial class SettingsUserPasswordRequestLetter { + + /// + /// lblFrom control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblFrom; + + /// + /// txtFrom control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtFrom; + + /// + /// lblSubject control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblSubject; + + /// + /// txtSubject control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtSubject; + + /// + /// lblPriority control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblPriority; + + /// + /// ddlPriority control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlPriority; + + /// + /// lblLogoUrl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblLogoUrl; + + /// + /// txtLogoUrl control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtLogoUrl; + + /// + /// lblHtmlBody control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblHtmlBody; + + /// + /// txtHtmlBody control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtHtmlBody; + + /// + /// lblTextBody control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblTextBody; + + /// + /// txtTextBody control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtTextBody; + + /// + /// lblSmsBody control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblSmsBody; + + /// + /// txtSmsBody control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtSmsBody; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountChangePassword.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountChangePassword.ascx.cs index 81c68ccf..9b260aee 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountChangePassword.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountChangePassword.ascx.cs @@ -80,6 +80,11 @@ namespace WebsitePanel.Portal if (!String.IsNullOrEmpty(changePasswordWarningText)) lblChangePasswordWarning.Text = changePasswordWarningText; } + + if (PanelRequest.GetBool("onetimepassword")) + { + ShowWarningMessage("USER_SHOULD_CHANGE_ONETIMEPASSWORD"); + } } catch (Exception ex) { diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountMailTemplateSettings.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountMailTemplateSettings.ascx index dd09fdc8..8351143e 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountMailTemplateSettings.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountMailTemplateSettings.ascx @@ -54,6 +54,10 @@ +
  • + +
  • diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountMailTemplateSettings.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountMailTemplateSettings.ascx.designer.cs index a5217667..ded9a986 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountMailTemplateSettings.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserAccountMailTemplateSettings.ascx.designer.cs @@ -129,6 +129,15 @@ namespace WebsitePanel.Portal { /// protected global::System.Web.UI.WebControls.HyperLink lnkOrganizationUserPasswordResetPincodeLetter; + /// + /// HyperLink3 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.HyperLink HyperLink3; + /// /// btnCancel control. /// diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/SendToControl.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/SendToControl.ascx.resx new file mode 100644 index 00000000..9e07a1dd --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/App_LocalResources/SendToControl.ascx.resx @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Send Password Reset Email + + + Save as user mobile + + + Email: * + + + Mobile: * + + + Reason: + + + Send to: + + + Reset Password + + + Email + + + Mobile + + + Send Password Request + + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/SendToControl.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/SendToControl.ascx new file mode 100644 index 00000000..544b2091 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/SendToControl.ascx @@ -0,0 +1,52 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SendToControl.ascx.cs" Inherits="WebsitePanel.Portal.UserControls.SendToControl" %> + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +
    + + + + +
    + + + + +
    + + +
    + +
    \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/SendToControl.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/SendToControl.ascx.cs new file mode 100644 index 00000000..92eea906 --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/SendToControl.ascx.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace WebsitePanel.Portal.UserControls +{ + public partial class SendToControl : WebsitePanelControlBase + { + public string ValidationGroup + { + get { return valEmailAddress.ValidationGroup; } + set + { + valEmailAddress.ValidationGroup = value; + regexEmailValid.ValidationGroup = value; + valMobile.ValidationGroup = value; + regexMobileValid.ValidationGroup = value; + } + } + + public bool IsRequestSend + { + get { return chkSendPasswordResetEmail.Checked; } + } + + public bool SendEmail + { + get { return chkSendPasswordResetEmail.Checked && rbtnEmail.Checked; } + } + + public bool SendMobile + { + get { return chkSendPasswordResetEmail.Checked && rbtnMobile.Checked; } + } + + public string Email + { + get { return txtEmailAddress.Text; } + } + + public string Mobile + { + get { return txtMobile.Text; } + } + + public string ControlToHide { get; set; } + + protected void SendToGroupCheckedChanged(object sender, EventArgs e) + { + EmailRow.Visible = rbtnEmail.Checked; + MobileRow.Visible = !rbtnEmail.Checked; + } + + protected void chkSendPasswordResetEmail_StateChanged(object sender, EventArgs e) + { + SendToBody.Visible = chkSendPasswordResetEmail.Checked; + + if (!string.IsNullOrEmpty(ControlToHide)) + { + var control = Parent.FindControl(ControlToHide); + + if (control != null) + { + control.Visible = !chkSendPasswordResetEmail.Checked; + } + } + } + + protected void Page_Load(object sender, EventArgs e) + { + var isTwilioEnabled = ES.Services.System.CheckIsTwilioEnabled(); + + rbtnMobile.Visible = isTwilioEnabled; + + if (!Page.IsPostBack) + { + if (isTwilioEnabled) + { + rbtnMobile.Checked = true; + rbtnEmail.Checked = false; + SendToGroupCheckedChanged(null, null); + } + + chkSendPasswordResetEmail_StateChanged(null, null); + } + } + } +} \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/SendToControl.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/SendToControl.ascx.designer.cs new file mode 100644 index 00000000..abb80d9b --- /dev/null +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/UserControls/SendToControl.ascx.designer.cs @@ -0,0 +1,159 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WebsitePanel.Portal.UserControls { + + + public partial class SendToControl { + + /// + /// chkSendPasswordResetEmail control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkSendPasswordResetEmail; + + /// + /// SendToBody control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl SendToBody; + + /// + /// locSendTo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locSendTo; + + /// + /// rbtnEmail control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RadioButton rbtnEmail; + + /// + /// rbtnMobile control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RadioButton rbtnMobile; + + /// + /// EmailRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow EmailRow; + + /// + /// locEmailAddress control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locEmailAddress; + + /// + /// txtEmailAddress control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtEmailAddress; + + /// + /// valEmailAddress control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator valEmailAddress; + + /// + /// regexEmailValid control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RegularExpressionValidator regexEmailValid; + + /// + /// MobileRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlTableRow MobileRow; + + /// + /// locMobile control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Localize locMobile; + + /// + /// txtMobile control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtMobile; + + /// + /// valMobile control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RequiredFieldValidator valMobile; + + /// + /// regexMobileValid control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.RegularExpressionValidator regexMobileValid; + + /// + /// divWrapper control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl divWrapper; + } +} diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj index 3d5054ea..e6c1c930 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/WebsitePanel.Portal.Modules.csproj @@ -332,6 +332,27 @@ HostedSharePointEnterpriseStorageUsage.ascx + + RDSImportCollection.ascx + ASPXCodeBehind + + + RDSImportCollection.ascx + + + SettingsUserPasswordRequestLetter.ascx + ASPXCodeBehind + + + SettingsUserPasswordRequestLetter.ascx + + + SendToControl.ascx + ASPXCodeBehind + + + SendToControl.ascx + VpsMenu.ascx ASPXCodeBehind @@ -4901,6 +4922,9 @@ + + + @@ -5026,6 +5050,9 @@ Designer + + Designer + @@ -5066,6 +5093,7 @@ + ResXFileCodeGenerator DomainLookupView.ascx.Designer.cs @@ -5225,6 +5253,7 @@ + Designer