RDS provider + controller
This commit is contained in:
parent
d01ec8ac44
commit
2e97811d33
21 changed files with 7552 additions and 117 deletions
|
@ -2403,7 +2403,7 @@ INSERT [dbo].[ResourceGroups] ([GroupID], [GroupName], [GroupOrder], [GroupContr
|
|||
END
|
||||
GO
|
||||
|
||||
-- RDS Quota
|
||||
-- RDS Quotas
|
||||
|
||||
IF NOT EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaName] = 'RDS.Users')
|
||||
BEGIN
|
||||
|
@ -2411,6 +2411,12 @@ INSERT [dbo].[Quotas] ([QuotaID], [GroupID],[QuotaOrder], [QuotaName], [QuotaDe
|
|||
END
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaName] = 'RDS.Servers')
|
||||
BEGIN
|
||||
INSERT [dbo].[Quotas] ([QuotaID], [GroupID],[QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID]) VALUES (451, 45, 2, N'RDS.Servers',N'Remote Desktop Servers',2, 0 , NULL)
|
||||
END
|
||||
GO
|
||||
|
||||
-- RDS Provider
|
||||
|
||||
IF NOT EXISTS (SELECT * FROM [dbo].[Providers] WHERE [DisplayName] = 'Remote Desktop Services Windows 2012')
|
||||
|
@ -5417,3 +5423,650 @@ close c
|
|||
deallocate c
|
||||
|
||||
GO
|
||||
|
||||
|
||||
|
||||
/*Remote Desktop Services*/
|
||||
|
||||
/*Remote Desktop Services Tables*/
|
||||
IF EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'RDSCollectionUsers')
|
||||
DROP TABLE RDSCollectionUsers
|
||||
GO
|
||||
CREATE TABLE RDSCollectionUsers
|
||||
(
|
||||
ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
|
||||
RDSCollectionId INT NOT NULL,
|
||||
AccountID INT NOT NULL
|
||||
)
|
||||
GO
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'RDSServers')
|
||||
DROP TABLE RDSServers
|
||||
GO
|
||||
CREATE TABLE RDSServers
|
||||
(
|
||||
ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
|
||||
ItemID INT,
|
||||
Name NVARCHAR(255),
|
||||
FqdName NVARCHAR(255),
|
||||
Description NVARCHAR(255),
|
||||
RDSCollectionId INT/* FOREIGN KEY REFERENCES RDSCollection (ID)*/
|
||||
)
|
||||
GO
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'RDSCollections')
|
||||
DROP TABLE RDSCollections
|
||||
GO
|
||||
CREATE TABLE RDSCollections
|
||||
(
|
||||
ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
|
||||
ItemID INT NOT NULL,
|
||||
Name NVARCHAR(255),
|
||||
Description NVARCHAR(255)
|
||||
)
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[RDSCollectionUsers] WITH CHECK ADD CONSTRAINT [FK_RDSCollectionUsers_RDSCollectionId] FOREIGN KEY([RDSCollectionId])
|
||||
REFERENCES [dbo].[RDSCollections] ([ID])
|
||||
ON DELETE CASCADE
|
||||
GO
|
||||
|
||||
|
||||
ALTER TABLE [dbo].[RDSCollectionUsers] WITH CHECK ADD CONSTRAINT [FK_RDSCollectionUsers_UserId] FOREIGN KEY([AccountID])
|
||||
REFERENCES [dbo].[ExchangeAccounts] ([AccountID])
|
||||
ON DELETE CASCADE
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[RDSServers] WITH CHECK ADD CONSTRAINT [FK_RDSServers_RDSCollectionId] FOREIGN KEY([RDSCollectionId])
|
||||
REFERENCES [dbo].[RDSCollections] ([ID])
|
||||
GO
|
||||
|
||||
/*Remote Desktop Services Procedures*/
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'AddRDSServer')
|
||||
DROP PROCEDURE AddRDSServer
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[AddRDSServer]
|
||||
(
|
||||
@RDSServerID INT OUTPUT,
|
||||
@Name NVARCHAR(255),
|
||||
@FqdName NVARCHAR(255),
|
||||
@Description NVARCHAR(255)
|
||||
)
|
||||
AS
|
||||
INSERT INTO RDSServers
|
||||
(
|
||||
Name,
|
||||
FqdName,
|
||||
Description
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@Name,
|
||||
@FqdName,
|
||||
@Description
|
||||
)
|
||||
|
||||
SET @RDSServerID = SCOPE_IDENTITY()
|
||||
|
||||
RETURN
|
||||
GO
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'DeleteRDSServer')
|
||||
DROP PROCEDURE DeleteRDSServer
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[DeleteRDSServer]
|
||||
(
|
||||
@Id int
|
||||
)
|
||||
AS
|
||||
DELETE FROM RDSServers
|
||||
WHERE Id = @Id
|
||||
GO
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'UpdateRDSServer')
|
||||
DROP PROCEDURE UpdateRDSServer
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[UpdateRDSServer]
|
||||
(
|
||||
@Id INT,
|
||||
@ItemID INT,
|
||||
@Name NVARCHAR(255),
|
||||
@FqdName NVARCHAR(255),
|
||||
@Description NVARCHAR(255),
|
||||
@RDSCollectionId INT
|
||||
)
|
||||
AS
|
||||
|
||||
UPDATE RDSServers
|
||||
SET
|
||||
ItemID = @ItemID,
|
||||
Name = @Name,
|
||||
FqdName = @FqdName,
|
||||
Description = @Description,
|
||||
RDSCollectionId = @RDSCollectionId
|
||||
WHERE ID = @Id
|
||||
GO
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'AddRDSServerToOrganization')
|
||||
DROP PROCEDURE AddRDSServerToOrganization
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[AddRDSServerToOrganization]
|
||||
(
|
||||
@Id INT,
|
||||
@ItemID INT
|
||||
)
|
||||
AS
|
||||
|
||||
UPDATE RDSServers
|
||||
SET
|
||||
ItemID = @ItemID
|
||||
WHERE ID = @Id
|
||||
GO
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'RemoveRDSServerFromOrganization')
|
||||
DROP PROCEDURE RemoveRDSServerFromOrganization
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[RemoveRDSServerFromOrganization]
|
||||
(
|
||||
@Id INT
|
||||
)
|
||||
AS
|
||||
|
||||
UPDATE RDSServers
|
||||
SET
|
||||
ItemID = NULL
|
||||
WHERE ID = @Id
|
||||
GO
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'AddRDSServerToCollection')
|
||||
DROP PROCEDURE AddRDSServerToCollection
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[AddRDSServerToCollection]
|
||||
(
|
||||
@Id INT,
|
||||
@RDSCollectionId INT
|
||||
)
|
||||
AS
|
||||
|
||||
UPDATE RDSServers
|
||||
SET
|
||||
RDSCollectionId = @RDSCollectionId
|
||||
WHERE ID = @Id
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'RemoveRDSServerFromCollection')
|
||||
DROP PROCEDURE RemoveRDSServerFromCollection
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[RemoveRDSServerFromCollection]
|
||||
(
|
||||
@Id INT
|
||||
)
|
||||
AS
|
||||
|
||||
UPDATE RDSServers
|
||||
SET
|
||||
RDSCollectionId = NULL
|
||||
WHERE ID = @Id
|
||||
GO
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetRDSServersByItemId')
|
||||
DROP PROCEDURE GetRDSServersByItemId
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[GetRDSServersByItemId]
|
||||
(
|
||||
@ItemID INT
|
||||
)
|
||||
AS
|
||||
SELECT
|
||||
RS.Id,
|
||||
RS.ItemID,
|
||||
RS.Name,
|
||||
RS.FqdName,
|
||||
RS.Description,
|
||||
RS.RdsCollectionId,
|
||||
SI.ItemName
|
||||
FROM RDSServers AS RS
|
||||
LEFT OUTER JOIN ServiceItems AS SI ON SI.ItemId = RS.ItemId
|
||||
WHERE RS.ItemID = @ItemID
|
||||
GO
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetRDSServers')
|
||||
DROP PROCEDURE GetRDSServers
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[GetRDSServers]
|
||||
AS
|
||||
SELECT
|
||||
RS.Id,
|
||||
RS.ItemID,
|
||||
RS.Name,
|
||||
RS.FqdName,
|
||||
RS.Description,
|
||||
RS.RdsCollectionId,
|
||||
SI.ItemName
|
||||
FROM RDSServers AS RS
|
||||
LEFT OUTER JOIN ServiceItems AS SI ON SI.ItemId = RS.ItemId
|
||||
GO
|
||||
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetRDSServerById')
|
||||
DROP PROCEDURE GetRDSServerById
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[GetRDSServerById]
|
||||
(
|
||||
@ID INT
|
||||
)
|
||||
AS
|
||||
SELECT TOP 1
|
||||
RS.Id,
|
||||
RS.ItemID,
|
||||
RS.Name,
|
||||
RS.FqdName,
|
||||
RS.Description,
|
||||
RS.RdsCollectionId,
|
||||
SI.ItemName
|
||||
FROM RDSServers AS RS
|
||||
LEFT OUTER JOIN ServiceItems AS SI ON SI.ItemId = RS.ItemId
|
||||
WHERE Id = @Id
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetRDSServersByCollectionId')
|
||||
DROP PROCEDURE GetRDSServersByCollectionId
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[GetRDSServersByCollectionId]
|
||||
(
|
||||
@RdsCollectionId INT
|
||||
)
|
||||
AS
|
||||
SELECT
|
||||
RS.Id,
|
||||
RS.ItemID,
|
||||
RS.Name,
|
||||
RS.FqdName,
|
||||
RS.Description,
|
||||
RS.RdsCollectionId,
|
||||
SI.ItemName
|
||||
FROM RDSServers AS RS
|
||||
LEFT OUTER JOIN ServiceItems AS SI ON SI.ItemId = RS.ItemId
|
||||
WHERE RdsCollectionId = @RdsCollectionId
|
||||
GO
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetRDSServersPaged')
|
||||
DROP PROCEDURE GetRDSServersPaged
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[GetRDSServersPaged]
|
||||
(
|
||||
@FilterColumn nvarchar(50) = '',
|
||||
@FilterValue nvarchar(50) = '',
|
||||
@ItemID int,
|
||||
@IgnoreItemId bit,
|
||||
@RdsCollectionId int,
|
||||
@IgnoreRdsCollectionId bit,
|
||||
@SortColumn nvarchar(50),
|
||||
@StartRow int,
|
||||
@MaximumRows int
|
||||
)
|
||||
AS
|
||||
-- build query and run it to the temporary table
|
||||
DECLARE @sql nvarchar(2000)
|
||||
|
||||
SET @sql = '
|
||||
|
||||
DECLARE @EndRow int
|
||||
SET @EndRow = @StartRow + @MaximumRows
|
||||
|
||||
DECLARE @RDSServer TABLE
|
||||
(
|
||||
ItemPosition int IDENTITY(0,1),
|
||||
RDSServerId int
|
||||
)
|
||||
INSERT INTO @RDSServer (RDSServerId)
|
||||
SELECT
|
||||
S.ID
|
||||
FROM RDSServers AS S
|
||||
WHERE
|
||||
((((@ItemID is Null AND S.ItemID is null) or @IgnoreItemId = 1)
|
||||
or (@ItemID is not Null AND S.ItemID = @ItemID))
|
||||
and
|
||||
(((@RdsCollectionId is Null AND S.RDSCollectionId is null) or @IgnoreRdsCollectionId = 1)
|
||||
or (@RdsCollectionId is not Null AND S.RDSCollectionId = @RdsCollectionId)))'
|
||||
|
||||
IF @FilterColumn <> '' AND @FilterValue <> ''
|
||||
SET @sql = @sql + ' AND ' + @FilterColumn + ' LIKE @FilterValue '
|
||||
|
||||
IF @SortColumn <> '' AND @SortColumn IS NOT NULL
|
||||
SET @sql = @sql + ' ORDER BY ' + @SortColumn + ' '
|
||||
|
||||
SET @sql = @sql + ' SELECT COUNT(RDSServerId) FROM @RDSServer;
|
||||
SELECT
|
||||
ST.ID,
|
||||
ST.ItemID,
|
||||
ST.Name,
|
||||
ST.FqdName,
|
||||
ST.Description,
|
||||
ST.RdsCollectionId,
|
||||
SI.ItemName
|
||||
FROM @RDSServer AS S
|
||||
INNER JOIN RDSServers AS ST ON S.RDSServerId = ST.ID
|
||||
LEFT OUTER JOIN ServiceItems AS SI ON SI.ItemId = ST.ItemId
|
||||
WHERE S.ItemPosition BETWEEN @StartRow AND @EndRow'
|
||||
|
||||
exec sp_executesql @sql, N'@StartRow int, @MaximumRows int, @FilterValue nvarchar(50), @ItemID int, @RdsCollectionId int, @IgnoreItemId bit, @IgnoreRdsCollectionId bit',
|
||||
@StartRow, @MaximumRows, @FilterValue, @ItemID, @RdsCollectionId, @IgnoreItemId , @IgnoreRdsCollectionId
|
||||
|
||||
|
||||
RETURN
|
||||
|
||||
GO
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetRDSCollectionsPaged')
|
||||
DROP PROCEDURE GetRDSCollectionsPaged
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[GetRDSCollectionsPaged]
|
||||
(
|
||||
@FilterColumn nvarchar(50) = '',
|
||||
@FilterValue nvarchar(50) = '',
|
||||
@ItemID int,
|
||||
@SortColumn nvarchar(50),
|
||||
@StartRow int,
|
||||
@MaximumRows int
|
||||
)
|
||||
AS
|
||||
-- build query and run it to the temporary table
|
||||
DECLARE @sql nvarchar(2000)
|
||||
|
||||
SET @sql = '
|
||||
|
||||
DECLARE @EndRow int
|
||||
SET @EndRow = @StartRow + @MaximumRows
|
||||
DECLARE @RDSCollections TABLE
|
||||
(
|
||||
ItemPosition int IDENTITY(0,1),
|
||||
RDSCollectionId int
|
||||
)
|
||||
INSERT INTO @RDSCollections (RDSCollectionId)
|
||||
SELECT
|
||||
S.ID
|
||||
FROM RDSCollections AS S
|
||||
WHERE
|
||||
((@ItemID is Null AND S.ItemID is null)
|
||||
or (@ItemID is not Null AND S.ItemID = @ItemID))'
|
||||
|
||||
IF @FilterColumn <> '' AND @FilterValue <> ''
|
||||
SET @sql = @sql + ' AND ' + @FilterColumn + ' LIKE @FilterValue '
|
||||
|
||||
IF @SortColumn <> '' AND @SortColumn IS NOT NULL
|
||||
SET @sql = @sql + ' ORDER BY ' + @SortColumn + ' '
|
||||
|
||||
SET @sql = @sql + ' SELECT COUNT(RDSCollectionId) FROM @RDSCollections;
|
||||
SELECT
|
||||
CR.ID,
|
||||
CR.ItemID,
|
||||
CR.Name,
|
||||
CR.Description
|
||||
FROM @RDSCollections AS C
|
||||
INNER JOIN RDSCollections AS CR ON C.RDSCollectionId = CR.ID
|
||||
WHERE C.ItemPosition BETWEEN @StartRow AND @EndRow'
|
||||
|
||||
exec sp_executesql @sql, N'@StartRow int, @MaximumRows int, @FilterValue nvarchar(50), @ItemID int',
|
||||
@StartRow, @MaximumRows, @FilterValue, @ItemID
|
||||
|
||||
|
||||
RETURN
|
||||
|
||||
GO
|
||||
SET ANSI_NULLS ON
|
||||
GO
|
||||
SET QUOTED_IDENTIFIER ON
|
||||
GO
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetRDSCollectionsByItemId')
|
||||
DROP PROCEDURE GetRDSCollectionsByItemId
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[GetRDSCollectionsByItemId]
|
||||
(
|
||||
@ItemID INT
|
||||
)
|
||||
AS
|
||||
SELECT
|
||||
Id,
|
||||
ItemId,
|
||||
Name,
|
||||
Description
|
||||
FROM RDSCollections
|
||||
WHERE ItemID = @ItemID
|
||||
GO
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetRDSCollectionByName')
|
||||
DROP PROCEDURE GetRDSCollectionByName
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[GetRDSCollectionByName]
|
||||
(
|
||||
@Name NVARCHAR(255)
|
||||
)
|
||||
AS
|
||||
|
||||
SELECT TOP 1
|
||||
Id,
|
||||
Name,
|
||||
ItemId,
|
||||
Description
|
||||
FROM RDSCollections
|
||||
WHERE Name = @Name
|
||||
GO
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetRDSCollectionById')
|
||||
DROP PROCEDURE GetRDSCollectionById
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[GetRDSCollectionById]
|
||||
(
|
||||
@ID INT
|
||||
)
|
||||
AS
|
||||
|
||||
SELECT TOP 1
|
||||
Id,
|
||||
ItemId,
|
||||
Name,
|
||||
Description
|
||||
FROM RDSCollections
|
||||
WHERE ID = @ID
|
||||
GO
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'AddRDSCollection')
|
||||
DROP PROCEDURE AddRDSCollection
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[AddRDSCollection]
|
||||
(
|
||||
@RDSCollectionID INT OUTPUT,
|
||||
@ItemID INT,
|
||||
@Name NVARCHAR(255),
|
||||
@Description NVARCHAR(255)
|
||||
)
|
||||
AS
|
||||
|
||||
INSERT INTO RDSCollections
|
||||
(
|
||||
ItemID,
|
||||
Name,
|
||||
Description
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@ItemID,
|
||||
@Name,
|
||||
@Description
|
||||
)
|
||||
|
||||
SET @RDSCollectionID = SCOPE_IDENTITY()
|
||||
|
||||
RETURN
|
||||
GO
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'UpdateRDSCollection')
|
||||
DROP PROCEDURE UpdateRDSCollection
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[UpdateRDSCollection]
|
||||
(
|
||||
@ID INT,
|
||||
@ItemID INT,
|
||||
@Name NVARCHAR(255),
|
||||
@Description NVARCHAR(255)
|
||||
)
|
||||
AS
|
||||
|
||||
UPDATE RDSCollections
|
||||
SET
|
||||
ItemID = @ItemID,
|
||||
Name = @Name,
|
||||
Description = @Description
|
||||
WHERE ID = @Id
|
||||
GO
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'DeleteRDSCollection')
|
||||
DROP PROCEDURE DeleteRDSCollection
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[DeleteRDSCollection]
|
||||
(
|
||||
@Id int
|
||||
)
|
||||
AS
|
||||
|
||||
UPDATE RDSServers
|
||||
SET
|
||||
RDSCollectionId = Null
|
||||
WHERE RDSCollectionId = @Id
|
||||
|
||||
DELETE FROM RDSCollections
|
||||
WHERE Id = @Id
|
||||
GO
|
||||
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetRDSCollectionUsersByRDSCollectionId')
|
||||
DROP PROCEDURE GetRDSCollectionUsersByRDSCollectionId
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[GetRDSCollectionUsersByRDSCollectionId]
|
||||
(
|
||||
@ID INT
|
||||
)
|
||||
AS
|
||||
SELECT
|
||||
[AccountID],
|
||||
[ItemID],
|
||||
[AccountType],
|
||||
[AccountName],
|
||||
[DisplayName],
|
||||
[PrimaryEmailAddress],
|
||||
[MailEnabledPublicFolder],
|
||||
[MailboxManagerActions],
|
||||
[SamAccountName],
|
||||
[AccountPassword],
|
||||
[CreatedDate],
|
||||
[MailboxPlanId],
|
||||
[SubscriberNumber],
|
||||
[UserPrincipalName],
|
||||
[ExchangeDisclaimerId],
|
||||
[ArchivingMailboxPlanId],
|
||||
[EnableArchiving],
|
||||
[LevelID],
|
||||
[IsVIP]
|
||||
FROM ExchangeAccounts
|
||||
WHERE AccountID IN (Select AccountId from RDSCollectionUsers where RDSCollectionId = @Id)
|
||||
GO
|
||||
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'AddUserToRDSCollection')
|
||||
DROP PROCEDURE AddUserToRDSCollection
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[AddUserToRDSCollection]
|
||||
(
|
||||
@RDSCollectionID INT,
|
||||
@AccountId INT
|
||||
)
|
||||
AS
|
||||
|
||||
INSERT INTO RDSCollectionUsers
|
||||
(
|
||||
RDSCollectionId,
|
||||
AccountID
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@RDSCollectionID,
|
||||
@AccountId
|
||||
)
|
||||
GO
|
||||
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'RemoveRDSUserFromRDSCollection')
|
||||
DROP PROCEDURE RemoveRDSUserFromRDSCollection
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[RemoveRDSUserFromRDSCollection]
|
||||
(
|
||||
@AccountId INT,
|
||||
@RDSCollectionId INT
|
||||
)
|
||||
AS
|
||||
|
||||
|
||||
DELETE FROM RDSCollectionUsers
|
||||
WHERE AccountId = @AccountId AND RDSCollectionId = @RDSCollectionId
|
||||
GO
|
||||
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetOrganizationRdsUsersCount')
|
||||
DROP PROCEDURE GetOrganizationRdsUsersCount
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].GetOrganizationRdsUsersCount
|
||||
(
|
||||
@ItemID INT,
|
||||
@TotalNumber int OUTPUT
|
||||
)
|
||||
AS
|
||||
SELECT
|
||||
@TotalNumber = Count([RDSCollectionId])
|
||||
FROM [dbo].[RDSCollectionUsers]
|
||||
WHERE [RDSCollectionId] in (SELECT [ID] FROM [RDSCollections] where [ItemId] = @ItemId )
|
||||
RETURN
|
||||
GO
|
||||
|
|
|
@ -56,5 +56,6 @@ namespace WebsitePanel.EnterpriseServer
|
|||
public const string Lync = "Lync";
|
||||
public const string EnterpriseStorage = "EnterpriseStorage";
|
||||
public const string ServiceLevels = "Service Levels";
|
||||
public const string RDS = "RDS";
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -35,6 +35,7 @@ using WebsitePanel.Providers.HostedSolution;
|
|||
using Microsoft.ApplicationBlocks.Data;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Win32;
|
||||
using WebsitePanel.Providers.RemoteDesktopServices;
|
||||
|
||||
namespace WebsitePanel.EnterpriseServer
|
||||
{
|
||||
|
@ -4435,5 +4436,287 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RDS
|
||||
|
||||
public static IDataReader GetRDSCollectionsByItemId(int itemId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetRDSCollectionsByItemId",
|
||||
new SqlParameter("@ItemID", itemId)
|
||||
);
|
||||
}
|
||||
|
||||
public static IDataReader GetRDSCollectionByName(string name)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetRDSCollectionByName",
|
||||
new SqlParameter("@Name", name)
|
||||
);
|
||||
}
|
||||
|
||||
public static IDataReader GetRDSCollectionById(int id)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetRDSCollectionById",
|
||||
new SqlParameter("@ID", id)
|
||||
);
|
||||
}
|
||||
|
||||
public static DataSet GetRDSCollectionsPaged(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows)
|
||||
{
|
||||
return SqlHelper.ExecuteDataset(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetRDSCollectionsPaged",
|
||||
new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)),
|
||||
new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)),
|
||||
new SqlParameter("@itemId", itemId),
|
||||
new SqlParameter("@SortColumn", VerifyColumnName(sortColumn)),
|
||||
new SqlParameter("@startRow", startRow),
|
||||
new SqlParameter("@maximumRows", maximumRows)
|
||||
);
|
||||
}
|
||||
|
||||
public static int AddRDSCollection(int itemId, string name, string description)
|
||||
{
|
||||
SqlParameter rdsCollectionId = new SqlParameter("@RDSCollectionID", SqlDbType.Int);
|
||||
rdsCollectionId.Direction = ParameterDirection.Output;
|
||||
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"AddRDSCollection",
|
||||
rdsCollectionId,
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@Name", name),
|
||||
new SqlParameter("@Description", description)
|
||||
);
|
||||
|
||||
// read identity
|
||||
return Convert.ToInt32(rdsCollectionId.Value);
|
||||
}
|
||||
|
||||
public static int GetOrganizationRdsUsersCount(int itemId)
|
||||
{
|
||||
SqlParameter count = new SqlParameter("@TotalNumber", SqlDbType.Int);
|
||||
count.Direction = ParameterDirection.Output;
|
||||
|
||||
DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "GetOrganizationRdsUsersCount",
|
||||
count,
|
||||
new SqlParameter("@ItemId", itemId));
|
||||
|
||||
// read identity
|
||||
return Convert.ToInt32(count.Value);
|
||||
}
|
||||
|
||||
public static void UpdateRDSCollection(RdsCollection collection)
|
||||
{
|
||||
UpdateRDSCollection(collection.Id, collection.ItemId, collection.Name, collection.Description);
|
||||
}
|
||||
|
||||
public static void UpdateRDSCollection(int id, int itemId, string name, string description)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"UpdateRDSCollection",
|
||||
new SqlParameter("@Id", id),
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@Name", name),
|
||||
new SqlParameter("@Description", description)
|
||||
);
|
||||
}
|
||||
|
||||
public static void DeleteRDSCollection(int id)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"DeleteRDSCollection",
|
||||
new SqlParameter("@Id", id)
|
||||
);
|
||||
}
|
||||
|
||||
public static int AddRDSServer(string name, string fqdName, string description)
|
||||
{
|
||||
SqlParameter rdsServerId = new SqlParameter("@RDSServerID", SqlDbType.Int);
|
||||
rdsServerId.Direction = ParameterDirection.Output;
|
||||
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"AddRDSServer",
|
||||
rdsServerId,
|
||||
new SqlParameter("@FqdName", fqdName),
|
||||
new SqlParameter("@Name", name),
|
||||
new SqlParameter("@Description", description)
|
||||
);
|
||||
|
||||
// read identity
|
||||
return Convert.ToInt32(rdsServerId.Value);
|
||||
}
|
||||
|
||||
public static IDataReader GetRDSServersByItemId(int itemId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetRDSServersByItemId",
|
||||
new SqlParameter("@ItemID", itemId)
|
||||
);
|
||||
}
|
||||
|
||||
public static DataSet GetRDSServersPaged(int? itemId, int? collectionId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, bool ignoreItemId = false, bool ignoreRdsCollectionId = false)
|
||||
{
|
||||
return SqlHelper.ExecuteDataset(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetRDSServersPaged",
|
||||
new SqlParameter("@FilterColumn", VerifyColumnName(filterColumn)),
|
||||
new SqlParameter("@FilterValue", VerifyColumnValue(filterValue)),
|
||||
new SqlParameter("@SortColumn", VerifyColumnName(sortColumn)),
|
||||
new SqlParameter("@startRow", startRow),
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@RdsCollectionId", collectionId),
|
||||
new SqlParameter("@IgnoreItemId", ignoreItemId),
|
||||
new SqlParameter("@IgnoreRdsCollectionId", ignoreRdsCollectionId),
|
||||
new SqlParameter("@maximumRows", maximumRows)
|
||||
);
|
||||
}
|
||||
|
||||
public static IDataReader GetRDSServerById(int id)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetRDSServerById",
|
||||
new SqlParameter("@ID", id)
|
||||
);
|
||||
}
|
||||
|
||||
public static IDataReader GetRDSServersByCollectionId(int collectionId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetRDSServersByCollectionId",
|
||||
new SqlParameter("@RdsCollectionId", collectionId)
|
||||
);
|
||||
}
|
||||
|
||||
public static void DeleteRDSServer(int id)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"DeleteRDSServer",
|
||||
new SqlParameter("@Id", id)
|
||||
);
|
||||
}
|
||||
|
||||
public static void UpdateRDSServer(RdsServer server)
|
||||
{
|
||||
UpdateRDSServer(server.Id, server.ItemId, server.Name, server.FqdName, server.Description,
|
||||
server.RdsCollectionId);
|
||||
}
|
||||
|
||||
public static void UpdateRDSServer(int id, int? itemId, string name, string fqdName, string description, int? rdsCollectionId)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"UpdateRDSServer",
|
||||
new SqlParameter("@Id", id),
|
||||
new SqlParameter("@ItemID", itemId),
|
||||
new SqlParameter("@Name", name),
|
||||
new SqlParameter("@FqdName", fqdName),
|
||||
new SqlParameter("@Description", description),
|
||||
new SqlParameter("@RDSCollectionId", rdsCollectionId)
|
||||
);
|
||||
}
|
||||
|
||||
public static void AddRDSServerToCollection(int serverId, int rdsCollectionId)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"AddRDSServerToCollection",
|
||||
new SqlParameter("@Id", serverId),
|
||||
new SqlParameter("@RDSCollectionId", rdsCollectionId)
|
||||
);
|
||||
}
|
||||
|
||||
public static void AddRDSServerToOrganization(int itemId, int serverId)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"AddRDSServerToOrganization",
|
||||
new SqlParameter("@Id", serverId),
|
||||
new SqlParameter("@ItemID", itemId)
|
||||
);
|
||||
}
|
||||
|
||||
public static void RemoveRDSServerFromOrganization(int serverId)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"RemoveRDSServerFromOrganization",
|
||||
new SqlParameter("@Id", serverId)
|
||||
);
|
||||
}
|
||||
|
||||
public static void RemoveRDSServerFromCollection(int serverId)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"RemoveRDSServerFromCollection",
|
||||
new SqlParameter("@Id", serverId)
|
||||
);
|
||||
}
|
||||
|
||||
public static IDataReader GetRDSCollectionUsersByRDSCollectionId(int id)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetRDSCollectionUsersByRDSCollectionId",
|
||||
new SqlParameter("@id", id)
|
||||
);
|
||||
}
|
||||
|
||||
public static void AddRDSUserToRDSCollection(int rdsCollectionId, int accountId)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"AddUserToRDSCollection",
|
||||
new SqlParameter("@RDSCollectionId", rdsCollectionId),
|
||||
new SqlParameter("@AccountID", accountId)
|
||||
);
|
||||
}
|
||||
|
||||
public static void RemoveRDSUserFromRDSCollection(int rdsCollectionId, int accountId)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"RemoveRDSUserFromRDSCollection",
|
||||
new SqlParameter("@RDSCollectionId", rdsCollectionId),
|
||||
new SqlParameter("@AccountID", accountId)
|
||||
);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -726,6 +726,13 @@ namespace WebsitePanel.EnterpriseServer
|
|||
successful = false;
|
||||
}
|
||||
|
||||
//Cleanup RDS
|
||||
|
||||
if (RemoteDesktopServicesController.DeleteRemoteDesktopService(itemId).IsSuccess == false)
|
||||
{
|
||||
successful = false;
|
||||
}
|
||||
|
||||
//Cleanup Exchange
|
||||
try
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -36,7 +36,8 @@ using System.Web.Services.Protocols;
|
|||
using System.ComponentModel;
|
||||
|
||||
using Microsoft.Web.Services3;
|
||||
|
||||
using WebsitePanel.Providers.Common;
|
||||
using WebsitePanel.Providers.HostedSolution;
|
||||
using WebsitePanel.Providers.RemoteDesktopServices;
|
||||
|
||||
namespace WebsitePanel.EnterpriseServer
|
||||
|
@ -50,14 +51,178 @@ namespace WebsitePanel.EnterpriseServer
|
|||
[ToolboxItem(false)]
|
||||
public class esRemoteDesktopServices : System.Web.Services.WebService
|
||||
{
|
||||
/*
|
||||
|
||||
[WebMethod]
|
||||
public DataSet GetRawOdbcSourcesPaged(int packageId,
|
||||
string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows)
|
||||
public RdsCollection GetRdsCollection(int collectionId)
|
||||
{
|
||||
return OperatingSystemController.GetRawOdbcSourcesPaged(packageId, filterColumn,
|
||||
filterValue, sortColumn, startRow, maximumRows);
|
||||
return RemoteDesktopServicesController.GetRdsCollection(collectionId);
|
||||
}
|
||||
*/
|
||||
|
||||
[WebMethod]
|
||||
public List<RdsCollection> GetOrganizationRdsCollections(int itemId)
|
||||
{
|
||||
return RemoteDesktopServicesController.GetOrganizationRdsCollections(itemId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public ResultObject AddRdsCollection(int itemId, RdsCollection collection)
|
||||
{
|
||||
return RemoteDesktopServicesController.AddRdsCollection(itemId, collection);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public RdsCollectionPaged GetRdsCollectionsPaged(int itemId, string filterColumn, string filterValue,
|
||||
string sortColumn, int startRow, int maximumRows)
|
||||
{
|
||||
return RemoteDesktopServicesController.GetRdsCollectionsPaged(itemId, filterColumn, filterValue, sortColumn,
|
||||
startRow, maximumRows);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public ResultObject RemoveRdsCollection(int itemId, RdsCollection collection)
|
||||
{
|
||||
return RemoteDesktopServicesController.RemoveRdsCollection(itemId, collection);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public RdsServersPaged GetRdsServersPaged(string filterColumn, string filterValue, string sortColumn,
|
||||
int startRow, int maximumRows)
|
||||
{
|
||||
return RemoteDesktopServicesController.GetRdsServersPaged(filterColumn, filterValue, sortColumn, startRow,
|
||||
maximumRows);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public RdsServersPaged GetFreeRdsServersPaged(string filterColumn, string filterValue,
|
||||
string sortColumn, int startRow, int maximumRows)
|
||||
{
|
||||
return RemoteDesktopServicesController.GetFreeRdsServersPaged(filterColumn, filterValue,
|
||||
sortColumn, startRow, maximumRows);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public RdsServersPaged GetOrganizationRdsServersPaged(int itemId, string filterColumn, string filterValue,
|
||||
string sortColumn, int startRow, int maximumRows)
|
||||
{
|
||||
return RemoteDesktopServicesController.GetOrganizationRdsServersPaged(itemId, filterColumn, filterValue,
|
||||
sortColumn, startRow, maximumRows);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public RdsServersPaged GetOrganizationFreeRdsServersPaged(int itemId, string filterColumn, string filterValue,
|
||||
string sortColumn, int startRow, int maximumRows)
|
||||
{
|
||||
return RemoteDesktopServicesController.GetOrganizationFreeRdsServersPaged(itemId, filterColumn, filterValue,
|
||||
sortColumn, startRow, maximumRows);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public RdsServer GetRdsServer(int rdsSeverId)
|
||||
{
|
||||
return RemoteDesktopServicesController.GetRdsServer(rdsSeverId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public List<RdsServer> GetCollectionRdsServers(int collectionId)
|
||||
{
|
||||
return RemoteDesktopServicesController.GetCollectionRdsServers(collectionId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public List<RdsServer> GetOrganizationRdsServers(int itemId)
|
||||
{
|
||||
return RemoteDesktopServicesController.GetOrganizationRdsServers(itemId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public ResultObject AddRdsServer(RdsServer rdsServer)
|
||||
{
|
||||
return RemoteDesktopServicesController.AddRdsServer(rdsServer);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public ResultObject AddRdsServerToCollection(int itemId, RdsServer rdsServer, RdsCollection rdsCollection)
|
||||
{
|
||||
return RemoteDesktopServicesController.AddRdsServerToCollection(itemId, rdsServer, rdsCollection);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public ResultObject AddRdsServerToOrganization(int itemId, int serverId)
|
||||
{
|
||||
return RemoteDesktopServicesController.AddRdsServerToOrganization(itemId, serverId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public ResultObject RemoveRdsServer(int rdsServerId)
|
||||
{
|
||||
return RemoteDesktopServicesController.RemoveRdsServer(rdsServerId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public ResultObject RemoveRdsServerFromCollection(int itemId, RdsServer rdsServer, RdsCollection rdsCollection)
|
||||
{
|
||||
return RemoteDesktopServicesController.RemoveRdsServerFromCollection(itemId, rdsServer, rdsCollection);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public ResultObject RemoveRdsServerFromOrganization(int rdsServerId)
|
||||
{
|
||||
return RemoteDesktopServicesController.RemoveRdsServerFromOrganization(rdsServerId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public ResultObject UpdateRdsServer(RdsServer rdsServer)
|
||||
{
|
||||
return RemoteDesktopServicesController.UpdateRdsServer(rdsServer);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public List<OrganizationUser> GetRdsCollectionUsers(int collectionId)
|
||||
{
|
||||
return RemoteDesktopServicesController.GetRdsCollectionUsers(collectionId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public ResultObject SetUsersToRdsCollection(int itemId, int collectionId, List<OrganizationUser> users)
|
||||
{
|
||||
return RemoteDesktopServicesController.SetUsersToRdsCollection(itemId, collectionId, users);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public List<RemoteApplication> GetCollectionRemoteApplications(int itemId, string collectionName)
|
||||
{
|
||||
return RemoteDesktopServicesController.GetCollectionRemoteApplications(itemId, collectionName);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public List<StartMenuApp> GetAvailableRemoteApplications(int itemId, string collectionName)
|
||||
{
|
||||
return RemoteDesktopServicesController.GetAvailableRemoteApplications(itemId, collectionName);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public ResultObject AddRemoteApplicationToCollection(int itemId, RdsCollection collection, RemoteApplication application)
|
||||
{
|
||||
return RemoteDesktopServicesController.AddRemoteApplicationToCollection(itemId, collection, application);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public ResultObject RemoveRemoteApplicationFromCollection(int itemId, RdsCollection collection, RemoteApplication application)
|
||||
{
|
||||
return RemoteDesktopServicesController.RemoveRemoteApplicationFromCollection(itemId, collection, application);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public ResultObject SetRemoteApplicationsToRdsCollection(int itemId, int collectionId, List<RemoteApplication> remoteApps)
|
||||
{
|
||||
return RemoteDesktopServicesController.SetRemoteApplicationsToRdsCollection(itemId, collectionId, remoteApps);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public int GetOrganizationRdsUsersCount(int itemId)
|
||||
{
|
||||
return RemoteDesktopServicesController.GetOrganizationRdsUsersCount(itemId);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,6 +130,31 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
return res;
|
||||
}
|
||||
|
||||
public static bool IsComputerInGroup(string samAccountName, string group)
|
||||
{
|
||||
bool res = false;
|
||||
DirectorySearcher deSearch = new DirectorySearcher
|
||||
{
|
||||
Filter =
|
||||
("(&(objectClass=computer)(samaccountname=" + samAccountName + "))")
|
||||
};
|
||||
|
||||
//get the group result
|
||||
SearchResult results = deSearch.FindOne();
|
||||
DirectoryEntry de = results.GetDirectoryEntry();
|
||||
PropertyValueCollection props = de.Properties["memberOf"];
|
||||
|
||||
foreach (string str in props)
|
||||
{
|
||||
if (str.IndexOf(group) != -1)
|
||||
{
|
||||
res = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public static string CreateOrganizationalUnit(string name, string parentPath)
|
||||
{
|
||||
string ret;
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace WebsitePanel.Providers.RemoteDesktopServices
|
||||
{
|
||||
|
@ -36,6 +39,24 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
|||
/// </summary>
|
||||
public interface IRemoteDesktopServices
|
||||
{
|
||||
bool CreateCollection(string organizationId, RdsCollection collection);
|
||||
RdsCollection GetCollection(string collectionName);
|
||||
bool RemoveCollection(string organizationId, string collectionName);
|
||||
bool SetUsersInCollection(string organizationId, string collectionName, List<string> users);
|
||||
void AddSessionHostServerToCollection(string organizationId, string collectionName, RdsServer server);
|
||||
void AddSessionHostServersToCollection(string organizationId, string collectionName, List<RdsServer> servers);
|
||||
void RemoveSessionHostServerFromCollection(string organizationId, string collectionName, RdsServer server);
|
||||
void RemoveSessionHostServersFromCollection(string organizationId, string collectionName, List<RdsServer> servers);
|
||||
|
||||
List<StartMenuApp> GetAvailableRemoteApplications(string collectionName);
|
||||
List<RemoteApplication> GetCollectionRemoteApplications(string collectionName);
|
||||
bool AddRemoteApplication(string collectionName, RemoteApplication remoteApp);
|
||||
bool AddRemoteApplications(string collectionName, List<RemoteApplication> remoteApps);
|
||||
bool RemoveRemoteApplication(string collectionName, RemoteApplication remoteApp);
|
||||
|
||||
bool AddSessionHostFeatureToServer(string hostName);
|
||||
bool CheckSessionHostFeatureInstallation(string hostName);
|
||||
|
||||
bool CheckServerAvailability(string hostName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebsitePanel.Providers.RemoteDesktopServices
|
||||
{
|
||||
[Serializable]
|
||||
public class RdsCollection
|
||||
{
|
||||
public RdsCollection()
|
||||
{
|
||||
Servers = new List<RdsServer>();
|
||||
}
|
||||
|
||||
public int Id { get; set; }
|
||||
public int ItemId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public List<RdsServer> Servers { get; set; }
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
namespace WebsitePanel.Providers.RemoteDesktopServices
|
||||
{
|
||||
public class RdsCollectionPaged
|
||||
{
|
||||
public int RecordsCount { get; set; }
|
||||
public RdsCollection[] Collections { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
using System.Net;
|
||||
|
||||
namespace WebsitePanel.Providers.RemoteDesktopServices
|
||||
{
|
||||
public class RdsServer
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int? ItemId { get; set; }
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.IsNullOrEmpty(FqdName) ? string.Empty : FqdName.Split('.')[0];
|
||||
}
|
||||
}
|
||||
public string FqdName { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Address { get; set; }
|
||||
public string ItemName { get; set; }
|
||||
public int? RdsCollectionId { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
namespace WebsitePanel.Providers.RemoteDesktopServices
|
||||
{
|
||||
public class RdsServersPaged
|
||||
{
|
||||
public int RecordsCount { get; set; }
|
||||
public RdsServer[] Servers { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
namespace WebsitePanel.Providers.RemoteDesktopServices
|
||||
{
|
||||
public class RemoteApplication
|
||||
{
|
||||
public string Alias { get; set; }
|
||||
public string DisplayName { get; set; }
|
||||
public string FilePath { get; set; }
|
||||
public string FileVirtualPath { get; set; }
|
||||
public bool ShowInWebAccess { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
using System.Net;
|
||||
|
||||
namespace WebsitePanel.Providers.RemoteDesktopServices
|
||||
{
|
||||
public class SessionHostServer
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string FqdName { get; set; }
|
||||
public string Address { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
namespace WebsitePanel.Providers.RemoteDesktopServices
|
||||
{
|
||||
public class StartMenuApp
|
||||
{
|
||||
public string DisplayName { get; set; }
|
||||
public string FilePath { get; set; }
|
||||
public string FileVirtualPath { get; set; }
|
||||
}
|
||||
}
|
|
@ -123,6 +123,13 @@
|
|||
<Compile Include="OS\QuotaType.cs" />
|
||||
<Compile Include="OS\SystemFilesPaged.cs" />
|
||||
<Compile Include="RemoteDesktopServices\IRemoteDesktopServices.cs" />
|
||||
<Compile Include="RemoteDesktopServices\RdsCollection.cs" />
|
||||
<Compile Include="RemoteDesktopServices\RdsCollectionPaged.cs" />
|
||||
<Compile Include="RemoteDesktopServices\RdsServer.cs" />
|
||||
<Compile Include="RemoteDesktopServices\RdsServersPaged.cs" />
|
||||
<Compile Include="RemoteDesktopServices\RemoteApplication.cs" />
|
||||
<Compile Include="RemoteDesktopServices\SessionHostServer.cs" />
|
||||
<Compile Include="RemoteDesktopServices\StartMenuApp.cs" />
|
||||
<Compile Include="ResultObjects\HeliconApe.cs" />
|
||||
<Compile Include="HostedSolution\ExchangeMobileDevice.cs" />
|
||||
<Compile Include="HostedSolution\IOCSEdgeServer.cs" />
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.DirectoryServices" />
|
||||
<Reference Include="System.Management.Automation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
|
||||
<Reference Include="System.Xml" />
|
||||
<ProjectReference Include="..\WebsitePanel.Providers.Base\WebsitePanel.Providers.Base.csproj">
|
||||
<Project>{684C932A-6C75-46AC-A327-F3689D89EB42}</Project>
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -27,7 +27,10 @@
|
|||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Web;
|
||||
using System.Collections;
|
||||
using System.Web.Services;
|
||||
|
@ -36,6 +39,7 @@ using System.ComponentModel;
|
|||
using Microsoft.Web.Services3;
|
||||
|
||||
using WebsitePanel.Providers;
|
||||
using WebsitePanel.Providers.OS;
|
||||
using WebsitePanel.Providers.RemoteDesktopServices;
|
||||
using WebsitePanel.Server.Utils;
|
||||
|
||||
|
@ -55,7 +59,273 @@ namespace WebsitePanel.Server
|
|||
get { return (IRemoteDesktopServices)Provider; }
|
||||
}
|
||||
|
||||
[WebMethod, SoapHeader("settings")]
|
||||
public bool CreateCollection(string organizationId, RdsCollection collection)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.WriteStart("'{0}' CreateCollection", ProviderSettings.ProviderName);
|
||||
var result = RDSProvider.CreateCollection(organizationId, collection);
|
||||
Log.WriteEnd("'{0}' CreateCollection", ProviderSettings.ProviderName);
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError(String.Format("'{0}' CreateCollection", ProviderSettings.ProviderName), ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod, SoapHeader("settings")]
|
||||
public RdsCollection GetCollection(string collectionName)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.WriteStart("'{0}' GetCollection", ProviderSettings.ProviderName);
|
||||
var result = RDSProvider.GetCollection(collectionName);
|
||||
Log.WriteEnd("'{0}' GetCollection", ProviderSettings.ProviderName);
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError(String.Format("'{0}' GetCollection", ProviderSettings.ProviderName), ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod, SoapHeader("settings")]
|
||||
public bool RemoveCollection(string organizationId, string collectionName)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.WriteStart("'{0}' RemoveCollection", ProviderSettings.ProviderName);
|
||||
var result = RDSProvider.RemoveCollection(organizationId,collectionName);
|
||||
Log.WriteEnd("'{0}' RemoveCollection", ProviderSettings.ProviderName);
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError(String.Format("'{0}' RemoveCollection", ProviderSettings.ProviderName), ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod, SoapHeader("settings")]
|
||||
public bool SetUsersInCollection(string organizationId, string collectionName, List<string> users)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.WriteStart("'{0}' UpdateUsersInCollection", ProviderSettings.ProviderName);
|
||||
var result = RDSProvider.SetUsersInCollection(organizationId, collectionName, users);
|
||||
Log.WriteEnd("'{0}' UpdateUsersInCollection", ProviderSettings.ProviderName);
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError(String.Format("'{0}' UpdateUsersInCollection", ProviderSettings.ProviderName), ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod, SoapHeader("settings")]
|
||||
public void AddSessionHostServerToCollection(string organizationId, string collectionName, RdsServer server)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.WriteStart("'{0}' AddSessionHostServersToCollection", ProviderSettings.ProviderName);
|
||||
RDSProvider.AddSessionHostServerToCollection(organizationId, collectionName, server);
|
||||
Log.WriteEnd("'{0}' AddSessionHostServersToCollection", ProviderSettings.ProviderName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError(String.Format("'{0}' AddSessionHostServersToCollection", ProviderSettings.ProviderName), ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod, SoapHeader("settings")]
|
||||
public void AddSessionHostServersToCollection(string organizationId, string collectionName, List<RdsServer> servers)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.WriteStart("'{0}' AddSessionHostServersToCollection", ProviderSettings.ProviderName);
|
||||
RDSProvider.AddSessionHostServersToCollection(organizationId, collectionName, servers);
|
||||
Log.WriteEnd("'{0}' AddSessionHostServersToCollection", ProviderSettings.ProviderName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError(String.Format("'{0}' AddSessionHostServersToCollection", ProviderSettings.ProviderName), ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod, SoapHeader("settings")]
|
||||
public void RemoveSessionHostServerFromCollection(string organizationId, string collectionName, RdsServer server)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.WriteStart("'{0}' RemoveSessionHostServerFromCollection", ProviderSettings.ProviderName);
|
||||
RDSProvider.RemoveSessionHostServerFromCollection(organizationId, collectionName, server);
|
||||
Log.WriteEnd("'{0}' RemoveSessionHostServerFromCollection", ProviderSettings.ProviderName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError(String.Format("'{0}' RemoveSessionHostServerFromCollection", ProviderSettings.ProviderName), ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod, SoapHeader("settings")]
|
||||
public void RemoveSessionHostServersFromCollection(string organizationId, string collectionName, List<RdsServer> servers)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.WriteStart("'{0}' RemoveSessionHostServersFromCollection", ProviderSettings.ProviderName);
|
||||
RDSProvider.RemoveSessionHostServersFromCollection(organizationId, collectionName, servers);
|
||||
Log.WriteEnd("'{0}' RemoveSessionHostServersFromCollection", ProviderSettings.ProviderName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError(String.Format("'{0}' RemoveSessionHostServersFromCollection", ProviderSettings.ProviderName), ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod, SoapHeader("settings")]
|
||||
public List<StartMenuApp> GetAvailableRemoteApplications(string collectionName)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.WriteStart("'{0}' GetAvailableRemoteApplications", ProviderSettings.ProviderName);
|
||||
var result = RDSProvider.GetAvailableRemoteApplications(collectionName);
|
||||
Log.WriteEnd("'{0}' GetAvailableRemoteApplications", ProviderSettings.ProviderName);
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError(String.Format("'{0}' UpdateUsersInCollection", ProviderSettings.ProviderName), ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod, SoapHeader("settings")]
|
||||
public List<RemoteApplication> GetCollectionRemoteApplications(string collectionName)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.WriteStart("'{0}' GetCollectionRemoteApplications", ProviderSettings.ProviderName);
|
||||
var result = RDSProvider.GetCollectionRemoteApplications(collectionName);
|
||||
Log.WriteEnd("'{0}' GetCollectionRemoteApplications", ProviderSettings.ProviderName);
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError(String.Format("'{0}' GetCollectionRemoteApplications", ProviderSettings.ProviderName), ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod, SoapHeader("settings")]
|
||||
public bool AddRemoteApplication(string collectionName, RemoteApplication remoteApp)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.WriteStart("'{0}' AddRemoteApplication", ProviderSettings.ProviderName);
|
||||
var result = RDSProvider.AddRemoteApplication(collectionName, remoteApp);
|
||||
Log.WriteEnd("'{0}' AddRemoteApplication", ProviderSettings.ProviderName);
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError(String.Format("'{0}' AddRemoteApplication", ProviderSettings.ProviderName), ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod, SoapHeader("settings")]
|
||||
public bool AddRemoteApplications(string collectionName, List<RemoteApplication> remoteApps)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.WriteStart("'{0}' AddRemoteApplications", ProviderSettings.ProviderName);
|
||||
var result = RDSProvider.AddRemoteApplications(collectionName, remoteApps);
|
||||
Log.WriteEnd("'{0}' AddRemoteApplications", ProviderSettings.ProviderName);
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError(String.Format("'{0}' AddRemoteApplications", ProviderSettings.ProviderName), ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod, SoapHeader("settings")]
|
||||
public bool RemoveRemoteApplication(string collectionName, RemoteApplication remoteApp)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.WriteStart("'{0}' RemoveRemoteApplication", ProviderSettings.ProviderName);
|
||||
var result = RDSProvider.RemoveRemoteApplication(collectionName, remoteApp);
|
||||
Log.WriteEnd("'{0}' RemoveRemoteApplication", ProviderSettings.ProviderName);
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError(String.Format("'{0}' RemoveRemoteApplication", ProviderSettings.ProviderName), ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod, SoapHeader("settings")]
|
||||
public bool AddSessionHostFeatureToServer(string hostName)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.WriteStart("'{0}' AddSessionHostFeatureToServer", ProviderSettings.ProviderName);
|
||||
var result = RDSProvider.AddSessionHostFeatureToServer(hostName);
|
||||
Log.WriteEnd("'{0}' AddSessionHostFeatureToServer", ProviderSettings.ProviderName);
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError(String.Format("'{0}' AddSessionHostServersToCollection", ProviderSettings.ProviderName), ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod, SoapHeader("settings")]
|
||||
public bool CheckSessionHostFeatureInstallation(string hostName)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.WriteStart("'{0}' CheckSessionHostFeatureInstallation", ProviderSettings.ProviderName);
|
||||
var result = RDSProvider.CheckSessionHostFeatureInstallation(hostName);
|
||||
Log.WriteEnd("'{0}' CheckSessionHostFeatureInstallation", ProviderSettings.ProviderName);
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError(String.Format("'{0}' CheckSessionHostFeatureInstallation", ProviderSettings.ProviderName), ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[WebMethod, SoapHeader("settings")]
|
||||
public bool CheckServerAvailability(string hostName)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.WriteStart("'{0}' CheckServerAvailability", ProviderSettings.ProviderName);
|
||||
var result = RDSProvider.CheckServerAvailability(hostName);
|
||||
Log.WriteEnd("'{0}' CheckServerAvailability", ProviderSettings.ProviderName);
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError(String.Format("'{0}' CheckServerAvailability", ProviderSettings.ProviderName), ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue