Merge
This commit is contained in:
commit
7f3f8b1973
5 changed files with 69 additions and 17 deletions
|
@ -667,7 +667,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
var collectionSettings = ObjectUtils.FillObjectFromDataReader<RdsCollectionSettings>(DataProvider.GetRdsCollectionSettingsByCollectionId(collectionId));
|
||||
collection.Settings = collectionSettings;
|
||||
|
||||
var result = TaskManager.StartResultTask<ResultObject>("REMOTE_DESKTOP_SERVICES", "ADD_RDS_COLLECTION");
|
||||
var result = TaskManager.StartResultTask<ResultObject>("REMOTE_DESKTOP_SERVICES", "GET_RDS_COLLECTION");
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -682,13 +682,23 @@ namespace WebsitePanel.EnterpriseServer
|
|||
var rds = RemoteDesktopServicesHelpers.GetRemoteDesktopServices(RemoteDesktopServicesHelpers.GetRemoteDesktopServiceID(org.PackageId));
|
||||
|
||||
rds.GetCollection(collection.Name);
|
||||
FillRdsCollection(collection);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.AddError("REMOTE_DESKTOP_SERVICES_ADD_RDS_COLLECTION", ex);
|
||||
}
|
||||
|
||||
FillRdsCollection(collection);
|
||||
finally
|
||||
{
|
||||
if (!result.IsSuccess)
|
||||
{
|
||||
TaskManager.CompleteResultTask(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
TaskManager.CompleteResultTask();
|
||||
}
|
||||
}
|
||||
|
||||
return collection;
|
||||
}
|
||||
|
@ -2043,6 +2053,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
private static string GetRdsServerStatusInternal(int? itemId, string fqdnName)
|
||||
{
|
||||
return "Online";
|
||||
|
||||
var result = "Unavailable";
|
||||
var serviceId = GetRdsServiceId(itemId);
|
||||
|
||||
|
|
|
@ -3100,13 +3100,21 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
|||
|
||||
private string GetRdsServerStatus (Runspace runspace, string serverName)
|
||||
{
|
||||
Log.WriteWarning(string.Format("CheckServerAvailability started"));
|
||||
|
||||
if (CheckServerAvailability(serverName))
|
||||
{
|
||||
{
|
||||
Log.WriteWarning(string.Format("Pending reboot check started"));
|
||||
|
||||
if (CheckPendingReboot(runspace, serverName))
|
||||
{
|
||||
Log.WriteWarning(string.Format("Pending reboot check finished"));
|
||||
|
||||
return "Online - Pending Reboot";
|
||||
}
|
||||
|
||||
Log.WriteWarning(string.Format("Pending reboot check finished"));
|
||||
|
||||
return "Online";
|
||||
}
|
||||
else
|
||||
|
|
|
@ -5865,6 +5865,9 @@
|
|||
<data name="ERROR.RDS_USERS_NOT_DELETED" xml:space="preserve">
|
||||
<value>Unable to remove the following user(s) since they are local admins or they were granted access to remote applications:</value>
|
||||
</data>
|
||||
<data name="ERROR.RDS_USERS_NOT_UPDATED" xml:space="preserve">
|
||||
<value>RDS Users updating error</value>
|
||||
</data>
|
||||
<data name="ERROR.REMOTE_DESKTOP_SERVICES_LOG_OFF_USER" xml:space="preserve">
|
||||
<value>RDS User logging off error</value>
|
||||
</data>
|
||||
|
|
|
@ -57,6 +57,17 @@ namespace WebsitePanel.Portal.RDS
|
|||
}
|
||||
|
||||
private void BindQuota()
|
||||
{
|
||||
var quota = GetQuota();
|
||||
|
||||
if (quota != null)
|
||||
{
|
||||
int rdsUsersCount = ES.Services.RDS.GetOrganizationRdsUsersCount(PanelRequest.ItemID);
|
||||
users.ButtonAddEnabled = (!(quota.QuotaAllocatedValue <= rdsUsersCount) || (quota.QuotaAllocatedValue == -1));
|
||||
}
|
||||
}
|
||||
|
||||
private QuotaValueInfo GetQuota()
|
||||
{
|
||||
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
|
||||
OrganizationStatistics stats = ES.Services.Organizations.GetOrganizationStatisticsByOrganization(PanelRequest.ItemID);
|
||||
|
@ -71,9 +82,10 @@ namespace WebsitePanel.Portal.RDS
|
|||
|
||||
if (cntx.Quotas.ContainsKey(Quotas.RDS_USERS))
|
||||
{
|
||||
int rdsUsersCount = ES.Services.RDS.GetOrganizationRdsUsersCount(PanelRequest.ItemID);
|
||||
users.ButtonAddEnabled = (!(cntx.Quotas[Quotas.RDS_USERS].QuotaAllocatedValue <= rdsUsersCount) || (cntx.Quotas[Quotas.RDS_USERS].QuotaAllocatedValue == -1));
|
||||
return cntx.Quotas[Quotas.RDS_USERS];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void OnRefreshClicked(object sender, EventArgs e)
|
||||
|
@ -83,19 +95,36 @@ namespace WebsitePanel.Portal.RDS
|
|||
|
||||
if (users.Any())
|
||||
{
|
||||
messageBox.Visible = true;
|
||||
messageBox.ShowErrorMessage("RDS_USERS_NOT_DELETED", new Exception(string.Join(", ", users)));
|
||||
}
|
||||
else
|
||||
{
|
||||
messageBox.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private bool SaveRdsUsers()
|
||||
{
|
||||
try
|
||||
{
|
||||
ES.Services.RDS.SetUsersToRdsCollection(PanelRequest.ItemID, PanelRequest.CollectionID, users.GetUsers());
|
||||
var quota = GetQuota();
|
||||
var rdsUsers = users.GetUsers();
|
||||
|
||||
if (quota.QuotaAllocatedValue == -1 || quota.QuotaAllocatedValue >= rdsUsers.Count())
|
||||
{
|
||||
messageBox.Visible = false;
|
||||
ES.Services.RDS.SetUsersToRdsCollection(PanelRequest.ItemID, PanelRequest.CollectionID, users.GetUsers());
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Too many RDS users added");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
messageBox.ShowErrorMessage(ex.Message);
|
||||
messageBox.Visible = true;
|
||||
messageBox.ShowErrorMessage("RDS_USERS_NOT_UPDATED", ex);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -155,6 +155,13 @@ namespace WebsitePanel.Portal.RDS.UserControls
|
|||
public List<string> CheckDeletedUsers()
|
||||
{
|
||||
var rdsUsers = GetGridViewUsers(SelectedState.Selected);
|
||||
var collectionUsers = ES.Services.RDS.GetRdsCollectionUsers(PanelRequest.CollectionID);
|
||||
|
||||
if (rdsUsers.All(r => !collectionUsers.Select(c => c.AccountName.ToLower()).Contains(r.AccountName.ToLower())))
|
||||
{
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
var localAdmins = ES.Services.RDS.GetRdsCollectionLocalAdmins(PanelRequest.CollectionID);
|
||||
var organizationUsers = ES.Services.Organizations.GetOrganizationUsersPaged(PanelRequest.ItemID, null, null, null, 0, Int32.MaxValue).PageUsers;
|
||||
var applicationUsers = ES.Services.RDS.GetApplicationUsers(PanelRequest.ItemID, PanelRequest.CollectionID, null);
|
||||
|
@ -219,14 +226,7 @@ namespace WebsitePanel.Portal.RDS.UserControls
|
|||
}
|
||||
|
||||
accounts = accounts.Where(x => !GetUsers().Select(p => p.AccountName).Contains(x.AccountName)).ToArray();
|
||||
Array.Sort(accounts, CompareAccount);
|
||||
if (Direction == SortDirection.Ascending)
|
||||
{
|
||||
Array.Reverse(accounts);
|
||||
Direction = SortDirection.Descending;
|
||||
}
|
||||
else
|
||||
Direction = SortDirection.Ascending;
|
||||
Array.Sort(accounts, CompareAccount);
|
||||
|
||||
gvPopupAccounts.DataSource = accounts;
|
||||
gvPopupAccounts.DataBind();
|
||||
|
@ -262,7 +262,7 @@ namespace WebsitePanel.Portal.RDS.UserControls
|
|||
}
|
||||
}
|
||||
|
||||
gvUsers.DataSource = users;
|
||||
gvUsers.DataSource = users.OrderBy(u => u.DisplayName);
|
||||
gvUsers.DataBind();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue