From dfc0e5e9c2b3d671fd79c4890894ee715b169f99 Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Wed, 11 Feb 2015 23:09:44 -0800 Subject: [PATCH 1/2] update_db.sql fixes --- WebsitePanel/Database/update_db.sql | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index c6c2da1a..2de0e662 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -5457,6 +5457,13 @@ CREATE TABLE RDSServers ) GO +IF NOT EXISTS(SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'RDSServers' AND COLUMN_NAME = 'ConnectionEnabled') +BEGIN + ALTER TABLE [dbo].[RDSServers] + ADD ConnectionEnabled BIT NOT NULL DEFAULT(1) +END +GO + IF NOT EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'RDSCollections') CREATE TABLE RDSCollections From 244a600d83a469229f247cec1918ae31b08ecb30 Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Thu, 12 Feb 2015 01:04:28 -0800 Subject: [PATCH 2/2] Fix for RDS Collection users --- .../Windows2012.cs | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs index 58d9ff9f..e6e8dba2 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.TerminalServices.Windows2012/Windows2012.cs @@ -988,34 +988,28 @@ namespace WebsitePanel.Providers.RemoteDesktopServices { var usersGroupName = GetUsersGroupName(collectionName); var usersGroupPath = GetUsersGroupPath(organizationId, collectionName); + var orgPath = GetOrganizationPath(organizationId); + var orgEntry = ActiveDirectoryUtils.GetADObject(orgPath); + var groupUsers = ActiveDirectoryUtils.GetGroupObjects(usersGroupName, "user", orgEntry); //remove all users from group - foreach (string userPath in ActiveDirectoryUtils.GetGroupObjects(usersGroupName, "user")) + foreach (string userPath in groupUsers) { - ActiveDirectoryUtils.RemoveObjectFromGroup(userPath, usersGroupPath); - } + ActiveDirectoryUtils.RemoveObjectFromGroup(userPath, usersGroupPath); + } //adding users to group foreach (var user in users) { - var userPath = GetUserPath(organizationId, user); - Log.WriteWarning(string.Format("User Path: {0}", userPath)); - Log.WriteWarning(string.Format("Group Name: {0}", usersGroupName)); + var userPath = GetUserPath(organizationId, user); if (ActiveDirectoryUtils.AdObjectExists(userPath)) { var userObject = ActiveDirectoryUtils.GetADObject(userPath); - var samName = (string)ActiveDirectoryUtils.GetADObjectProperty(userObject, "sAMAccountName"); - Log.WriteWarning(string.Format("SAMAccountName: {0}", samName)); - - if (!ActiveDirectoryUtils.IsUserInGroup(samName, usersGroupName)) - { - Log.WriteWarning(string.Format("{0} not exists in {1}", samName, usersGroupName)); - var userGroupsPath = GetUsersGroupPath(organizationId, collectionName); - ActiveDirectoryUtils.AddObjectToGroup(userPath, userGroupsPath); - Log.WriteWarning(string.Format("{0} added", samName)); - } - } + var samName = (string)ActiveDirectoryUtils.GetADObjectProperty(userObject, "sAMAccountName"); + var userGroupsPath = GetUsersGroupPath(organizationId, collectionName); + ActiveDirectoryUtils.AddObjectToGroup(userPath, userGroupsPath); + } } }