Sharepoint UI fixes

This commit is contained in:
vfedosevich 2015-04-07 01:40:40 -07:00
parent c6022ac4be
commit 44587a35c8
7 changed files with 62 additions and 48 deletions

View file

@ -376,9 +376,12 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
AddComputerToCollectionAdComputerGroup(organizationId, collection.Name, rdsServer); AddComputerToCollectionAdComputerGroup(organizationId, collection.Name, rdsServer);
} }
CreatePolicy(runSpace, organizationId, string.Format("{0}-administrators", collection.Name), new DirectoryEntry(GetGroupPath(organizationId, collection.Name, GetLocalAdminsGroupName(collection.Name))), collection.Name); string collectionComputersPath = GetComputerGroupPath(organizationId, collection.Name);
CreatePolicy(runSpace, organizationId, string.Format("{0}-users", collection.Name), new DirectoryEntry(GetUsersGroupPath(organizationId, collection.Name)), collection.Name); CreatePolicy(runSpace, organizationId, string.Format("{0}-administrators", collection.Name),
CreateHelpDeskPolicy(runSpace, new DirectoryEntry(GetHelpDeskGroupPath(RDSHelpDeskGroup)), organizationId, 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);
} }
finally finally
{ {
@ -1142,10 +1145,13 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
try try
{ {
runspace = OpenRunspace(); runspace = OpenRunspace();
string collectionComputersPath = GetComputerGroupPath(organizationId, collectionName);
CreatePolicy(runspace, organizationId, string.Format("{0}-administrators", collectionName), new DirectoryEntry(GetGroupPath(organizationId, collectionName, GetLocalAdminsGroupName(collectionName))), collectionName); CreatePolicy(runspace, organizationId, string.Format("{0}-administrators", collectionName),
CreatePolicy(runspace, organizationId, string.Format("{0}-users", collectionName), new DirectoryEntry(GetUsersGroupPath(organizationId, collectionName)), collectionName); new DirectoryEntry(GetGroupPath(organizationId, collectionName, GetLocalAdminsGroupName(collectionName))), new DirectoryEntry(collectionComputersPath), collectionName);
CreateHelpDeskPolicy(runspace, new DirectoryEntry(GetHelpDeskGroupPath(RDSHelpDeskGroup)), organizationId, collectionName); CreatePolicy(runspace, organizationId, string.Format("{0}-users", collectionName),
new DirectoryEntry(GetUsersGroupPath(organizationId, collectionName)), new DirectoryEntry(collectionComputersPath), collectionName);
CreateHelpDeskPolicy(runspace, new DirectoryEntry(GetHelpDeskGroupPath(RDSHelpDeskGroup)), new DirectoryEntry(collectionComputersPath), organizationId, collectionName);
RemoveRegistryValue(runspace, ScreenSaverGpoKey, administratorsGpo); RemoveRegistryValue(runspace, ScreenSaverGpoKey, administratorsGpo);
RemoveRegistryValue(runspace, ScreenSaverGpoKey, usersGpo); RemoveRegistryValue(runspace, ScreenSaverGpoKey, usersGpo);
RemoveRegistryValue(runspace, RemoveRestartGpoKey, administratorsGpo); RemoveRegistryValue(runspace, RemoveRestartGpoKey, administratorsGpo);
@ -1299,7 +1305,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
Collection<PSObject> result = ExecuteRemoteShellCommand(runspace, PrimaryDomainController, cmd); Collection<PSObject> result = ExecuteRemoteShellCommand(runspace, PrimaryDomainController, cmd);
} }
private void CreateHelpDeskPolicy(Runspace runspace, DirectoryEntry entry, string organizationId, string collectionName) private void CreateHelpDeskPolicy(Runspace runspace, DirectoryEntry entry, DirectoryEntry collectionComputersEntry, string organizationId, string collectionName)
{ {
string gpoName = string.Format("{0}-HelpDesk", collectionName); string gpoName = string.Format("{0}-HelpDesk", collectionName);
string gpoId = GetPolicyId(runspace, gpoName); string gpoId = GetPolicyId(runspace, gpoName);
@ -1307,19 +1313,19 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
if (string.IsNullOrEmpty(gpoId)) if (string.IsNullOrEmpty(gpoId))
{ {
gpoId = CreateAndLinkPolicy(runspace, gpoName, organizationId, collectionName); gpoId = CreateAndLinkPolicy(runspace, gpoName, organizationId, collectionName);
SetPolicyPermissions(runspace, gpoName, entry); SetPolicyPermissions(runspace, gpoName, entry, collectionComputersEntry);
SetRegistryValue(runspace, RDSSessionGpoKey, gpoName, "2", RDSSessionGpoValueName, "DWord"); SetRegistryValue(runspace, RDSSessionGpoKey, gpoName, "2", RDSSessionGpoValueName, "DWord");
} }
} }
private string CreatePolicy(Runspace runspace, string organizationId, string gpoName, DirectoryEntry entry, string collectionName) private string CreatePolicy(Runspace runspace, string organizationId, string gpoName, DirectoryEntry entry, DirectoryEntry collectionComputersEntry, string collectionName)
{ {
string gpoId = GetPolicyId(runspace, gpoName); string gpoId = GetPolicyId(runspace, gpoName);
if (string.IsNullOrEmpty(gpoId)) if (string.IsNullOrEmpty(gpoId))
{ {
gpoId = CreateAndLinkPolicy(runspace, gpoName, organizationId, collectionName); gpoId = CreateAndLinkPolicy(runspace, gpoName, organizationId, collectionName);
SetPolicyPermissions(runspace, gpoName, entry); SetPolicyPermissions(runspace, gpoName, entry, collectionComputersEntry);
} }
return gpoId; return gpoId;
@ -1339,12 +1345,13 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
Collection<PSObject> result = ExecuteRemoteShellCommand(runspace, PrimaryDomainController, cmd); Collection<PSObject> result = ExecuteRemoteShellCommand(runspace, PrimaryDomainController, cmd);
} }
private void SetPolicyPermissions(Runspace runspace, string gpoName, DirectoryEntry entry) private void SetPolicyPermissions(Runspace runspace, string gpoName, DirectoryEntry entry, DirectoryEntry collectionComputersEntry)
{ {
var scripts = new List<string> var scripts = new List<string>
{ {
string.Format("Set-GPPermissions -Name {0} -Replace -PermissionLevel None -TargetName 'Authenticated Users' -TargetType group", gpoName), string.Format("Set-GPPermissions -Name {0} -Replace -PermissionLevel None -TargetName 'Authenticated Users' -TargetType group", gpoName),
string.Format("Set-GPPermissions -Name {0} -PermissionLevel gpoapply -TargetName {1} -TargetType group", gpoName, string.Format("'{0}'", ActiveDirectoryUtils.GetADObjectProperty(entry, "sAMAccountName").ToString())) string.Format("Set-GPPermissions -Name {0} -PermissionLevel gpoapply -TargetName {1} -TargetType group", gpoName, string.Format("'{0}'", ActiveDirectoryUtils.GetADObjectProperty(entry, "sAMAccountName").ToString())),
string.Format("Set-GPPermissions -Name {0} -PermissionLevel gpoapply -TargetName {1} -TargetType group", gpoName, string.Format("'{0}'", ActiveDirectoryUtils.GetADObjectProperty(collectionComputersEntry, "sAMAccountName").ToString()))
}; };
object[] errors = null; object[] errors = null;

View file

@ -180,8 +180,8 @@
<data name="lblOCSUsers.Text" xml:space="preserve"> <data name="lblOCSUsers.Text" xml:space="preserve">
<value>OCS Users:</value> <value>OCS Users:</value>
</data> </data>
<data name="lblSharepointSites" xml:space="preserve"> <data name="lblSharepointSites.Text" xml:space="preserve">
<value>Sharepoint Sites:</value> <value>Sharepoint Foundation Sites:</value>
</data> </data>
<data name="lblUserAccounts.Text" xml:space="preserve"> <data name="lblUserAccounts.Text" xml:space="preserve">
<value>User Accounts:</value> <value>User Accounts:</value>
@ -210,4 +210,7 @@
<data name="lblDeletedUsers.Text" xml:space="preserve"> <data name="lblDeletedUsers.Text" xml:space="preserve">
<value>Deleted Users:</value> <value>Deleted Users:</value>
</data> </data>
<data name="lblEnterpriseSharepointSites.Text" xml:space="preserve">
<value>Sharepoint Server Sites:</value>
</data>
</root> </root>

View file

@ -238,6 +238,6 @@
<value>RDS Users</value> <value>RDS Users</value>
</data> </data>
<data name="locSharePointEnterprise.Text" xml:space="preserve"> <data name="locSharePointEnterprise.Text" xml:space="preserve">
<value>SharePoint Enterprise</value> <value>SharePoint Server</value>
</data> </data>
</root> </root>

View file

@ -63,10 +63,10 @@
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:BoundField DataField="Address" HeaderText="IP Address"><ItemStyle Width="10%"/></asp:BoundField> <asp:BoundField DataField="Address" HeaderText="IP Address"><ItemStyle Width="10%"/></asp:BoundField>
<asp:BoundField DataField="ItemName" HeaderText="Organization"><ItemStyle Width="10%"/></asp:BoundField> <asp:BoundField DataField="ItemName" HeaderText="Organization"><ItemStyle Width="20%"/></asp:BoundField>
<asp:BoundField DataField="Description" HeaderText="Comments"><ItemStyle Width="20%"/></asp:BoundField> <asp:BoundField DataField="Description" HeaderText="Comments"><ItemStyle Width="15%"/></asp:BoundField>
<asp:TemplateField meta:resourcekey="gvPopupStatus"> <asp:TemplateField meta:resourcekey="gvPopupStatus">
<ItemStyle Width="20%" HorizontalAlign="Left" /> <ItemStyle Width="15%" HorizontalAlign="Left" />
<ItemTemplate> <ItemTemplate>
<asp:Literal ID="litStatus" runat="server" Text='<%# Eval("Status") %>'></asp:Literal> <asp:Literal ID="litStatus" runat="server" Text='<%# Eval("Status") %>'></asp:Literal>
<asp:HiddenField ID="hdnRdsCollectionId" runat="server" Value='<%# Eval("RdsCollectionId") %>' /> <asp:HiddenField ID="hdnRdsCollectionId" runat="server" Value='<%# Eval("RdsCollectionId") %>' />

View file

@ -71,9 +71,13 @@
<td class="Normal"><wsp:Quota ID="quotaBlackBerryUsers" runat="server" QuotaName="BlackBerry.Users" DisplayGauge="True" /></td> <td class="Normal"><wsp:Quota ID="quotaBlackBerryUsers" runat="server" QuotaName="BlackBerry.Users" DisplayGauge="True" /></td>
</tr> </tr>
<tr ID="pnlSharepointSites" runat="server"> <tr ID="pnlSharepointSites" runat="server">
<td class="SubHead" nowrap><asp:Label ID="lblSharepointSites" runat="server" meta:resourcekey="lblSharepointSites" Text="Sharepoint Sites:"></asp:Label></td> <td class="SubHead" nowrap><asp:Label ID="lblSharepointSites" runat="server" meta:resourcekey="lblSharepointSites" Text="Sharepoint Foundation Sites:"></asp:Label></td>
<td class="Normal"><wsp:Quota ID="quotaSharepointSites" runat="server" QuotaName="HostedSharePoint.Sites" DisplayGauge="True" /></td> <td class="Normal"><wsp:Quota ID="quotaSharepointSites" runat="server" QuotaName="HostedSharePoint.Sites" DisplayGauge="True" /></td>
</tr> </tr>
<tr ID="pnlEnterpriseSharepointSites" runat="server">
<td class="SubHead" nowrap><asp:Label ID="lblEnterpriseSharepointSites" runat="server" meta:resourcekey="lblEnterpriseSharepointSites" Text="Sharepoint Sites:"></asp:Label></td>
<td class="Normal"><wsp:Quota ID="quotaEnterpriseSharepointSites" runat="server" QuotaName="HostedSharePointEnterprise.Sites" DisplayGauge="True" /></td>
</tr>
<tr ID="pnlWebSites" runat="server"> <tr ID="pnlWebSites" runat="server">
<td class="SubHead" nowrap><asp:Label ID="lblWebSites" runat="server" meta:resourcekey="lblWebSites" Text="Web Sites:"></asp:Label></td> <td class="SubHead" nowrap><asp:Label ID="lblWebSites" runat="server" meta:resourcekey="lblWebSites" Text="Web Sites:"></asp:Label></td>
<td class="Normal"><wsp:Quota ID="quotaWebSites" runat="server" QuotaName="Web.Sites" DisplayGauge="True" /></td> <td class="Normal"><wsp:Quota ID="quotaWebSites" runat="server" QuotaName="Web.Sites" DisplayGauge="True" /></td>

View file

@ -73,7 +73,8 @@ namespace WebsitePanel.Portal
{ "quotaFtpAccounts", "pnlFtpAccounts" }, { "quotaFtpAccounts", "pnlFtpAccounts" },
{ "quotaExchangeStorage", "pnlExchangeStorage" }, { "quotaExchangeStorage", "pnlExchangeStorage" },
{ "quotaNumberOfFolders", "pnlFolders" }, { "quotaNumberOfFolders", "pnlFolders" },
{ "quotaEnterpriseStorage", "pnlEnterpriseStorage" } { "quotaEnterpriseStorage", "pnlEnterpriseStorage" },
{ "quotaEnterpriseSharepointSites", "pnlEnterpriseSharepointSites"}
}; };
protected void Page_Load(object sender, EventArgs e) protected void Page_Load(object sender, EventArgs e)

View file

@ -1,31 +1,3 @@
// 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.
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
@ -454,6 +426,33 @@ namespace WebsitePanel.Portal {
/// </remarks> /// </remarks>
protected global::WebsitePanel.Portal.Quota quotaSharepointSites; protected global::WebsitePanel.Portal.Quota quotaSharepointSites;
/// <summary>
/// pnlEnterpriseSharepointSites control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlTableRow pnlEnterpriseSharepointSites;
/// <summary>
/// lblEnterpriseSharepointSites control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblEnterpriseSharepointSites;
/// <summary>
/// quotaEnterpriseSharepointSites control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.Quota quotaEnterpriseSharepointSites;
/// <summary> /// <summary>
/// pnlWebSites control. /// pnlWebSites control.
/// </summary> /// </summary>