Merge
This commit is contained in:
commit
67e9d865f9
214 changed files with 14786 additions and 7269 deletions
|
@ -35236,12 +35236,15 @@ EXEC sp_xml_preparedocument @idoc OUTPUT, @XmlProperties
|
|||
DELETE FROM ServiceItemProperties
|
||||
WHERE ItemID = @ItemID
|
||||
|
||||
INSERT INTO ServiceItemProperties
|
||||
(
|
||||
ItemID,
|
||||
PropertyName,
|
||||
PropertyValue
|
||||
)
|
||||
-- Add the xml data into a temp table for the capability and robust
|
||||
IF OBJECT_ID('tempdb..#TempTable') IS NOT NULL DROP TABLE #TempTable
|
||||
|
||||
CREATE TABLE #TempTable(
|
||||
ItemID int,
|
||||
PropertyName nvarchar(50),
|
||||
PropertyValue nvarchar(3000))
|
||||
|
||||
INSERT INTO #TempTable (ItemID, PropertyName, PropertyValue)
|
||||
SELECT
|
||||
@ItemID,
|
||||
PropertyName,
|
||||
|
@ -35252,6 +35255,21 @@ FROM OPENXML(@idoc, '/properties/property',1) WITH
|
|||
PropertyValue nvarchar(3000) '@value'
|
||||
) as PV
|
||||
|
||||
-- Move data from temp table to real table
|
||||
INSERT INTO ServiceItemProperties
|
||||
(
|
||||
ItemID,
|
||||
PropertyName,
|
||||
PropertyValue
|
||||
)
|
||||
SELECT
|
||||
ItemID,
|
||||
PropertyName,
|
||||
PropertyValue
|
||||
FROM #TempTable
|
||||
|
||||
DROP TABLE #TempTable
|
||||
|
||||
-- remove document
|
||||
exec sp_xml_removedocument @idoc
|
||||
|
||||
|
|
|
@ -2416,6 +2416,12 @@ INSERT [dbo].[Quotas] ([QuotaID], [GroupID],[QuotaOrder], [QuotaName], [QuotaDe
|
|||
END
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaName] = 'RDS.Collections')
|
||||
BEGIN
|
||||
INSERT [dbo].[Quotas] ([QuotaID], [GroupID],[QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID]) VALUES (491, 45, 2, N'RDS.Collections',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')
|
||||
|
@ -5462,6 +5468,29 @@ CREATE TABLE RDSCollections
|
|||
)
|
||||
GO
|
||||
|
||||
IF NOT EXISTS(SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'RDSCollections' AND COLUMN_NAME = 'DisplayName')
|
||||
BEGIN
|
||||
ALTER TABLE [dbo].[RDSCollections]
|
||||
ADD DisplayName NVARCHAR(255)
|
||||
END
|
||||
GO
|
||||
|
||||
UPDATE [dbo].[RDSCollections] SET DisplayName = [Name] WHERE DisplayName IS NULL
|
||||
|
||||
|
||||
ALTER TABLE [dbo].[RDSCollectionUsers]
|
||||
DROP CONSTRAINT [FK_RDSCollectionUsers_RDSCollectionId]
|
||||
GO
|
||||
|
||||
|
||||
ALTER TABLE [dbo].[RDSCollectionUsers]
|
||||
DROP CONSTRAINT [FK_RDSCollectionUsers_UserId]
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[RDSServers]
|
||||
DROP CONSTRAINT [FK_RDSServers_RDSCollectionId]
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[RDSCollectionUsers] WITH CHECK ADD CONSTRAINT [FK_RDSCollectionUsers_RDSCollectionId] FOREIGN KEY([RDSCollectionId])
|
||||
REFERENCES [dbo].[RDSCollections] ([ID])
|
||||
ON DELETE CASCADE
|
||||
|
@ -5730,7 +5759,8 @@ SELECT
|
|||
CR.ID,
|
||||
CR.ItemID,
|
||||
CR.Name,
|
||||
CR.Description
|
||||
CR.Description,
|
||||
CR.DisplayName
|
||||
FROM @RDSCollections AS C
|
||||
INNER JOIN RDSCollections AS CR ON C.RDSCollectionId = CR.ID
|
||||
WHERE C.ItemPosition BETWEEN @StartRow AND @EndRow'
|
||||
|
@ -5763,7 +5793,8 @@ SELECT
|
|||
Id,
|
||||
ItemId,
|
||||
Name,
|
||||
Description
|
||||
Description,
|
||||
DisplayName
|
||||
FROM RDSCollections
|
||||
WHERE ItemID = @ItemID
|
||||
GO
|
||||
|
@ -5782,9 +5813,10 @@ SELECT TOP 1
|
|||
Id,
|
||||
Name,
|
||||
ItemId,
|
||||
Description
|
||||
Description,
|
||||
DisplayName
|
||||
FROM RDSCollections
|
||||
WHERE Name = @Name
|
||||
WHERE DisplayName = @Name
|
||||
GO
|
||||
|
||||
|
||||
|
@ -5801,7 +5833,8 @@ SELECT TOP 1
|
|||
Id,
|
||||
ItemId,
|
||||
Name,
|
||||
Description
|
||||
Description,
|
||||
DisplayName
|
||||
FROM RDSCollections
|
||||
WHERE ID = @ID
|
||||
GO
|
||||
|
@ -5815,7 +5848,8 @@ CREATE PROCEDURE [dbo].[AddRDSCollection]
|
|||
@RDSCollectionID INT OUTPUT,
|
||||
@ItemID INT,
|
||||
@Name NVARCHAR(255),
|
||||
@Description NVARCHAR(255)
|
||||
@Description NVARCHAR(255),
|
||||
@DisplayName NVARCHAR(255)
|
||||
)
|
||||
AS
|
||||
|
||||
|
@ -5823,13 +5857,15 @@ INSERT INTO RDSCollections
|
|||
(
|
||||
ItemID,
|
||||
Name,
|
||||
Description
|
||||
Description,
|
||||
DisplayName
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@ItemID,
|
||||
@Name,
|
||||
@Description
|
||||
@Description,
|
||||
@DisplayName
|
||||
)
|
||||
|
||||
SET @RDSCollectionID = SCOPE_IDENTITY()
|
||||
|
@ -5846,7 +5882,8 @@ CREATE PROCEDURE [dbo].[UpdateRDSCollection]
|
|||
@ID INT,
|
||||
@ItemID INT,
|
||||
@Name NVARCHAR(255),
|
||||
@Description NVARCHAR(255)
|
||||
@Description NVARCHAR(255),
|
||||
@DisplayName NVARCHAR(255)
|
||||
)
|
||||
AS
|
||||
|
||||
|
@ -5854,7 +5891,8 @@ UPDATE RDSCollections
|
|||
SET
|
||||
ItemID = @ItemID,
|
||||
Name = @Name,
|
||||
Description = @Description
|
||||
Description = @Description,
|
||||
DisplayName = @DisplayName
|
||||
WHERE ID = @Id
|
||||
GO
|
||||
|
||||
|
@ -5970,6 +6008,36 @@ SELECT
|
|||
RETURN
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetOrganizationRdsCollectionsCount')
|
||||
DROP PROCEDURE GetOrganizationRdsCollectionsCount
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].GetOrganizationRdsCollectionsCount
|
||||
(
|
||||
@ItemID INT,
|
||||
@TotalNumber int OUTPUT
|
||||
)
|
||||
AS
|
||||
SELECT
|
||||
@TotalNumber = Count([Id])
|
||||
FROM [dbo].[RDSCollections] WHERE [ItemId] = @ItemId
|
||||
RETURN
|
||||
GO
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetOrganizationRdsServersCount')
|
||||
DROP PROCEDURE GetOrganizationRdsServersCount
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].GetOrganizationRdsServersCount
|
||||
(
|
||||
@ItemID INT,
|
||||
@TotalNumber int OUTPUT
|
||||
)
|
||||
AS
|
||||
SELECT
|
||||
@TotalNumber = Count([Id])
|
||||
FROM [dbo].[RDSServers] WHERE [ItemId] = @ItemId
|
||||
RETURN
|
||||
GO
|
||||
|
||||
-- wsp-10269: Changed php extension path in default properties for IIS70 and IIS80 provider
|
||||
update ServiceDefaultProperties
|
||||
|
@ -7566,3 +7634,754 @@ COMMIT TRAN
|
|||
RETURN
|
||||
|
||||
GO
|
||||
|
||||
|
||||
-- WebDAv portal
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'WebDavAccessTokens')
|
||||
DROP TABLE WebDavAccessTokens
|
||||
GO
|
||||
CREATE TABLE WebDavAccessTokens
|
||||
(
|
||||
ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
|
||||
FilePath NVARCHAR(MAX) NOT NULL,
|
||||
AuthData NVARCHAR(MAX) NOT NULL,
|
||||
AccessToken UNIQUEIDENTIFIER NOT NULL,
|
||||
ExpirationDate DATETIME NOT NULL,
|
||||
AccountID INT NOT NULL ,
|
||||
ItemId INT NOT NULL
|
||||
)
|
||||
GO
|
||||
|
||||
ALTER TABLE [dbo].[WebDavAccessTokens] WITH CHECK ADD CONSTRAINT [FK_WebDavAccessTokens_UserId] FOREIGN KEY([AccountID])
|
||||
REFERENCES [dbo].[ExchangeAccounts] ([AccountID])
|
||||
ON DELETE CASCADE
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'AddWebDavAccessToken')
|
||||
DROP PROCEDURE AddWebDavAccessToken
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[AddWebDavAccessToken]
|
||||
(
|
||||
@TokenID INT OUTPUT,
|
||||
@FilePath NVARCHAR(MAX),
|
||||
@AccessToken UNIQUEIDENTIFIER,
|
||||
@AuthData NVARCHAR(MAX),
|
||||
@ExpirationDate DATETIME,
|
||||
@AccountID INT,
|
||||
@ItemId INT
|
||||
)
|
||||
AS
|
||||
INSERT INTO WebDavAccessTokens
|
||||
(
|
||||
FilePath,
|
||||
AccessToken,
|
||||
AuthData,
|
||||
ExpirationDate,
|
||||
AccountID ,
|
||||
ItemId
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@FilePath ,
|
||||
@AccessToken ,
|
||||
@AuthData,
|
||||
@ExpirationDate ,
|
||||
@AccountID,
|
||||
@ItemId
|
||||
)
|
||||
|
||||
SET @TokenID = SCOPE_IDENTITY()
|
||||
|
||||
RETURN
|
||||
GO
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'DeleteExpiredWebDavAccessTokens')
|
||||
DROP PROCEDURE DeleteExpiredWebDavAccessTokens
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[DeleteExpiredWebDavAccessTokens]
|
||||
AS
|
||||
DELETE FROM WebDavAccessTokens
|
||||
WHERE ExpirationDate < getdate()
|
||||
GO
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetWebDavAccessTokenById')
|
||||
DROP PROCEDURE GetWebDavAccessTokenById
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[GetWebDavAccessTokenById]
|
||||
(
|
||||
@Id int
|
||||
)
|
||||
AS
|
||||
SELECT
|
||||
ID ,
|
||||
FilePath ,
|
||||
AuthData ,
|
||||
AccessToken,
|
||||
ExpirationDate,
|
||||
AccountID,
|
||||
ItemId
|
||||
FROM WebDavAccessTokens
|
||||
Where ID = @Id AND ExpirationDate > getdate()
|
||||
GO
|
||||
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetWebDavAccessTokenByAccessToken')
|
||||
DROP PROCEDURE GetWebDavAccessTokenByAccessToken
|
||||
GO
|
||||
CREATE PROCEDURE [dbo].[GetWebDavAccessTokenByAccessToken]
|
||||
(
|
||||
@AccessToken UNIQUEIDENTIFIER
|
||||
)
|
||||
AS
|
||||
SELECT
|
||||
ID ,
|
||||
FilePath ,
|
||||
AuthData ,
|
||||
AccessToken,
|
||||
ExpirationDate,
|
||||
AccountID,
|
||||
ItemId
|
||||
FROM WebDavAccessTokens
|
||||
Where AccessToken = @AccessToken AND ExpirationDate > getdate()
|
||||
GO
|
||||
|
||||
--add Deleted Users Quota
|
||||
IF NOT EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaName] = 'HostedSolution.DeletedUsers')
|
||||
BEGIN
|
||||
INSERT [dbo].[Quotas] ([QuotaID], [GroupID],[QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID], [HideQuota]) VALUES (477, 13, 6, N'HostedSolution.DeletedUsers', N'Deleted Users', 2, 0, NULL, NULL)
|
||||
END
|
||||
|
||||
IF NOT EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaName] = 'HostedSolution.DeletedUsersBackupStorageSpace')
|
||||
BEGIN
|
||||
INSERT [dbo].[Quotas] ([QuotaID], [GroupID],[QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID], [HideQuota]) VALUES (478, 13, 6, N'HostedSolution.DeletedUsersBackupStorageSpace', N'Deleted Users Backup Storage Space, Mb', 2, 0, NULL, NULL)
|
||||
END
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'ExchangeDeletedAccounts')
|
||||
CREATE TABLE ExchangeDeletedAccounts
|
||||
(
|
||||
ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
|
||||
AccountID INT NOT NULL,
|
||||
OriginAT INT NOT NULL,
|
||||
StoragePath NVARCHAR(255) NULL,
|
||||
FolderName NVARCHAR(128) NULL,
|
||||
FileName NVARCHAR(128) NULL,
|
||||
ExpirationDate DATETIME NOT NULL
|
||||
)
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetOrganizationStatistics')
|
||||
DROP PROCEDURE [dbo].[GetOrganizationStatistics]
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[GetOrganizationStatistics]
|
||||
(
|
||||
@ItemID int
|
||||
)
|
||||
AS
|
||||
SELECT
|
||||
(SELECT COUNT(*) FROM ExchangeAccounts WHERE (AccountType = 7 OR AccountType = 1 OR AccountType = 6 OR AccountType = 5) AND ItemID = @ItemID) AS CreatedUsers,
|
||||
(SELECT COUNT(*) FROM ExchangeOrganizationDomains WHERE ItemID = @ItemID) AS CreatedDomains,
|
||||
(SELECT COUNT(*) FROM ExchangeAccounts WHERE (AccountType = 8 OR AccountType = 9) AND ItemID = @ItemID) AS CreatedGroups,
|
||||
(SELECT COUNT(*) FROM ExchangeAccounts WHERE AccountType = 11 AND ItemID = @ItemID) AS DeletedUsers
|
||||
RETURN
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'DeleteOrganizationDeletedUser')
|
||||
DROP PROCEDURE [dbo].[DeleteOrganizationDeletedUser]
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[DeleteOrganizationDeletedUser]
|
||||
(
|
||||
@ID int
|
||||
)
|
||||
AS
|
||||
DELETE FROM ExchangeDeletedAccounts WHERE AccountID = @ID
|
||||
RETURN
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetOrganizationDeletedUser')
|
||||
DROP PROCEDURE [dbo].[GetOrganizationDeletedUser]
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[GetOrganizationDeletedUser]
|
||||
(
|
||||
@AccountID int
|
||||
)
|
||||
AS
|
||||
SELECT
|
||||
EDA.AccountID,
|
||||
EDA.OriginAT,
|
||||
EDA.StoragePath,
|
||||
EDA.FolderName,
|
||||
EDA.FileName,
|
||||
EDA.ExpirationDate
|
||||
FROM
|
||||
ExchangeDeletedAccounts AS EDA
|
||||
WHERE
|
||||
EDA.AccountID = @AccountID
|
||||
RETURN
|
||||
GO
|
||||
|
||||
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'AddOrganizationDeletedUser')
|
||||
DROP PROCEDURE [dbo].[AddOrganizationDeletedUser]
|
||||
GO
|
||||
|
||||
CREATE PROCEDURE [dbo].[AddOrganizationDeletedUser]
|
||||
(
|
||||
@ID int OUTPUT,
|
||||
@AccountID int,
|
||||
@OriginAT int,
|
||||
@StoragePath nvarchar(255),
|
||||
@FolderName nvarchar(128),
|
||||
@FileName nvarchar(128),
|
||||
@ExpirationDate datetime
|
||||
)
|
||||
AS
|
||||
|
||||
INSERT INTO ExchangeDeletedAccounts
|
||||
(
|
||||
AccountID,
|
||||
OriginAT,
|
||||
StoragePath,
|
||||
FolderName,
|
||||
FileName,
|
||||
ExpirationDate
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@AccountID,
|
||||
@OriginAT,
|
||||
@StoragePath,
|
||||
@FolderName,
|
||||
@FileName,
|
||||
@ExpirationDate
|
||||
)
|
||||
|
||||
SET @ID = SCOPE_IDENTITY()
|
||||
|
||||
RETURN
|
||||
GO
|
||||
|
||||
ALTER FUNCTION [dbo].[CalculateQuotaUsage]
|
||||
(
|
||||
@PackageID int,
|
||||
@QuotaID int
|
||||
)
|
||||
RETURNS int
|
||||
AS
|
||||
BEGIN
|
||||
|
||||
DECLARE @QuotaTypeID int
|
||||
DECLARE @QuotaName nvarchar(50)
|
||||
SELECT @QuotaTypeID = QuotaTypeID, @QuotaName = QuotaName FROM Quotas
|
||||
WHERE QuotaID = @QuotaID
|
||||
|
||||
IF @QuotaTypeID <> 2
|
||||
RETURN 0
|
||||
|
||||
DECLARE @Result int
|
||||
|
||||
IF @QuotaID = 52 -- diskspace
|
||||
SET @Result = dbo.CalculatePackageDiskspace(@PackageID)
|
||||
ELSE IF @QuotaID = 51 -- bandwidth
|
||||
SET @Result = dbo.CalculatePackageBandwidth(@PackageID)
|
||||
ELSE IF @QuotaID = 53 -- domains
|
||||
SET @Result = (SELECT COUNT(D.DomainID) FROM PackagesTreeCache AS PT
|
||||
INNER JOIN Domains AS D ON D.PackageID = PT.PackageID
|
||||
WHERE IsSubDomain = 0 AND IsInstantAlias = 0 AND IsDomainPointer = 0 AND PT.ParentPackageID = @PackageID)
|
||||
ELSE IF @QuotaID = 54 -- sub-domains
|
||||
SET @Result = (SELECT COUNT(D.DomainID) FROM PackagesTreeCache AS PT
|
||||
INNER JOIN Domains AS D ON D.PackageID = PT.PackageID
|
||||
WHERE IsSubDomain = 1 AND IsInstantAlias = 0 AND IsDomainPointer = 0 AND PT.ParentPackageID = @PackageID)
|
||||
ELSE IF @QuotaID = 220 -- domain pointers
|
||||
SET @Result = (SELECT COUNT(D.DomainID) FROM PackagesTreeCache AS PT
|
||||
INNER JOIN Domains AS D ON D.PackageID = PT.PackageID
|
||||
WHERE IsDomainPointer = 1 AND PT.ParentPackageID = @PackageID)
|
||||
ELSE IF @QuotaID = 71 -- scheduled tasks
|
||||
SET @Result = (SELECT COUNT(S.ScheduleID) FROM PackagesTreeCache AS PT
|
||||
INNER JOIN Schedule AS S ON S.PackageID = PT.PackageID
|
||||
WHERE PT.ParentPackageID = @PackageID)
|
||||
ELSE IF @QuotaID = 305 -- RAM of VPS
|
||||
SET @Result = (SELECT SUM(CAST(SIP.PropertyValue AS int)) FROM ServiceItemProperties AS SIP
|
||||
INNER JOIN ServiceItems AS SI ON SIP.ItemID = SI.ItemID
|
||||
INNER JOIN PackagesTreeCache AS PT ON SI.PackageID = PT.PackageID
|
||||
WHERE SIP.PropertyName = 'RamSize' AND PT.ParentPackageID = @PackageID)
|
||||
ELSE IF @QuotaID = 306 -- HDD of VPS
|
||||
SET @Result = (SELECT SUM(CAST(SIP.PropertyValue AS int)) FROM ServiceItemProperties AS SIP
|
||||
INNER JOIN ServiceItems AS SI ON SIP.ItemID = SI.ItemID
|
||||
INNER JOIN PackagesTreeCache AS PT ON SI.PackageID = PT.PackageID
|
||||
WHERE SIP.PropertyName = 'HddSize' AND PT.ParentPackageID = @PackageID)
|
||||
ELSE IF @QuotaID = 309 -- External IP addresses of VPS
|
||||
SET @Result = (SELECT COUNT(PIP.PackageAddressID) FROM PackageIPAddresses AS PIP
|
||||
INNER JOIN IPAddresses AS IP ON PIP.AddressID = IP.AddressID
|
||||
INNER JOIN PackagesTreeCache AS PT ON PIP.PackageID = PT.PackageID
|
||||
WHERE PT.ParentPackageID = @PackageID AND IP.PoolID = 3)
|
||||
ELSE IF @QuotaID = 100 -- Dedicated Web IP addresses
|
||||
SET @Result = (SELECT COUNT(PIP.PackageAddressID) FROM PackageIPAddresses AS PIP
|
||||
INNER JOIN IPAddresses AS IP ON PIP.AddressID = IP.AddressID
|
||||
INNER JOIN PackagesTreeCache AS PT ON PIP.PackageID = PT.PackageID
|
||||
WHERE PT.ParentPackageID = @PackageID AND IP.PoolID = 2)
|
||||
ELSE IF @QuotaID = 350 -- RAM of VPSforPc
|
||||
SET @Result = (SELECT SUM(CAST(SIP.PropertyValue AS int)) FROM ServiceItemProperties AS SIP
|
||||
INNER JOIN ServiceItems AS SI ON SIP.ItemID = SI.ItemID
|
||||
INNER JOIN PackagesTreeCache AS PT ON SI.PackageID = PT.PackageID
|
||||
WHERE SIP.PropertyName = 'Memory' AND PT.ParentPackageID = @PackageID)
|
||||
ELSE IF @QuotaID = 351 -- HDD of VPSforPc
|
||||
SET @Result = (SELECT SUM(CAST(SIP.PropertyValue AS int)) FROM ServiceItemProperties AS SIP
|
||||
INNER JOIN ServiceItems AS SI ON SIP.ItemID = SI.ItemID
|
||||
INNER JOIN PackagesTreeCache AS PT ON SI.PackageID = PT.PackageID
|
||||
WHERE SIP.PropertyName = 'HddSize' AND PT.ParentPackageID = @PackageID)
|
||||
ELSE IF @QuotaID = 354 -- External IP addresses of VPSforPc
|
||||
SET @Result = (SELECT COUNT(PIP.PackageAddressID) FROM PackageIPAddresses AS PIP
|
||||
INNER JOIN IPAddresses AS IP ON PIP.AddressID = IP.AddressID
|
||||
INNER JOIN PackagesTreeCache AS PT ON PIP.PackageID = PT.PackageID
|
||||
WHERE PT.ParentPackageID = @PackageID AND IP.PoolID = 3)
|
||||
ELSE IF @QuotaID = 319 -- BB Users
|
||||
SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts ea
|
||||
INNER JOIN BlackBerryUsers bu ON ea.AccountID = bu.AccountID
|
||||
INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
|
||||
INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
|
||||
WHERE pt.ParentPackageID = @PackageID)
|
||||
ELSE IF @QuotaID = 320 -- OCS Users
|
||||
SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts ea
|
||||
INNER JOIN OCSUsers ocs ON ea.AccountID = ocs.AccountID
|
||||
INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
|
||||
INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
|
||||
WHERE pt.ParentPackageID = @PackageID)
|
||||
ELSE IF @QuotaID = 206 -- HostedSolution.Users
|
||||
SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts AS ea
|
||||
INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
|
||||
INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
|
||||
WHERE pt.ParentPackageID = @PackageID AND ea.AccountType IN (1,5,6,7))
|
||||
ELSE IF @QuotaID = 78 -- Exchange2007.Mailboxes
|
||||
SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts AS ea
|
||||
INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
|
||||
INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
|
||||
WHERE pt.ParentPackageID = @PackageID
|
||||
AND ea.AccountType IN (1)
|
||||
AND ea.MailboxPlanId IS NOT NULL)
|
||||
ELSE IF @QuotaID = 77 -- Exchange2007.DiskSpace
|
||||
SET @Result = (SELECT SUM(B.MailboxSizeMB) FROM ExchangeAccounts AS ea
|
||||
INNER JOIN ExchangeMailboxPlans AS B ON ea.MailboxPlanId = B.MailboxPlanId
|
||||
INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
|
||||
INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
|
||||
WHERE pt.ParentPackageID = @PackageID)
|
||||
ELSE IF @QuotaID = 370 -- Lync.Users
|
||||
SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts AS ea
|
||||
INNER JOIN LyncUsers lu ON ea.AccountID = lu.AccountID
|
||||
INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
|
||||
INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
|
||||
WHERE pt.ParentPackageID = @PackageID)
|
||||
ELSE IF @QuotaID = 376 -- Lync.EVUsers
|
||||
SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts AS ea
|
||||
INNER JOIN LyncUsers lu ON ea.AccountID = lu.AccountID
|
||||
INNER JOIN LyncUserPlans lp ON lu.LyncUserPlanId = lp.LyncUserPlanId
|
||||
INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
|
||||
INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
|
||||
WHERE pt.ParentPackageID = @PackageID AND lp.EnterpriseVoice = 1)
|
||||
ELSE IF @QuotaID = 381 -- Dedicated Lync Phone Numbers
|
||||
SET @Result = (SELECT COUNT(PIP.PackageAddressID) FROM PackageIPAddresses AS PIP
|
||||
INNER JOIN IPAddresses AS IP ON PIP.AddressID = IP.AddressID
|
||||
INNER JOIN PackagesTreeCache AS PT ON PIP.PackageID = PT.PackageID
|
||||
WHERE PT.ParentPackageID = @PackageID AND IP.PoolID = 5)
|
||||
ELSE IF @QuotaID = 430 -- Enterprise Storage
|
||||
SET @Result = (SELECT SUM(ESF.FolderQuota) FROM EnterpriseFolders AS ESF
|
||||
INNER JOIN ServiceItems SI ON ESF.ItemID = SI.ItemID
|
||||
INNER JOIN PackagesTreeCache PT ON SI.PackageID = PT.PackageID
|
||||
WHERE PT.ParentPackageID = @PackageID)
|
||||
ELSE IF @QuotaID = 431 -- Enterprise Storage Folders
|
||||
SET @Result = (SELECT COUNT(ESF.EnterpriseFolderID) FROM EnterpriseFolders AS ESF
|
||||
INNER JOIN ServiceItems SI ON ESF.ItemID = SI.ItemID
|
||||
INNER JOIN PackagesTreeCache PT ON SI.PackageID = PT.PackageID
|
||||
WHERE PT.ParentPackageID = @PackageID)
|
||||
ELSE IF @QuotaID = 423 -- HostedSolution.SecurityGroups
|
||||
SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts AS ea
|
||||
INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
|
||||
INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
|
||||
WHERE pt.ParentPackageID = @PackageID AND ea.AccountType IN (8,9))
|
||||
ELSE IF @QuotaID = 477 -- HostedSolution.DeletedUsers
|
||||
SET @Result = (SELECT COUNT(ea.AccountID) FROM ExchangeAccounts AS ea
|
||||
INNER JOIN ServiceItems si ON ea.ItemID = si.ItemID
|
||||
INNER JOIN PackagesTreeCache pt ON si.PackageID = pt.PackageID
|
||||
WHERE pt.ParentPackageID = @PackageID AND ea.AccountType = 11)
|
||||
ELSE IF @QuotaName like 'ServiceLevel.%' -- Support Service Level Quota
|
||||
BEGIN
|
||||
DECLARE @LevelID int
|
||||
|
||||
SELECT @LevelID = LevelID FROM SupportServiceLevels
|
||||
WHERE LevelName = REPLACE(@QuotaName,'ServiceLevel.','')
|
||||
|
||||
IF (@LevelID IS NOT NULL)
|
||||
SET @Result = (SELECT COUNT(EA.AccountID)
|
||||
FROM SupportServiceLevels AS SL
|
||||
INNER JOIN ExchangeAccounts AS EA ON SL.LevelID = EA.LevelID
|
||||
INNER JOIN ServiceItems SI ON EA.ItemID = SI.ItemID
|
||||
INNER JOIN PackagesTreeCache PT ON SI.PackageID = PT.PackageID
|
||||
WHERE EA.LevelID = @LevelID AND PT.ParentPackageID = @PackageID)
|
||||
ELSE SET @Result = 0
|
||||
END
|
||||
ELSE
|
||||
SET @Result = (SELECT COUNT(SI.ItemID) FROM Quotas AS Q
|
||||
INNER JOIN ServiceItems AS SI ON SI.ItemTypeID = Q.ItemTypeID
|
||||
INNER JOIN PackagesTreeCache AS PT ON SI.PackageID = PT.PackageID AND PT.ParentPackageID = @PackageID
|
||||
WHERE Q.QuotaID = @QuotaID)
|
||||
|
||||
RETURN @Result
|
||||
END
|
||||
GO
|
||||
|
||||
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='ExchangeMailboxPlans' AND COLS.name='EnableForceArchiveDeletion')
|
||||
BEGIN
|
||||
ALTER TABLE [dbo].[ExchangeMailboxPlans] ADD [EnableForceArchiveDeletion] [bit] NULL
|
||||
END
|
||||
GO
|
||||
|
||||
ALTER PROCEDURE [dbo].[AddExchangeMailboxPlan]
|
||||
(
|
||||
@MailboxPlanId int OUTPUT,
|
||||
@ItemID int,
|
||||
@MailboxPlan nvarchar(300),
|
||||
@EnableActiveSync bit,
|
||||
@EnableIMAP bit,
|
||||
@EnableMAPI bit,
|
||||
@EnableOWA bit,
|
||||
@EnablePOP bit,
|
||||
@IsDefault bit,
|
||||
@IssueWarningPct int,
|
||||
@KeepDeletedItemsDays int,
|
||||
@MailboxSizeMB int,
|
||||
@MaxReceiveMessageSizeKB int,
|
||||
@MaxRecipients int,
|
||||
@MaxSendMessageSizeKB int,
|
||||
@ProhibitSendPct int,
|
||||
@ProhibitSendReceivePct int ,
|
||||
@HideFromAddressBook bit,
|
||||
@MailboxPlanType int,
|
||||
@AllowLitigationHold bit,
|
||||
@RecoverableItemsWarningPct int,
|
||||
@RecoverableItemsSpace int,
|
||||
@LitigationHoldUrl nvarchar(256),
|
||||
@LitigationHoldMsg nvarchar(512),
|
||||
@Archiving bit,
|
||||
@EnableArchiving bit,
|
||||
@ArchiveSizeMB int,
|
||||
@ArchiveWarningPct int,
|
||||
@EnableForceArchiveDeletion bit
|
||||
)
|
||||
AS
|
||||
|
||||
IF (((SELECT Count(*) FROM ExchangeMailboxPlans WHERE ItemId = @ItemID) = 0) AND (@MailboxPlanType=0))
|
||||
BEGIN
|
||||
SET @IsDefault = 1
|
||||
END
|
||||
ELSE
|
||||
BEGIN
|
||||
IF ((@IsDefault = 1) AND (@MailboxPlanType=0))
|
||||
BEGIN
|
||||
UPDATE ExchangeMailboxPlans SET IsDefault = 0 WHERE ItemID = @ItemID
|
||||
END
|
||||
END
|
||||
|
||||
INSERT INTO ExchangeMailboxPlans
|
||||
(
|
||||
ItemID,
|
||||
MailboxPlan,
|
||||
EnableActiveSync,
|
||||
EnableIMAP,
|
||||
EnableMAPI,
|
||||
EnableOWA,
|
||||
EnablePOP,
|
||||
IsDefault,
|
||||
IssueWarningPct,
|
||||
KeepDeletedItemsDays,
|
||||
MailboxSizeMB,
|
||||
MaxReceiveMessageSizeKB,
|
||||
MaxRecipients,
|
||||
MaxSendMessageSizeKB,
|
||||
ProhibitSendPct,
|
||||
ProhibitSendReceivePct,
|
||||
HideFromAddressBook,
|
||||
MailboxPlanType,
|
||||
AllowLitigationHold,
|
||||
RecoverableItemsWarningPct,
|
||||
RecoverableItemsSpace,
|
||||
LitigationHoldUrl,
|
||||
LitigationHoldMsg,
|
||||
Archiving,
|
||||
EnableArchiving,
|
||||
ArchiveSizeMB,
|
||||
ArchiveWarningPct,
|
||||
EnableForceArchiveDeletion
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@ItemID,
|
||||
@MailboxPlan,
|
||||
@EnableActiveSync,
|
||||
@EnableIMAP,
|
||||
@EnableMAPI,
|
||||
@EnableOWA,
|
||||
@EnablePOP,
|
||||
@IsDefault,
|
||||
@IssueWarningPct,
|
||||
@KeepDeletedItemsDays,
|
||||
@MailboxSizeMB,
|
||||
@MaxReceiveMessageSizeKB,
|
||||
@MaxRecipients,
|
||||
@MaxSendMessageSizeKB,
|
||||
@ProhibitSendPct,
|
||||
@ProhibitSendReceivePct,
|
||||
@HideFromAddressBook,
|
||||
@MailboxPlanType,
|
||||
@AllowLitigationHold,
|
||||
@RecoverableItemsWarningPct,
|
||||
@RecoverableItemsSpace,
|
||||
@LitigationHoldUrl,
|
||||
@LitigationHoldMsg,
|
||||
@Archiving,
|
||||
@EnableArchiving,
|
||||
@ArchiveSizeMB,
|
||||
@ArchiveWarningPct,
|
||||
@EnableForceArchiveDeletion
|
||||
)
|
||||
|
||||
SET @MailboxPlanId = SCOPE_IDENTITY()
|
||||
|
||||
RETURN
|
||||
GO
|
||||
|
||||
ALTER PROCEDURE [dbo].[UpdateExchangeMailboxPlan]
|
||||
(
|
||||
@MailboxPlanId int,
|
||||
@MailboxPlan nvarchar(300),
|
||||
@EnableActiveSync bit,
|
||||
@EnableIMAP bit,
|
||||
@EnableMAPI bit,
|
||||
@EnableOWA bit,
|
||||
@EnablePOP bit,
|
||||
@IsDefault bit,
|
||||
@IssueWarningPct int,
|
||||
@KeepDeletedItemsDays int,
|
||||
@MailboxSizeMB int,
|
||||
@MaxReceiveMessageSizeKB int,
|
||||
@MaxRecipients int,
|
||||
@MaxSendMessageSizeKB int,
|
||||
@ProhibitSendPct int,
|
||||
@ProhibitSendReceivePct int ,
|
||||
@HideFromAddressBook bit,
|
||||
@MailboxPlanType int,
|
||||
@AllowLitigationHold bit,
|
||||
@RecoverableItemsWarningPct int,
|
||||
@RecoverableItemsSpace int,
|
||||
@LitigationHoldUrl nvarchar(256),
|
||||
@LitigationHoldMsg nvarchar(512),
|
||||
@Archiving bit,
|
||||
@EnableArchiving bit,
|
||||
@ArchiveSizeMB int,
|
||||
@ArchiveWarningPct int,
|
||||
@EnableForceArchiveDeletion bit
|
||||
)
|
||||
AS
|
||||
|
||||
UPDATE ExchangeMailboxPlans SET
|
||||
MailboxPlan = @MailboxPlan,
|
||||
EnableActiveSync = @EnableActiveSync,
|
||||
EnableIMAP = @EnableIMAP,
|
||||
EnableMAPI = @EnableMAPI,
|
||||
EnableOWA = @EnableOWA,
|
||||
EnablePOP = @EnablePOP,
|
||||
IsDefault = @IsDefault,
|
||||
IssueWarningPct= @IssueWarningPct,
|
||||
KeepDeletedItemsDays = @KeepDeletedItemsDays,
|
||||
MailboxSizeMB= @MailboxSizeMB,
|
||||
MaxReceiveMessageSizeKB= @MaxReceiveMessageSizeKB,
|
||||
MaxRecipients= @MaxRecipients,
|
||||
MaxSendMessageSizeKB= @MaxSendMessageSizeKB,
|
||||
ProhibitSendPct= @ProhibitSendPct,
|
||||
ProhibitSendReceivePct = @ProhibitSendReceivePct,
|
||||
HideFromAddressBook = @HideFromAddressBook,
|
||||
MailboxPlanType = @MailboxPlanType,
|
||||
AllowLitigationHold = @AllowLitigationHold,
|
||||
RecoverableItemsWarningPct = @RecoverableItemsWarningPct,
|
||||
RecoverableItemsSpace = @RecoverableItemsSpace,
|
||||
LitigationHoldUrl = @LitigationHoldUrl,
|
||||
LitigationHoldMsg = @LitigationHoldMsg,
|
||||
Archiving = @Archiving,
|
||||
EnableArchiving = @EnableArchiving,
|
||||
ArchiveSizeMB = @ArchiveSizeMB,
|
||||
ArchiveWarningPct = @ArchiveWarningPct,
|
||||
EnableForceArchiveDeletion = @EnableForceArchiveDeletion
|
||||
WHERE MailboxPlanId = @MailboxPlanId
|
||||
|
||||
RETURN
|
||||
GO
|
||||
|
||||
ALTER PROCEDURE [dbo].[GetExchangeMailboxPlan]
|
||||
(
|
||||
@MailboxPlanId int
|
||||
)
|
||||
AS
|
||||
SELECT
|
||||
MailboxPlanId,
|
||||
ItemID,
|
||||
MailboxPlan,
|
||||
EnableActiveSync,
|
||||
EnableIMAP,
|
||||
EnableMAPI,
|
||||
EnableOWA,
|
||||
EnablePOP,
|
||||
IsDefault,
|
||||
IssueWarningPct,
|
||||
KeepDeletedItemsDays,
|
||||
MailboxSizeMB,
|
||||
MaxReceiveMessageSizeKB,
|
||||
MaxRecipients,
|
||||
MaxSendMessageSizeKB,
|
||||
ProhibitSendPct,
|
||||
ProhibitSendReceivePct,
|
||||
HideFromAddressBook,
|
||||
MailboxPlanType,
|
||||
AllowLitigationHold,
|
||||
RecoverableItemsWarningPct,
|
||||
RecoverableItemsSpace,
|
||||
LitigationHoldUrl,
|
||||
LitigationHoldMsg,
|
||||
Archiving,
|
||||
EnableArchiving,
|
||||
ArchiveSizeMB,
|
||||
ArchiveWarningPct,
|
||||
EnableForceArchiveDeletion
|
||||
FROM
|
||||
ExchangeMailboxPlans
|
||||
WHERE
|
||||
MailboxPlanId = @MailboxPlanId
|
||||
RETURN
|
||||
GO
|
||||
|
||||
ALTER PROCEDURE [dbo].[GetExchangeMailboxPlans]
|
||||
(
|
||||
@ItemID int,
|
||||
@Archiving bit
|
||||
)
|
||||
AS
|
||||
SELECT
|
||||
MailboxPlanId,
|
||||
ItemID,
|
||||
MailboxPlan,
|
||||
EnableActiveSync,
|
||||
EnableIMAP,
|
||||
EnableMAPI,
|
||||
EnableOWA,
|
||||
EnablePOP,
|
||||
IsDefault,
|
||||
IssueWarningPct,
|
||||
KeepDeletedItemsDays,
|
||||
MailboxSizeMB,
|
||||
MaxReceiveMessageSizeKB,
|
||||
MaxRecipients,
|
||||
MaxSendMessageSizeKB,
|
||||
ProhibitSendPct,
|
||||
ProhibitSendReceivePct,
|
||||
HideFromAddressBook,
|
||||
MailboxPlanType,
|
||||
Archiving,
|
||||
EnableArchiving,
|
||||
ArchiveSizeMB,
|
||||
ArchiveWarningPct,
|
||||
EnableForceArchiveDeletion
|
||||
FROM
|
||||
ExchangeMailboxPlans
|
||||
WHERE
|
||||
ItemID = @ItemID
|
||||
AND ((Archiving=@Archiving) OR ((@Archiving=0) AND (Archiving IS NULL)))
|
||||
ORDER BY MailboxPlan
|
||||
RETURN
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (SELECT * FROM [dbo].[ScheduleTasks] WHERE [TaskID] = 'SCHEDULE_TASK_DELETE_EXCHANGE_ACCOUNTS')
|
||||
BEGIN
|
||||
INSERT INTO [dbo].[ScheduleTasks] ([TaskID], [TaskType], [RoleID]) VALUES (N'SCHEDULE_TASK_DELETE_EXCHANGE_ACCOUNTS', N'WebsitePanel.EnterpriseServer.DeleteExchangeAccountsTask, WebsitePanel.EnterpriseServer.Code', 3)
|
||||
END
|
||||
GO
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ALTER PROCEDURE [dbo].[UpdateServiceItem]
|
||||
(
|
||||
@ActorID int,
|
||||
@ItemID int,
|
||||
@ItemName nvarchar(500),
|
||||
@XmlProperties ntext
|
||||
)
|
||||
AS
|
||||
BEGIN TRAN
|
||||
|
||||
-- check rights
|
||||
DECLARE @PackageID int
|
||||
SELECT PackageID = @PackageID FROM ServiceItems
|
||||
WHERE ItemID = @ItemID
|
||||
|
||||
IF dbo.CheckActorPackageRights(@ActorID, @PackageID) = 0
|
||||
RAISERROR('You are not allowed to access this package', 16, 1)
|
||||
|
||||
-- update item
|
||||
UPDATE ServiceItems SET ItemName = @ItemName
|
||||
WHERE ItemID=@ItemID
|
||||
|
||||
DECLARE @idoc int
|
||||
--Create an internal representation of the XML document.
|
||||
EXEC sp_xml_preparedocument @idoc OUTPUT, @XmlProperties
|
||||
|
||||
-- Execute a SELECT statement that uses the OPENXML rowset provider.
|
||||
DELETE FROM ServiceItemProperties
|
||||
WHERE ItemID = @ItemID
|
||||
|
||||
-- Add the xml data into a temp table for the capability and robust
|
||||
IF OBJECT_ID('tempdb..#TempTable') IS NOT NULL DROP TABLE #TempTable
|
||||
|
||||
CREATE TABLE #TempTable(
|
||||
ItemID int,
|
||||
PropertyName nvarchar(50),
|
||||
PropertyValue nvarchar(3000))
|
||||
|
||||
INSERT INTO #TempTable (ItemID, PropertyName, PropertyValue)
|
||||
SELECT
|
||||
@ItemID,
|
||||
PropertyName,
|
||||
PropertyValue
|
||||
FROM OPENXML(@idoc, '/properties/property',1) WITH
|
||||
(
|
||||
PropertyName nvarchar(50) '@name',
|
||||
PropertyValue nvarchar(3000) '@value'
|
||||
) as PV
|
||||
|
||||
-- Move data from temp table to real table
|
||||
INSERT INTO ServiceItemProperties
|
||||
(
|
||||
ItemID,
|
||||
PropertyName,
|
||||
PropertyValue
|
||||
)
|
||||
SELECT
|
||||
ItemID,
|
||||
PropertyName,
|
||||
PropertyValue
|
||||
FROM #TempTable
|
||||
|
||||
DROP TABLE #TempTable
|
||||
|
||||
-- remove document
|
||||
exec sp_xml_removedocument @idoc
|
||||
|
||||
COMMIT TRAN
|
||||
|
||||
RETURN
|
||||
GO
|
||||
|
||||
|
||||
|
|
|
@ -326,6 +326,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
public const int CURRENT_USER_IS_CRM_USER = -2708;
|
||||
public const int CURRENT_USER_IS_OCS_USER = -2709;
|
||||
public const int CURRENT_USER_IS_LYNC_USER = -2710;
|
||||
public const int ERROR_DELETED_USERS_RESOURCE_QUOTA_LIMIT = -2711;
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
|
||||
namespace WebsitePanel.EnterpriseServer.Base.HostedSolution
|
||||
{
|
||||
public class WebDavAccessToken
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string FilePath { get; set; }
|
||||
public string AuthData { get; set; }
|
||||
public Guid AccessToken { get; set; }
|
||||
public DateTime ExpirationDate { get; set; }
|
||||
public int AccountId { get; set; }
|
||||
public int ItemId { get; set; }
|
||||
}
|
||||
}
|
|
@ -161,6 +161,8 @@ order by rg.groupOrder
|
|||
public const string STATS_SITES = "Stats.Sites"; // Statistics Sites
|
||||
public const string ORGANIZATIONS = "HostedSolution.Organizations";
|
||||
public const string ORGANIZATION_USERS = "HostedSolution.Users";
|
||||
public const string ORGANIZATION_DELETED_USERS = "HostedSolution.DeletedUsers";
|
||||
public const string ORGANIZATION_DELETED_USERS_BACKUP_STORAGE_SPACE = "HostedSolution.DeletedUsersBackupStorageSpace";
|
||||
public const string ORGANIZATION_DOMAINS = "HostedSolution.Domains";
|
||||
public const string ORGANIZATION_ALLOWCHANGEUPN = "HostedSolution.AllowChangeUPN";
|
||||
public const string ORGANIZATION_SECURITYGROUPS = "HostedSolution.SecurityGroups";
|
||||
|
@ -262,5 +264,6 @@ order by rg.groupOrder
|
|||
|
||||
public const string RDS_USERS = "RDS.Users";
|
||||
public const string RDS_SERVERS = "RDS.Servers";
|
||||
public const string RDS_COLLECTIONS = "RDS.Collections";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,6 +120,7 @@
|
|||
<Compile Include="HostedSolution\ServiceLevel.cs" />
|
||||
<Compile Include="HostedSolution\CRMLycenseTypes.cs" />
|
||||
<Compile Include="HostedSolution\ESPermission.cs" />
|
||||
<Compile Include="HostedSolution\WebDavAccessToken.cs" />
|
||||
<Compile Include="Log\LogRecord.cs" />
|
||||
<Compile Include="Packages\ServiceLevelQuotaValueInfo.cs" />
|
||||
<Compile Include="Packages\HostingPlanContext.cs" />
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -19,10 +19,10 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Data;
|
||||
using WebsitePanel.Providers;
|
||||
using WebsitePanel.Providers.HostedSolution;
|
||||
using WebsitePanel.Providers.ResultObjects;
|
||||
using WebsitePanel.Providers.Common;
|
||||
using WebsitePanel.Providers.ResultObjects;
|
||||
using WebsitePanel.Providers;
|
||||
|
||||
|
||||
/// <remarks/>
|
||||
|
@ -34,6 +34,10 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ServiceProviderItem))]
|
||||
public partial class esExchangeServer : Microsoft.Web.Services3.WebServicesClientProtocol {
|
||||
|
||||
private System.Threading.SendOrPostCallback DeleteDistributionListMemberOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback GetMobileDevicesOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback GetMobileDeviceOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback WipeDataFromDeviceOperationCompleted;
|
||||
|
@ -196,6 +200,10 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
|
||||
private System.Threading.SendOrPostCallback SetMailboxPermissionsOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback ExportMailBoxOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback SetDeletedMailboxOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback CreateContactOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback DeleteContactOperationCompleted;
|
||||
|
@ -236,15 +244,17 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
|
||||
private System.Threading.SendOrPostCallback AddDistributionListMemberOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback DeleteDistributionListMemberOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback GetMobileDevicesOperationCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public esExchangeServer() {
|
||||
this.Url = "http://localhost:9002/esExchangeServer.asmx";
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public event DeleteDistributionListMemberCompletedEventHandler DeleteDistributionListMemberCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event GetMobileDevicesCompletedEventHandler GetMobileDevicesCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event GetMobileDeviceCompletedEventHandler GetMobileDeviceCompleted;
|
||||
|
||||
|
@ -488,6 +498,12 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
/// <remarks/>
|
||||
public event SetMailboxPermissionsCompletedEventHandler SetMailboxPermissionsCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event ExportMailBoxCompletedEventHandler ExportMailBoxCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event SetDeletedMailboxCompletedEventHandler SetDeletedMailboxCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event CreateContactCompletedEventHandler CreateContactCompleted;
|
||||
|
||||
|
@ -549,10 +565,95 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
public event AddDistributionListMemberCompletedEventHandler AddDistributionListMemberCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event DeleteDistributionListMemberCompletedEventHandler DeleteDistributionListMemberCompleted;
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/DeleteDistributionListMember", 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 int DeleteDistributionListMember(int itemId, string distributionListName, int memberId) {
|
||||
object[] results = this.Invoke("DeleteDistributionListMember", new object[] {
|
||||
itemId,
|
||||
distributionListName,
|
||||
memberId});
|
||||
return ((int)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public event GetMobileDevicesCompletedEventHandler GetMobileDevicesCompleted;
|
||||
public System.IAsyncResult BeginDeleteDistributionListMember(int itemId, string distributionListName, int memberId, System.AsyncCallback callback, object asyncState) {
|
||||
return this.BeginInvoke("DeleteDistributionListMember", new object[] {
|
||||
itemId,
|
||||
distributionListName,
|
||||
memberId}, callback, asyncState);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public int EndDeleteDistributionListMember(System.IAsyncResult asyncResult) {
|
||||
object[] results = this.EndInvoke(asyncResult);
|
||||
return ((int)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void DeleteDistributionListMemberAsync(int itemId, string distributionListName, int memberId) {
|
||||
this.DeleteDistributionListMemberAsync(itemId, distributionListName, memberId, null);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void DeleteDistributionListMemberAsync(int itemId, string distributionListName, int memberId, object userState) {
|
||||
if ((this.DeleteDistributionListMemberOperationCompleted == null)) {
|
||||
this.DeleteDistributionListMemberOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDeleteDistributionListMemberOperationCompleted);
|
||||
}
|
||||
this.InvokeAsync("DeleteDistributionListMember", new object[] {
|
||||
itemId,
|
||||
distributionListName,
|
||||
memberId}, this.DeleteDistributionListMemberOperationCompleted, userState);
|
||||
}
|
||||
|
||||
private void OnDeleteDistributionListMemberOperationCompleted(object arg) {
|
||||
if ((this.DeleteDistributionListMemberCompleted != null)) {
|
||||
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||
this.DeleteDistributionListMemberCompleted(this, new DeleteDistributionListMemberCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetMobileDevices", 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 ExchangeMobileDevice[] GetMobileDevices(int itemId, int accountId) {
|
||||
object[] results = this.Invoke("GetMobileDevices", new object[] {
|
||||
itemId,
|
||||
accountId});
|
||||
return ((ExchangeMobileDevice[])(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public System.IAsyncResult BeginGetMobileDevices(int itemId, int accountId, System.AsyncCallback callback, object asyncState) {
|
||||
return this.BeginInvoke("GetMobileDevices", new object[] {
|
||||
itemId,
|
||||
accountId}, callback, asyncState);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public ExchangeMobileDevice[] EndGetMobileDevices(System.IAsyncResult asyncResult) {
|
||||
object[] results = this.EndInvoke(asyncResult);
|
||||
return ((ExchangeMobileDevice[])(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void GetMobileDevicesAsync(int itemId, int accountId) {
|
||||
this.GetMobileDevicesAsync(itemId, accountId, null);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void GetMobileDevicesAsync(int itemId, int accountId, object userState) {
|
||||
if ((this.GetMobileDevicesOperationCompleted == null)) {
|
||||
this.GetMobileDevicesOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetMobileDevicesOperationCompleted);
|
||||
}
|
||||
this.InvokeAsync("GetMobileDevices", new object[] {
|
||||
itemId,
|
||||
accountId}, this.GetMobileDevicesOperationCompleted, userState);
|
||||
}
|
||||
|
||||
private void OnGetMobileDevicesOperationCompleted(object arg) {
|
||||
if ((this.GetMobileDevicesCompleted != null)) {
|
||||
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||
this.GetMobileDevicesCompleted(this, new GetMobileDevicesCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetMobileDevice", RequestNamespace="http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace="http://smbsaas/websitepanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||
|
@ -4458,6 +4559,97 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/ExportMailBox", 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 int ExportMailBox(int itemId, int accountId, string path) {
|
||||
object[] results = this.Invoke("ExportMailBox", new object[] {
|
||||
itemId,
|
||||
accountId,
|
||||
path});
|
||||
return ((int)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public System.IAsyncResult BeginExportMailBox(int itemId, int accountId, string path, System.AsyncCallback callback, object asyncState) {
|
||||
return this.BeginInvoke("ExportMailBox", new object[] {
|
||||
itemId,
|
||||
accountId,
|
||||
path}, callback, asyncState);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public int EndExportMailBox(System.IAsyncResult asyncResult) {
|
||||
object[] results = this.EndInvoke(asyncResult);
|
||||
return ((int)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void ExportMailBoxAsync(int itemId, int accountId, string path) {
|
||||
this.ExportMailBoxAsync(itemId, accountId, path, null);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void ExportMailBoxAsync(int itemId, int accountId, string path, object userState) {
|
||||
if ((this.ExportMailBoxOperationCompleted == null)) {
|
||||
this.ExportMailBoxOperationCompleted = new System.Threading.SendOrPostCallback(this.OnExportMailBoxOperationCompleted);
|
||||
}
|
||||
this.InvokeAsync("ExportMailBox", new object[] {
|
||||
itemId,
|
||||
accountId,
|
||||
path}, this.ExportMailBoxOperationCompleted, userState);
|
||||
}
|
||||
|
||||
private void OnExportMailBoxOperationCompleted(object arg) {
|
||||
if ((this.ExportMailBoxCompleted != null)) {
|
||||
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||
this.ExportMailBoxCompleted(this, new ExportMailBoxCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/SetDeletedMailbox", 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 int SetDeletedMailbox(int itemId, int accountId) {
|
||||
object[] results = this.Invoke("SetDeletedMailbox", new object[] {
|
||||
itemId,
|
||||
accountId});
|
||||
return ((int)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public System.IAsyncResult BeginSetDeletedMailbox(int itemId, int accountId, System.AsyncCallback callback, object asyncState) {
|
||||
return this.BeginInvoke("SetDeletedMailbox", new object[] {
|
||||
itemId,
|
||||
accountId}, callback, asyncState);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public int EndSetDeletedMailbox(System.IAsyncResult asyncResult) {
|
||||
object[] results = this.EndInvoke(asyncResult);
|
||||
return ((int)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void SetDeletedMailboxAsync(int itemId, int accountId) {
|
||||
this.SetDeletedMailboxAsync(itemId, accountId, null);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void SetDeletedMailboxAsync(int itemId, int accountId, object userState) {
|
||||
if ((this.SetDeletedMailboxOperationCompleted == null)) {
|
||||
this.SetDeletedMailboxOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetDeletedMailboxOperationCompleted);
|
||||
}
|
||||
this.InvokeAsync("SetDeletedMailbox", new object[] {
|
||||
itemId,
|
||||
accountId}, this.SetDeletedMailboxOperationCompleted, userState);
|
||||
}
|
||||
|
||||
private void OnSetDeletedMailboxOperationCompleted(object arg) {
|
||||
if ((this.SetDeletedMailboxCompleted != null)) {
|
||||
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||
this.SetDeletedMailboxCompleted(this, new SetDeletedMailboxCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/CreateContact", 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 int CreateContact(int itemId, string displayName, string email) {
|
||||
|
@ -5582,103 +5774,64 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/DeleteDistributionListMember", 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 int DeleteDistributionListMember(int itemId, string distributionListName, int memberId) {
|
||||
object[] results = this.Invoke("DeleteDistributionListMember", new object[] {
|
||||
itemId,
|
||||
distributionListName,
|
||||
memberId});
|
||||
return ((int)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public System.IAsyncResult BeginDeleteDistributionListMember(int itemId, string distributionListName, int memberId, System.AsyncCallback callback, object asyncState) {
|
||||
return this.BeginInvoke("DeleteDistributionListMember", new object[] {
|
||||
itemId,
|
||||
distributionListName,
|
||||
memberId}, callback, asyncState);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public int EndDeleteDistributionListMember(System.IAsyncResult asyncResult) {
|
||||
object[] results = this.EndInvoke(asyncResult);
|
||||
return ((int)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void DeleteDistributionListMemberAsync(int itemId, string distributionListName, int memberId) {
|
||||
this.DeleteDistributionListMemberAsync(itemId, distributionListName, memberId, null);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void DeleteDistributionListMemberAsync(int itemId, string distributionListName, int memberId, object userState) {
|
||||
if ((this.DeleteDistributionListMemberOperationCompleted == null)) {
|
||||
this.DeleteDistributionListMemberOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDeleteDistributionListMemberOperationCompleted);
|
||||
}
|
||||
this.InvokeAsync("DeleteDistributionListMember", new object[] {
|
||||
itemId,
|
||||
distributionListName,
|
||||
memberId}, this.DeleteDistributionListMemberOperationCompleted, userState);
|
||||
}
|
||||
|
||||
private void OnDeleteDistributionListMemberOperationCompleted(object arg) {
|
||||
if ((this.DeleteDistributionListMemberCompleted != null)) {
|
||||
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||
this.DeleteDistributionListMemberCompleted(this, new DeleteDistributionListMemberCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetMobileDevices", 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 ExchangeMobileDevice[] GetMobileDevices(int itemId, int accountId) {
|
||||
object[] results = this.Invoke("GetMobileDevices", new object[] {
|
||||
itemId,
|
||||
accountId});
|
||||
return ((ExchangeMobileDevice[])(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public System.IAsyncResult BeginGetMobileDevices(int itemId, int accountId, System.AsyncCallback callback, object asyncState) {
|
||||
return this.BeginInvoke("GetMobileDevices", new object[] {
|
||||
itemId,
|
||||
accountId}, callback, asyncState);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public ExchangeMobileDevice[] EndGetMobileDevices(System.IAsyncResult asyncResult) {
|
||||
object[] results = this.EndInvoke(asyncResult);
|
||||
return ((ExchangeMobileDevice[])(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void GetMobileDevicesAsync(int itemId, int accountId) {
|
||||
this.GetMobileDevicesAsync(itemId, accountId, null);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void GetMobileDevicesAsync(int itemId, int accountId, object userState) {
|
||||
if ((this.GetMobileDevicesOperationCompleted == null)) {
|
||||
this.GetMobileDevicesOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetMobileDevicesOperationCompleted);
|
||||
}
|
||||
this.InvokeAsync("GetMobileDevices", new object[] {
|
||||
itemId,
|
||||
accountId}, this.GetMobileDevicesOperationCompleted, userState);
|
||||
}
|
||||
|
||||
private void OnGetMobileDevicesOperationCompleted(object arg) {
|
||||
if ((this.GetMobileDevicesCompleted != null)) {
|
||||
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||
this.GetMobileDevicesCompleted(this, new GetMobileDevicesCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public new void CancelAsync(object userState) {
|
||||
base.CancelAsync(userState);
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
public delegate void DeleteDistributionListMemberCompletedEventHandler(object sender, DeleteDistributionListMemberCompletedEventArgs e);
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||
public partial class DeleteDistributionListMemberCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
|
||||
|
||||
private object[] results;
|
||||
|
||||
internal DeleteDistributionListMemberCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
|
||||
base(exception, cancelled, userState) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public int Result {
|
||||
get {
|
||||
this.RaiseExceptionIfNecessary();
|
||||
return ((int)(this.results[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
public delegate void GetMobileDevicesCompletedEventHandler(object sender, GetMobileDevicesCompletedEventArgs e);
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||
public partial class GetMobileDevicesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
|
||||
|
||||
private object[] results;
|
||||
|
||||
internal GetMobileDevicesCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
|
||||
base(exception, cancelled, userState) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public ExchangeMobileDevice[] Result {
|
||||
get {
|
||||
this.RaiseExceptionIfNecessary();
|
||||
return ((ExchangeMobileDevice[])(this.results[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
public delegate void GetMobileDeviceCompletedEventHandler(object sender, GetMobileDeviceCompletedEventArgs e);
|
||||
|
@ -7697,6 +7850,58 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
public delegate void ExportMailBoxCompletedEventHandler(object sender, ExportMailBoxCompletedEventArgs e);
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||
public partial class ExportMailBoxCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
|
||||
|
||||
private object[] results;
|
||||
|
||||
internal ExportMailBoxCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
|
||||
base(exception, cancelled, userState) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public int Result {
|
||||
get {
|
||||
this.RaiseExceptionIfNecessary();
|
||||
return ((int)(this.results[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
public delegate void SetDeletedMailboxCompletedEventHandler(object sender, SetDeletedMailboxCompletedEventArgs e);
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||
public partial class SetDeletedMailboxCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
|
||||
|
||||
private object[] results;
|
||||
|
||||
internal SetDeletedMailboxCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
|
||||
base(exception, cancelled, userState) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public int Result {
|
||||
get {
|
||||
this.RaiseExceptionIfNecessary();
|
||||
return ((int)(this.results[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
public delegate void CreateContactCompletedEventHandler(object sender, CreateContactCompletedEventArgs e);
|
||||
|
@ -8216,56 +8421,4 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
public delegate void DeleteDistributionListMemberCompletedEventHandler(object sender, DeleteDistributionListMemberCompletedEventArgs e);
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||
public partial class DeleteDistributionListMemberCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
|
||||
|
||||
private object[] results;
|
||||
|
||||
internal DeleteDistributionListMemberCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
|
||||
base(exception, cancelled, userState) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public int Result {
|
||||
get {
|
||||
this.RaiseExceptionIfNecessary();
|
||||
return ((int)(this.results[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
public delegate void GetMobileDevicesCompletedEventHandler(object sender, GetMobileDevicesCompletedEventArgs e);
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||
public partial class GetMobileDevicesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
|
||||
|
||||
private object[] results;
|
||||
|
||||
internal GetMobileDevicesCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
|
||||
base(exception, cancelled, userState) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public ExchangeMobileDevice[] Result {
|
||||
get {
|
||||
this.RaiseExceptionIfNecessary();
|
||||
return ((ExchangeMobileDevice[])(this.results[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,10 +20,11 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
|
|||
using System.Diagnostics;
|
||||
using System.Data;
|
||||
using WebsitePanel.Providers.HostedSolution;
|
||||
using WebsitePanel.Providers.Common;
|
||||
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
|
||||
using WebsitePanel.Providers.ResultObjects;
|
||||
using WebsitePanel.Providers.Common;
|
||||
using WebsitePanel.Providers;
|
||||
using WebsitePanel.Providers.Common;
|
||||
|
||||
|
||||
/// <remarks/>
|
||||
|
@ -78,6 +79,8 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
|
|||
|
||||
private System.Threading.SendOrPostCallback ImportUserOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback GetOrganizationDeletedUsersPagedOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback GetOrganizationUsersPagedOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback GetUserGeneralSettingsOperationCompleted;
|
||||
|
@ -90,6 +93,10 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
|
|||
|
||||
private System.Threading.SendOrPostCallback SearchAccountsOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback SetDeletedUserOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback GetArchiveFileBinaryChunkOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback DeleteUserOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback GetPasswordPolicyOperationCompleted;
|
||||
|
@ -201,6 +208,9 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
|
|||
/// <remarks/>
|
||||
public event ImportUserCompletedEventHandler ImportUserCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event GetOrganizationDeletedUsersPagedCompletedEventHandler GetOrganizationDeletedUsersPagedCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event GetOrganizationUsersPagedCompletedEventHandler GetOrganizationUsersPagedCompleted;
|
||||
|
||||
|
@ -219,6 +229,12 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
|
|||
/// <remarks/>
|
||||
public event SearchAccountsCompletedEventHandler SearchAccountsCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event SetDeletedUserCompletedEventHandler SetDeletedUserCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event GetArchiveFileBinaryChunkCompletedEventHandler GetArchiveFileBinaryChunkCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event DeleteUserCompletedEventHandler DeleteUserCompleted;
|
||||
|
||||
|
@ -1299,6 +1315,62 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
|
|||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetOrganizationDeletedUsersPaged", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||
public OrganizationDeletedUsersPaged GetOrganizationDeletedUsersPaged(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) {
|
||||
object[] results = this.Invoke("GetOrganizationDeletedUsersPaged", new object[] {
|
||||
itemId,
|
||||
filterColumn,
|
||||
filterValue,
|
||||
sortColumn,
|
||||
startRow,
|
||||
maximumRows});
|
||||
return ((OrganizationDeletedUsersPaged)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public System.IAsyncResult BeginGetOrganizationDeletedUsersPaged(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, System.AsyncCallback callback, object asyncState) {
|
||||
return this.BeginInvoke("GetOrganizationDeletedUsersPaged", new object[] {
|
||||
itemId,
|
||||
filterColumn,
|
||||
filterValue,
|
||||
sortColumn,
|
||||
startRow,
|
||||
maximumRows}, callback, asyncState);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public OrganizationDeletedUsersPaged EndGetOrganizationDeletedUsersPaged(System.IAsyncResult asyncResult) {
|
||||
object[] results = this.EndInvoke(asyncResult);
|
||||
return ((OrganizationDeletedUsersPaged)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void GetOrganizationDeletedUsersPagedAsync(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) {
|
||||
this.GetOrganizationDeletedUsersPagedAsync(itemId, filterColumn, filterValue, sortColumn, startRow, maximumRows, null);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void GetOrganizationDeletedUsersPagedAsync(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows, object userState) {
|
||||
if ((this.GetOrganizationDeletedUsersPagedOperationCompleted == null)) {
|
||||
this.GetOrganizationDeletedUsersPagedOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetOrganizationDeletedUsersPagedOperationCompleted);
|
||||
}
|
||||
this.InvokeAsync("GetOrganizationDeletedUsersPaged", new object[] {
|
||||
itemId,
|
||||
filterColumn,
|
||||
filterValue,
|
||||
sortColumn,
|
||||
startRow,
|
||||
maximumRows}, this.GetOrganizationDeletedUsersPagedOperationCompleted, userState);
|
||||
}
|
||||
|
||||
private void OnGetOrganizationDeletedUsersPagedOperationCompleted(object arg) {
|
||||
if ((this.GetOrganizationDeletedUsersPagedCompleted != null)) {
|
||||
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||
this.GetOrganizationDeletedUsersPagedCompleted(this, new GetOrganizationDeletedUsersPagedCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetOrganizationUsersPaged", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||
public OrganizationUsersPaged GetOrganizationUsersPaged(int itemId, string filterColumn, string filterValue, string sortColumn, int startRow, int maximumRows) {
|
||||
|
@ -1807,6 +1879,104 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
|
|||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/SetDeletedUser", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||
public int SetDeletedUser(int itemId, int accountId, bool enableForceArchive) {
|
||||
object[] results = this.Invoke("SetDeletedUser", new object[] {
|
||||
itemId,
|
||||
accountId,
|
||||
enableForceArchive});
|
||||
return ((int)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public System.IAsyncResult BeginSetDeletedUser(int itemId, int accountId, bool enableForceArchive, System.AsyncCallback callback, object asyncState) {
|
||||
return this.BeginInvoke("SetDeletedUser", new object[] {
|
||||
itemId,
|
||||
accountId,
|
||||
enableForceArchive}, callback, asyncState);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public int EndSetDeletedUser(System.IAsyncResult asyncResult) {
|
||||
object[] results = this.EndInvoke(asyncResult);
|
||||
return ((int)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void SetDeletedUserAsync(int itemId, int accountId, bool enableForceArchive) {
|
||||
this.SetDeletedUserAsync(itemId, accountId, enableForceArchive, null);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void SetDeletedUserAsync(int itemId, int accountId, bool enableForceArchive, object userState) {
|
||||
if ((this.SetDeletedUserOperationCompleted == null)) {
|
||||
this.SetDeletedUserOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetDeletedUserOperationCompleted);
|
||||
}
|
||||
this.InvokeAsync("SetDeletedUser", new object[] {
|
||||
itemId,
|
||||
accountId,
|
||||
enableForceArchive}, this.SetDeletedUserOperationCompleted, userState);
|
||||
}
|
||||
|
||||
private void OnSetDeletedUserOperationCompleted(object arg) {
|
||||
if ((this.SetDeletedUserCompleted != null)) {
|
||||
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||
this.SetDeletedUserCompleted(this, new SetDeletedUserCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetArchiveFileBinaryChunk", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||
[return: System.Xml.Serialization.XmlElementAttribute(DataType="base64Binary")]
|
||||
public byte[] GetArchiveFileBinaryChunk(int packageId, string path, int offset, int length) {
|
||||
object[] results = this.Invoke("GetArchiveFileBinaryChunk", new object[] {
|
||||
packageId,
|
||||
path,
|
||||
offset,
|
||||
length});
|
||||
return ((byte[])(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public System.IAsyncResult BeginGetArchiveFileBinaryChunk(int packageId, string path, int offset, int length, System.AsyncCallback callback, object asyncState) {
|
||||
return this.BeginInvoke("GetArchiveFileBinaryChunk", new object[] {
|
||||
packageId,
|
||||
path,
|
||||
offset,
|
||||
length}, callback, asyncState);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public byte[] EndGetArchiveFileBinaryChunk(System.IAsyncResult asyncResult) {
|
||||
object[] results = this.EndInvoke(asyncResult);
|
||||
return ((byte[])(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void GetArchiveFileBinaryChunkAsync(int packageId, string path, int offset, int length) {
|
||||
this.GetArchiveFileBinaryChunkAsync(packageId, path, offset, length, null);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void GetArchiveFileBinaryChunkAsync(int packageId, string path, int offset, int length, object userState) {
|
||||
if ((this.GetArchiveFileBinaryChunkOperationCompleted == null)) {
|
||||
this.GetArchiveFileBinaryChunkOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetArchiveFileBinaryChunkOperationCompleted);
|
||||
}
|
||||
this.InvokeAsync("GetArchiveFileBinaryChunk", new object[] {
|
||||
packageId,
|
||||
path,
|
||||
offset,
|
||||
length}, this.GetArchiveFileBinaryChunkOperationCompleted, userState);
|
||||
}
|
||||
|
||||
private void OnGetArchiveFileBinaryChunkOperationCompleted(object arg) {
|
||||
if ((this.GetArchiveFileBinaryChunkCompleted != null)) {
|
||||
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||
this.GetArchiveFileBinaryChunkCompleted(this, new GetArchiveFileBinaryChunkCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/DeleteUser", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||
public int DeleteUser(int itemId, int accountId) {
|
||||
|
@ -3255,6 +3425,32 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
|
|||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
public delegate void GetOrganizationDeletedUsersPagedCompletedEventHandler(object sender, GetOrganizationDeletedUsersPagedCompletedEventArgs e);
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||
public partial class GetOrganizationDeletedUsersPagedCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
|
||||
|
||||
private object[] results;
|
||||
|
||||
internal GetOrganizationDeletedUsersPagedCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
|
||||
base(exception, cancelled, userState) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public OrganizationDeletedUsersPaged Result {
|
||||
get {
|
||||
this.RaiseExceptionIfNecessary();
|
||||
return ((OrganizationDeletedUsersPaged)(this.results[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
public delegate void GetOrganizationUsersPagedCompletedEventHandler(object sender, GetOrganizationUsersPagedCompletedEventArgs e);
|
||||
|
@ -3411,6 +3607,58 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution {
|
|||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
public delegate void SetDeletedUserCompletedEventHandler(object sender, SetDeletedUserCompletedEventArgs e);
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||
public partial class SetDeletedUserCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
|
||||
|
||||
private object[] results;
|
||||
|
||||
internal SetDeletedUserCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
|
||||
base(exception, cancelled, userState) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public int Result {
|
||||
get {
|
||||
this.RaiseExceptionIfNecessary();
|
||||
return ((int)(this.results[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
public delegate void GetArchiveFileBinaryChunkCompletedEventHandler(object sender, GetArchiveFileBinaryChunkCompletedEventArgs e);
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||
public partial class GetArchiveFileBinaryChunkCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
|
||||
|
||||
private object[] results;
|
||||
|
||||
internal GetArchiveFileBinaryChunkCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
|
||||
base(exception, cancelled, userState) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public byte[] Result {
|
||||
get {
|
||||
this.RaiseExceptionIfNecessary();
|
||||
return ((byte[])(this.results[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
public delegate void DeleteUserCompletedEventHandler(object sender, DeleteUserCompletedEventArgs e);
|
||||
|
|
|
@ -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>
|
||||
// This code was generated by a tool.
|
||||
|
@ -116,6 +88,10 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
|
||||
private System.Threading.SendOrPostCallback GetOrganizationRdsUsersCountOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback GetOrganizationRdsServersCountOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback GetOrganizationRdsCollectionsCountOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback GetApplicationUsersOperationCompleted;
|
||||
|
||||
private System.Threading.SendOrPostCallback SetApplicationUsersOperationCompleted;
|
||||
|
@ -212,6 +188,12 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
/// <remarks/>
|
||||
public event GetOrganizationRdsUsersCountCompletedEventHandler GetOrganizationRdsUsersCountCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event GetOrganizationRdsServersCountCompletedEventHandler GetOrganizationRdsServersCountCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event GetOrganizationRdsCollectionsCountCompletedEventHandler GetOrganizationRdsCollectionsCountCompleted;
|
||||
|
||||
/// <remarks/>
|
||||
public event GetApplicationUsersCompletedEventHandler GetApplicationUsersCompleted;
|
||||
|
||||
|
@ -302,11 +284,11 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/AddRdsCollection", 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 AddRdsCollection(int itemId, RdsCollection collection) {
|
||||
public int AddRdsCollection(int itemId, RdsCollection collection) {
|
||||
object[] results = this.Invoke("AddRdsCollection", new object[] {
|
||||
itemId,
|
||||
collection});
|
||||
return ((ResultObject)(results[0]));
|
||||
return ((int)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
|
@ -317,9 +299,9 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
}
|
||||
|
||||
/// <remarks/>
|
||||
public ResultObject EndAddRdsCollection(System.IAsyncResult asyncResult) {
|
||||
public int EndAddRdsCollection(System.IAsyncResult asyncResult) {
|
||||
object[] results = this.EndInvoke(asyncResult);
|
||||
return ((ResultObject)(results[0]));
|
||||
return ((int)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
|
@ -1544,6 +1526,88 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetOrganizationRdsServersCount", 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 int GetOrganizationRdsServersCount(int itemId) {
|
||||
object[] results = this.Invoke("GetOrganizationRdsServersCount", new object[] {
|
||||
itemId});
|
||||
return ((int)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public System.IAsyncResult BeginGetOrganizationRdsServersCount(int itemId, System.AsyncCallback callback, object asyncState) {
|
||||
return this.BeginInvoke("GetOrganizationRdsServersCount", new object[] {
|
||||
itemId}, callback, asyncState);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public int EndGetOrganizationRdsServersCount(System.IAsyncResult asyncResult) {
|
||||
object[] results = this.EndInvoke(asyncResult);
|
||||
return ((int)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void GetOrganizationRdsServersCountAsync(int itemId) {
|
||||
this.GetOrganizationRdsServersCountAsync(itemId, null);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void GetOrganizationRdsServersCountAsync(int itemId, object userState) {
|
||||
if ((this.GetOrganizationRdsServersCountOperationCompleted == null)) {
|
||||
this.GetOrganizationRdsServersCountOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetOrganizationRdsServersCountOperationCompleted);
|
||||
}
|
||||
this.InvokeAsync("GetOrganizationRdsServersCount", new object[] {
|
||||
itemId}, this.GetOrganizationRdsServersCountOperationCompleted, userState);
|
||||
}
|
||||
|
||||
private void OnGetOrganizationRdsServersCountOperationCompleted(object arg) {
|
||||
if ((this.GetOrganizationRdsServersCountCompleted != null)) {
|
||||
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||
this.GetOrganizationRdsServersCountCompleted(this, new GetOrganizationRdsServersCountCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetOrganizationRdsCollectionsCount", 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 int GetOrganizationRdsCollectionsCount(int itemId) {
|
||||
object[] results = this.Invoke("GetOrganizationRdsCollectionsCount", new object[] {
|
||||
itemId});
|
||||
return ((int)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public System.IAsyncResult BeginGetOrganizationRdsCollectionsCount(int itemId, System.AsyncCallback callback, object asyncState) {
|
||||
return this.BeginInvoke("GetOrganizationRdsCollectionsCount", new object[] {
|
||||
itemId}, callback, asyncState);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public int EndGetOrganizationRdsCollectionsCount(System.IAsyncResult asyncResult) {
|
||||
object[] results = this.EndInvoke(asyncResult);
|
||||
return ((int)(results[0]));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void GetOrganizationRdsCollectionsCountAsync(int itemId) {
|
||||
this.GetOrganizationRdsCollectionsCountAsync(itemId, null);
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public void GetOrganizationRdsCollectionsCountAsync(int itemId, object userState) {
|
||||
if ((this.GetOrganizationRdsCollectionsCountOperationCompleted == null)) {
|
||||
this.GetOrganizationRdsCollectionsCountOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetOrganizationRdsCollectionsCountOperationCompleted);
|
||||
}
|
||||
this.InvokeAsync("GetOrganizationRdsCollectionsCount", new object[] {
|
||||
itemId}, this.GetOrganizationRdsCollectionsCountOperationCompleted, userState);
|
||||
}
|
||||
|
||||
private void OnGetOrganizationRdsCollectionsCountOperationCompleted(object arg) {
|
||||
if ((this.GetOrganizationRdsCollectionsCountCompleted != null)) {
|
||||
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||
this.GetOrganizationRdsCollectionsCountCompleted(this, new GetOrganizationRdsCollectionsCountCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetApplicationUsers", 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 string[] GetApplicationUsers(int itemId, int collectionId, RemoteApplication remoteApp) {
|
||||
|
@ -1717,10 +1781,10 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
}
|
||||
|
||||
/// <remarks/>
|
||||
public ResultObject Result {
|
||||
public int Result {
|
||||
get {
|
||||
this.RaiseExceptionIfNecessary();
|
||||
return ((ResultObject)(this.results[0]));
|
||||
return ((int)(this.results[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2401,6 +2465,58 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
public delegate void GetOrganizationRdsServersCountCompletedEventHandler(object sender, GetOrganizationRdsServersCountCompletedEventArgs e);
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||
public partial class GetOrganizationRdsServersCountCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
|
||||
|
||||
private object[] results;
|
||||
|
||||
internal GetOrganizationRdsServersCountCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
|
||||
base(exception, cancelled, userState) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public int Result {
|
||||
get {
|
||||
this.RaiseExceptionIfNecessary();
|
||||
return ((int)(this.results[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
public delegate void GetOrganizationRdsCollectionsCountCompletedEventHandler(object sender, GetOrganizationRdsCollectionsCountCompletedEventArgs e);
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||
public partial class GetOrganizationRdsCollectionsCountCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
|
||||
|
||||
private object[] results;
|
||||
|
||||
internal GetOrganizationRdsCollectionsCountCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
|
||||
base(exception, cancelled, userState) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public int Result {
|
||||
get {
|
||||
this.RaiseExceptionIfNecessary();
|
||||
return ((int)(this.results[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||
public delegate void GetApplicationUsersCompletedEventHandler(object sender, GetApplicationUsersCompletedEventArgs e);
|
||||
|
|
|
@ -2073,7 +2073,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "GetSchedules",
|
||||
new SqlParameter("@actorId", actorId),
|
||||
new SqlParameter("@packageId", packageId));
|
||||
new SqlParameter("@packageId", packageId),
|
||||
new SqlParameter("@recursive", true));
|
||||
}
|
||||
|
||||
public static DataSet GetSchedulesPaged(int actorId, int packageId, bool recursive,
|
||||
|
@ -2367,7 +2368,6 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
#region Exchange Server
|
||||
|
||||
|
||||
public static int AddExchangeAccount(int itemId, int accountType, string accountName,
|
||||
string displayName, string primaryEmailAddress, bool mailEnabledPublicFolder,
|
||||
string mailboxManagerActions, string samAccountName, string accountPassword, int mailboxPlanId, string subscriberNumber)
|
||||
|
@ -2396,7 +2396,6 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return Convert.ToInt32(outParam.Value);
|
||||
}
|
||||
|
||||
|
||||
public static void AddExchangeAccountEmailAddress(int accountId, string emailAddress)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
|
@ -2814,7 +2813,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
bool isDefault, int issueWarningPct, int keepDeletedItemsDays, int mailboxSizeMB, int maxReceiveMessageSizeKB, int maxRecipients,
|
||||
int maxSendMessageSizeKB, int prohibitSendPct, int prohibitSendReceivePct, bool hideFromAddressBook, int mailboxPlanType,
|
||||
bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning, string litigationHoldUrl, string litigationHoldMsg,
|
||||
bool archiving, bool EnableArchiving, int ArchiveSizeMB, int ArchiveWarningPct)
|
||||
bool archiving, bool EnableArchiving, int ArchiveSizeMB, int ArchiveWarningPct, bool enableForceArchiveDeletion)
|
||||
{
|
||||
SqlParameter outParam = new SqlParameter("@MailboxPlanId", SqlDbType.Int);
|
||||
outParam.Direction = ParameterDirection.Output;
|
||||
|
@ -2850,7 +2849,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
new SqlParameter("@Archiving", archiving),
|
||||
new SqlParameter("@EnableArchiving", EnableArchiving),
|
||||
new SqlParameter("@ArchiveSizeMB", ArchiveSizeMB),
|
||||
new SqlParameter("@ArchiveWarningPct", ArchiveWarningPct)
|
||||
new SqlParameter("@ArchiveWarningPct", ArchiveWarningPct),
|
||||
new SqlParameter("@EnableForceArchiveDeletion", enableForceArchiveDeletion)
|
||||
);
|
||||
|
||||
return Convert.ToInt32(outParam.Value);
|
||||
|
@ -2862,7 +2862,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
bool isDefault, int issueWarningPct, int keepDeletedItemsDays, int mailboxSizeMB, int maxReceiveMessageSizeKB, int maxRecipients,
|
||||
int maxSendMessageSizeKB, int prohibitSendPct, int prohibitSendReceivePct, bool hideFromAddressBook, int mailboxPlanType,
|
||||
bool enabledLitigationHold, long recoverabelItemsSpace, long recoverabelItemsWarning, string litigationHoldUrl, string litigationHoldMsg,
|
||||
bool Archiving, bool EnableArchiving, int ArchiveSizeMB, int ArchiveWarningPct)
|
||||
bool Archiving, bool EnableArchiving, int ArchiveSizeMB, int ArchiveWarningPct, bool enableForceArchiveDeletion)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
|
@ -2894,7 +2894,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
new SqlParameter("@Archiving", Archiving),
|
||||
new SqlParameter("@EnableArchiving", EnableArchiving),
|
||||
new SqlParameter("@ArchiveSizeMB", ArchiveSizeMB),
|
||||
new SqlParameter("@ArchiveWarningPct", ArchiveWarningPct)
|
||||
new SqlParameter("@ArchiveWarningPct", ArchiveWarningPct),
|
||||
new SqlParameter("@EnableForceArchiveDeletion", enableForceArchiveDeletion)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -3170,6 +3171,45 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
#region Organizations
|
||||
|
||||
public static int AddOrganizationDeletedUser(int accountId, int originAT, string storagePath, string folderName, string fileName, DateTime expirationDate)
|
||||
{
|
||||
SqlParameter outParam = new SqlParameter("@ID", SqlDbType.Int);
|
||||
outParam.Direction = ParameterDirection.Output;
|
||||
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"AddOrganizationDeletedUser",
|
||||
outParam,
|
||||
new SqlParameter("@AccountID", accountId),
|
||||
new SqlParameter("@OriginAT", originAT),
|
||||
new SqlParameter("@StoragePath", storagePath),
|
||||
new SqlParameter("@FolderName", folderName),
|
||||
new SqlParameter("@FileName", fileName),
|
||||
new SqlParameter("@ExpirationDate", expirationDate)
|
||||
);
|
||||
|
||||
return Convert.ToInt32(outParam.Value);
|
||||
}
|
||||
|
||||
public static void DeleteOrganizationDeletedUser(int id)
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"DeleteOrganizationDeletedUser",
|
||||
new SqlParameter("@ID", id));
|
||||
}
|
||||
|
||||
public static IDataReader GetOrganizationDeletedUser(int accountId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetOrganizationDeletedUser",
|
||||
new SqlParameter("@AccountID", accountId)
|
||||
);
|
||||
}
|
||||
|
||||
public static IDataReader GetAdditionalGroups(int userId)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
|
@ -4330,6 +4370,57 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
#region Enterprise Storage
|
||||
|
||||
public static int AddWebDavAccessToken(Base.HostedSolution.WebDavAccessToken accessToken)
|
||||
{
|
||||
SqlParameter prmId = new SqlParameter("@TokenID", SqlDbType.Int);
|
||||
prmId.Direction = ParameterDirection.Output;
|
||||
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"AddWebDavAccessToken",
|
||||
prmId,
|
||||
new SqlParameter("@AccessToken", accessToken.AccessToken),
|
||||
new SqlParameter("@FilePath", accessToken.FilePath),
|
||||
new SqlParameter("@AuthData", accessToken.AuthData),
|
||||
new SqlParameter("@ExpirationDate", accessToken.ExpirationDate),
|
||||
new SqlParameter("@AccountID", accessToken.AccountId),
|
||||
new SqlParameter("@ItemId", accessToken.ItemId)
|
||||
);
|
||||
|
||||
// read identity
|
||||
return Convert.ToInt32(prmId.Value);
|
||||
}
|
||||
|
||||
public static void DeleteExpiredWebDavAccessTokens()
|
||||
{
|
||||
SqlHelper.ExecuteNonQuery(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"DeleteExpiredWebDavAccessTokens"
|
||||
);
|
||||
}
|
||||
|
||||
public static IDataReader GetWebDavAccessTokenById(int id)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetWebDavAccessTokenById",
|
||||
new SqlParameter("@Id", id)
|
||||
);
|
||||
}
|
||||
|
||||
public static IDataReader GetWebDavAccessTokenByAccessToken(Guid accessToken)
|
||||
{
|
||||
return SqlHelper.ExecuteReader(
|
||||
ConnectionString,
|
||||
CommandType.StoredProcedure,
|
||||
"GetWebDavAccessTokenByAccessToken",
|
||||
new SqlParameter("@AccessToken", accessToken)
|
||||
);
|
||||
}
|
||||
|
||||
public static int AddEntepriseFolder(int itemId, string folderName, int folderQuota, string locationDrive, string homeFolder, string domain)
|
||||
{
|
||||
SqlParameter prmId = new SqlParameter("@FolderID", SqlDbType.Int);
|
||||
|
@ -4544,6 +4635,34 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return Convert.ToInt32(count.Value);
|
||||
}
|
||||
|
||||
public static int GetOrganizationRdsCollectionsCount(int itemId)
|
||||
{
|
||||
SqlParameter count = new SqlParameter("@TotalNumber", SqlDbType.Int);
|
||||
count.Direction = ParameterDirection.Output;
|
||||
|
||||
DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "GetOrganizationRdsCollectionsCount",
|
||||
count,
|
||||
new SqlParameter("@ItemId", itemId));
|
||||
|
||||
// read identity
|
||||
return Convert.ToInt32(count.Value);
|
||||
}
|
||||
|
||||
public static int GetOrganizationRdsServersCount(int itemId)
|
||||
{
|
||||
SqlParameter count = new SqlParameter("@TotalNumber", SqlDbType.Int);
|
||||
count.Direction = ParameterDirection.Output;
|
||||
|
||||
DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
|
||||
ObjectQualifier + "GetOrganizationRdsServersCount",
|
||||
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, collection.DisplayName);
|
||||
|
|
|
@ -152,6 +152,26 @@ namespace WebsitePanel.EnterpriseServer
|
|||
StartESBackgroundTaskInternal("SET_ENTERPRISE_FOLDER_SETTINGS", itemId, folder, permissions, directoyBrowsingEnabled, quota, quotaType);
|
||||
}
|
||||
|
||||
public static int AddWebDavAccessToken(WebDavAccessToken accessToken)
|
||||
{
|
||||
return DataProvider.AddWebDavAccessToken(accessToken);
|
||||
}
|
||||
|
||||
public static void DeleteExpiredWebDavAccessTokens()
|
||||
{
|
||||
DataProvider.DeleteExpiredWebDavAccessTokens();
|
||||
}
|
||||
|
||||
public static WebDavAccessToken GetWebDavAccessTokenById(int id)
|
||||
{
|
||||
return ObjectUtils.FillObjectFromDataReader<WebDavAccessToken>(DataProvider.GetWebDavAccessTokenById(id));
|
||||
}
|
||||
|
||||
public static WebDavAccessToken GetWebDavAccessTokenByAccessToken(Guid accessToken)
|
||||
{
|
||||
return ObjectUtils.FillObjectFromDataReader<WebDavAccessToken>(DataProvider.GetWebDavAccessTokenByAccessToken(accessToken));
|
||||
}
|
||||
|
||||
#region Directory Browsing
|
||||
|
||||
public static bool GetDirectoryBrowseEnabled(int itemId, string siteId)
|
||||
|
|
|
@ -1967,6 +1967,86 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
}
|
||||
|
||||
public static int ExportMailBox(int itemId, int accountId, string path)
|
||||
{
|
||||
// check account
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
|
||||
if (accountCheck < 0)
|
||||
{
|
||||
return accountCheck;
|
||||
}
|
||||
|
||||
// place log record
|
||||
TaskManager.StartTask("EXCHANGE", "EXPORT_MAILBOX", itemId);
|
||||
|
||||
try
|
||||
{
|
||||
// load organization
|
||||
Organization org = GetOrganization(itemId);
|
||||
if (org == null)
|
||||
return -1;
|
||||
|
||||
// load account
|
||||
ExchangeAccount account = GetAccount(itemId, accountId);
|
||||
|
||||
// export mailbox
|
||||
int serviceExchangeId = GetExchangeServiceID(org.PackageId);
|
||||
ExchangeServer exchange = GetExchangeServer(serviceExchangeId, org.ServiceId);
|
||||
exchange.ExportMailBox(org.OrganizationId, account.UserPrincipalName, path);
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
}
|
||||
|
||||
public static int SetDeletedMailbox(int itemId, int accountId)
|
||||
{
|
||||
// check account
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
if (accountCheck < 0) return accountCheck;
|
||||
|
||||
// place log record
|
||||
TaskManager.StartTask("EXCHANGE", "SET_DELETED_MAILBOX", itemId);
|
||||
|
||||
try
|
||||
{
|
||||
// load organization
|
||||
Organization org = GetOrganization(itemId);
|
||||
if (org == null)
|
||||
return -1;
|
||||
|
||||
// load account
|
||||
ExchangeAccount account = GetAccount(itemId, accountId);
|
||||
|
||||
if (BlackBerryController.CheckBlackBerryUserExists(accountId))
|
||||
{
|
||||
BlackBerryController.DeleteBlackBerryUser(itemId, accountId);
|
||||
}
|
||||
|
||||
// delete mailbox
|
||||
int serviceExchangeId = GetExchangeServiceID(org.PackageId);
|
||||
ExchangeServer exchange = GetExchangeServer(serviceExchangeId, org.ServiceId);
|
||||
exchange.DisableMailbox(account.UserPrincipalName);
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
}
|
||||
|
||||
public static int DeleteMailbox(int itemId, int accountId)
|
||||
{
|
||||
|
@ -2998,7 +3078,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
mailboxPlan.MaxSendMessageSizeKB, mailboxPlan.ProhibitSendPct, mailboxPlan.ProhibitSendReceivePct, mailboxPlan.HideFromAddressBook, mailboxPlan.MailboxPlanType,
|
||||
mailboxPlan.AllowLitigationHold, mailboxPlan.RecoverableItemsSpace, mailboxPlan.RecoverableItemsWarningPct,
|
||||
mailboxPlan.LitigationHoldUrl, mailboxPlan.LitigationHoldMsg, mailboxPlan.Archiving, mailboxPlan.EnableArchiving,
|
||||
mailboxPlan.ArchiveSizeMB, mailboxPlan.ArchiveWarningPct);
|
||||
mailboxPlan.ArchiveSizeMB, mailboxPlan.ArchiveWarningPct, mailboxPlan.EnableForceArchiveDeletion);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -3068,9 +3148,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
mailboxPlan.IsDefault, mailboxPlan.IssueWarningPct, mailboxPlan.KeepDeletedItemsDays, mailboxPlan.MailboxSizeMB, mailboxPlan.MaxReceiveMessageSizeKB, mailboxPlan.MaxRecipients,
|
||||
mailboxPlan.MaxSendMessageSizeKB, mailboxPlan.ProhibitSendPct, mailboxPlan.ProhibitSendReceivePct, mailboxPlan.HideFromAddressBook, mailboxPlan.MailboxPlanType,
|
||||
mailboxPlan.AllowLitigationHold, mailboxPlan.RecoverableItemsSpace, mailboxPlan.RecoverableItemsWarningPct,
|
||||
mailboxPlan.LitigationHoldUrl, mailboxPlan.LitigationHoldMsg,
|
||||
mailboxPlan.Archiving, mailboxPlan.EnableArchiving,
|
||||
mailboxPlan.ArchiveSizeMB, mailboxPlan.ArchiveWarningPct);
|
||||
mailboxPlan.LitigationHoldUrl, mailboxPlan.LitigationHoldMsg, mailboxPlan.Archiving, mailboxPlan.EnableArchiving,
|
||||
mailboxPlan.ArchiveSizeMB, mailboxPlan.ArchiveWarningPct, mailboxPlan.EnableForceArchiveDeletion);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
@ -49,6 +49,8 @@ using System.Xml;
|
|||
using System.Xml.Serialization;
|
||||
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
|
||||
using WebsitePanel.Providers.OS;
|
||||
using System.Text.RegularExpressions;
|
||||
using WebsitePanel.Server.Client;
|
||||
|
||||
namespace WebsitePanel.EnterpriseServer
|
||||
{
|
||||
|
@ -71,6 +73,21 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return true;
|
||||
}
|
||||
|
||||
private static bool CheckDeletedUserQuota(int orgId, out int errorCode)
|
||||
{
|
||||
errorCode = 0;
|
||||
OrganizationStatistics stats = GetOrganizationStatistics(orgId);
|
||||
|
||||
|
||||
if (stats.AllocatedDeletedUsers != -1 && (stats.DeletedUsers >= stats.AllocatedDeletedUsers))
|
||||
{
|
||||
errorCode = BusinessErrorCodes.ERROR_DELETED_USERS_RESOURCE_QUOTA_LIMIT;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static string EvaluateMailboxTemplate(int itemId, int accountId,
|
||||
bool pmm, bool emailMode, bool signup, string template)
|
||||
{
|
||||
|
@ -942,6 +959,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
stats.CreatedUsers = tempStats.CreatedUsers;
|
||||
stats.CreatedDomains = tempStats.CreatedDomains;
|
||||
stats.CreatedGroups = tempStats.CreatedGroups;
|
||||
stats.DeletedUsers = tempStats.DeletedUsers;
|
||||
|
||||
PackageContext cntxTmp = PackageController.GetPackageContext(org.PackageId);
|
||||
|
||||
|
@ -992,6 +1010,13 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
stats.UsedEnterpriseStorageSpace = folders.Where(x => x.FRSMQuotaMB != -1).Sum(x => x.FRSMQuotaMB);
|
||||
}
|
||||
|
||||
if (cntxTmp.Groups.ContainsKey(ResourceGroups.RDS))
|
||||
{
|
||||
stats.CreatedRdsUsers = RemoteDesktopServicesController.GetOrganizationRdsUsersCount(org.Id);
|
||||
stats.CreatedRdsCollections = RemoteDesktopServicesController.GetOrganizationRdsCollectionsCount(org.Id);
|
||||
stats.CreatedRdsServers = RemoteDesktopServicesController.GetOrganizationRdsServersCount(org.Id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1066,6 +1091,13 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
stats.UsedEnterpriseStorageSpace += folders.Where(x => x.FRSMQuotaMB != -1).Sum(x => x.FRSMQuotaMB);
|
||||
}
|
||||
|
||||
if (cntxTmp.Groups.ContainsKey(ResourceGroups.RDS))
|
||||
{
|
||||
stats.CreatedRdsUsers += RemoteDesktopServicesController.GetOrganizationRdsUsersCount(o.Id);
|
||||
stats.CreatedRdsCollections += RemoteDesktopServicesController.GetOrganizationRdsCollectionsCount(o.Id);
|
||||
stats.CreatedRdsServers += RemoteDesktopServicesController.GetOrganizationRdsServersCount(o.Id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1076,6 +1108,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
// allocated quotas
|
||||
PackageContext cntx = PackageController.GetPackageContext(org.PackageId);
|
||||
stats.AllocatedUsers = cntx.Quotas[Quotas.ORGANIZATION_USERS].QuotaAllocatedValue;
|
||||
stats.AllocatedDeletedUsers = cntx.Quotas[Quotas.ORGANIZATION_DELETED_USERS].QuotaAllocatedValue;
|
||||
stats.AllocatedDomains = cntx.Quotas[Quotas.ORGANIZATION_DOMAINS].QuotaAllocatedValue;
|
||||
stats.AllocatedGroups = cntx.Quotas[Quotas.ORGANIZATION_SECURITYGROUPS].QuotaAllocatedValue;
|
||||
|
||||
|
@ -1119,6 +1152,13 @@ namespace WebsitePanel.EnterpriseServer
|
|||
stats.AllocatedEnterpriseStorageSpace = cntx.Quotas[Quotas.ENTERPRISESTORAGE_DISKSTORAGESPACE].QuotaAllocatedValue;
|
||||
}
|
||||
|
||||
if (cntx.Groups.ContainsKey(ResourceGroups.RDS))
|
||||
{
|
||||
stats.AllocatedRdsServers = cntx.Quotas[Quotas.RDS_SERVERS].QuotaAllocatedValue;
|
||||
stats.AllocatedRdsCollections = cntx.Quotas[Quotas.RDS_COLLECTIONS].QuotaAllocatedValue;
|
||||
stats.AllocatedRdsUsers = cntx.Quotas[Quotas.RDS_USERS].QuotaAllocatedValue;
|
||||
}
|
||||
|
||||
return stats;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -1336,8 +1376,64 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
#region Users
|
||||
|
||||
public static List<OrganizationDeletedUser> GetOrganizationDeletedUsers(int itemId)
|
||||
{
|
||||
var result = new List<OrganizationDeletedUser>();
|
||||
|
||||
var orgDeletedUsers = ObjectUtils.CreateListFromDataReader<OrganizationUser>(
|
||||
DataProvider.GetExchangeAccounts(itemId, (int)ExchangeAccountType.DeletedUser));
|
||||
|
||||
foreach (var orgDeletedUser in orgDeletedUsers)
|
||||
{
|
||||
OrganizationDeletedUser deletedUser = GetDeletedUser(orgDeletedUser.AccountId);
|
||||
|
||||
if (deletedUser == null)
|
||||
continue;
|
||||
|
||||
deletedUser.User = orgDeletedUser;
|
||||
|
||||
result.Add(deletedUser);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static OrganizationDeletedUsersPaged GetOrganizationDeletedUsersPaged(int itemId, string filterColumn, string filterValue, string sortColumn,
|
||||
int startRow, int maximumRows)
|
||||
{
|
||||
DataSet ds =
|
||||
DataProvider.GetExchangeAccountsPaged(SecurityContext.User.UserId, itemId, ((int)ExchangeAccountType.DeletedUser).ToString(),
|
||||
filterColumn, filterValue, sortColumn, startRow, maximumRows, false);
|
||||
|
||||
OrganizationDeletedUsersPaged result = new OrganizationDeletedUsersPaged();
|
||||
result.RecordsCount = (int)ds.Tables[0].Rows[0][0];
|
||||
|
||||
List<OrganizationUser> Tmpaccounts = new List<OrganizationUser>();
|
||||
ObjectUtils.FillCollectionFromDataView(Tmpaccounts, ds.Tables[1].DefaultView);
|
||||
|
||||
List<OrganizationDeletedUser> deletedUsers = new List<OrganizationDeletedUser>();
|
||||
|
||||
foreach (OrganizationUser user in Tmpaccounts.ToArray())
|
||||
{
|
||||
OrganizationDeletedUser deletedUser = GetDeletedUser(user.AccountId);
|
||||
|
||||
if (deletedUser == null)
|
||||
continue;
|
||||
|
||||
OrganizationUser tmpUser = GetUserGeneralSettings(itemId, user.AccountId);
|
||||
|
||||
if (tmpUser != null)
|
||||
{
|
||||
deletedUser.User = tmpUser;
|
||||
|
||||
deletedUsers.Add(deletedUser);
|
||||
}
|
||||
}
|
||||
|
||||
result.PageDeletedUsers = deletedUsers.ToArray();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static OrganizationUsersPaged GetOrganizationUsersPaged(int itemId, string filterColumn, string filterValue, string sortColumn,
|
||||
int startRow, int maximumRows)
|
||||
|
@ -1731,10 +1827,256 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
else
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
#region Deleted Users
|
||||
|
||||
public static int SetDeletedUser(int itemId, int accountId, bool enableForceArchive)
|
||||
{
|
||||
// check account
|
||||
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
|
||||
if (accountCheck < 0) return accountCheck;
|
||||
|
||||
// place log record
|
||||
TaskManager.StartTask("ORGANIZATION", "SET_DELETED_USER", itemId);
|
||||
|
||||
try
|
||||
{
|
||||
Guid crmUserId = CRMController.GetCrmUserId(accountId);
|
||||
if (crmUserId != Guid.Empty)
|
||||
{
|
||||
return BusinessErrorCodes.CURRENT_USER_IS_CRM_USER;
|
||||
}
|
||||
|
||||
if (DataProvider.CheckOCSUserExists(accountId))
|
||||
{
|
||||
return BusinessErrorCodes.CURRENT_USER_IS_OCS_USER;
|
||||
}
|
||||
|
||||
if (DataProvider.CheckLyncUserExists(accountId))
|
||||
{
|
||||
return BusinessErrorCodes.CURRENT_USER_IS_LYNC_USER;
|
||||
}
|
||||
|
||||
|
||||
// load organization
|
||||
Organization org = GetOrganization(itemId);
|
||||
if (org == null)
|
||||
return -1;
|
||||
|
||||
int errorCode;
|
||||
if (!CheckDeletedUserQuota(org.Id, out errorCode))
|
||||
return errorCode;
|
||||
|
||||
// load account
|
||||
ExchangeAccount account = ExchangeServerController.GetAccount(itemId, accountId);
|
||||
|
||||
string accountName = GetAccountName(account.AccountName);
|
||||
|
||||
var deletedUser = new OrganizationDeletedUser
|
||||
{
|
||||
AccountId = account.AccountId,
|
||||
OriginAT = account.AccountType,
|
||||
ExpirationDate = DateTime.UtcNow.AddHours(1)
|
||||
};
|
||||
|
||||
if (account.AccountType == ExchangeAccountType.User)
|
||||
{
|
||||
Organizations orgProxy = GetOrganizationProxy(org.ServiceId);
|
||||
|
||||
//Disable user in AD
|
||||
orgProxy.DisableUser(accountName, org.OrganizationId);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (enableForceArchive)
|
||||
{
|
||||
var serviceId = PackageController.GetPackageServiceId(org.PackageId, ResourceGroups.HostedOrganizations);
|
||||
|
||||
if (serviceId != 0)
|
||||
{
|
||||
var settings = ServerController.GetServiceSettings(serviceId);
|
||||
|
||||
deletedUser.StoragePath = settings["ArchiveStoragePath"];
|
||||
|
||||
if (!string.IsNullOrEmpty(deletedUser.StoragePath))
|
||||
{
|
||||
deletedUser.FolderName = org.OrganizationId;
|
||||
|
||||
if (!CheckFolderExists(org.PackageId, deletedUser.StoragePath, deletedUser.FolderName))
|
||||
{
|
||||
CreateFolder(org.PackageId, deletedUser.StoragePath, deletedUser.FolderName);
|
||||
}
|
||||
|
||||
QuotaValueInfo diskSpaceQuota = PackageController.GetPackageQuota(org.PackageId, Quotas.ORGANIZATION_DELETED_USERS_BACKUP_STORAGE_SPACE);
|
||||
|
||||
if (diskSpaceQuota.QuotaAllocatedValue != -1)
|
||||
{
|
||||
SetFRSMQuotaOnFolder(org.PackageId, deletedUser.StoragePath, org.OrganizationId, diskSpaceQuota, QuotaType.Hard);
|
||||
}
|
||||
|
||||
deletedUser.FileName = string.Format("{0}.pst", account.UserPrincipalName);
|
||||
|
||||
ExchangeServerController.ExportMailBox(itemId, accountId,
|
||||
FilesController.ConvertToUncPath(serviceId,
|
||||
Path.Combine(GetDirectory(deletedUser.StoragePath), deletedUser.FolderName, deletedUser.FileName)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Set Deleted Mailbox
|
||||
ExchangeServerController.SetDeletedMailbox(itemId, accountId);
|
||||
}
|
||||
|
||||
AddDeletedUser(deletedUser);
|
||||
|
||||
account.AccountType = ExchangeAccountType.DeletedUser;
|
||||
|
||||
UpdateAccount(account);
|
||||
|
||||
var taskId = "SCHEDULE_TASK_DELETE_EXCHANGE_ACCOUNTS";
|
||||
|
||||
if (!CheckScheduleTaskRun(org.PackageId, taskId))
|
||||
{
|
||||
AddScheduleTask(org.PackageId, taskId, "Auto Delete Exchange Account");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TaskManager.CompleteTask();
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] GetArchiveFileBinaryChunk(int packageId, string path, int offset, int length)
|
||||
{
|
||||
var os = GetOS(packageId);
|
||||
|
||||
if (os != null && os.CheckFileServicesInstallation())
|
||||
{
|
||||
return os.GetFileBinaryChunk(path, offset, length);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static bool CheckScheduleTaskRun(int packageId, string taskId)
|
||||
{
|
||||
var schedules = new List<ScheduleInfo>();
|
||||
|
||||
ObjectUtils.FillCollectionFromDataSet(schedules, SchedulerController.GetSchedules(packageId));
|
||||
|
||||
foreach(var schedule in schedules)
|
||||
{
|
||||
if (schedule.TaskId == taskId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static int AddScheduleTask(int packageId, string taskId, string taskName)
|
||||
{
|
||||
return SchedulerController.AddSchedule(new ScheduleInfo
|
||||
{
|
||||
PackageId = packageId,
|
||||
TaskId = taskId,
|
||||
ScheduleName = taskName,
|
||||
ScheduleTypeId = "Daily",
|
||||
FromTime = new DateTime(2000, 1, 1, 0, 0, 0),
|
||||
ToTime = new DateTime(2000, 1, 1, 23, 59, 59),
|
||||
Interval = 3600,
|
||||
StartTime = new DateTime(2000, 01, 01, 0, 30, 0),
|
||||
MaxExecutionTime = 3600,
|
||||
PriorityId = "Normal",
|
||||
Enabled = true,
|
||||
WeekMonthDay = 1,
|
||||
HistoriesNumber = 0
|
||||
});
|
||||
}
|
||||
|
||||
private static bool CheckFolderExists(int packageId, string path, string folderName)
|
||||
{
|
||||
var os = GetOS(packageId);
|
||||
|
||||
if (os != null && os.CheckFileServicesInstallation())
|
||||
{
|
||||
return os.DirectoryExists(Path.Combine(path, folderName));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void CreateFolder(int packageId, string path, string folderName)
|
||||
{
|
||||
var os = GetOS(packageId);
|
||||
|
||||
if (os != null && os.CheckFileServicesInstallation())
|
||||
{
|
||||
os.CreateDirectory(Path.Combine(path, folderName));
|
||||
}
|
||||
}
|
||||
|
||||
private static void RemoveArchive(int packageId, string path, string folderName, string fileName)
|
||||
{
|
||||
var os = GetOS(packageId);
|
||||
|
||||
if (os != null && os.CheckFileServicesInstallation())
|
||||
{
|
||||
os.DeleteFile(Path.Combine(path, folderName, fileName));
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetLocationDrive(string path)
|
||||
{
|
||||
var drive = System.IO.Path.GetPathRoot(path);
|
||||
|
||||
return drive.Split(':')[0];
|
||||
}
|
||||
|
||||
private static string GetDirectory(string path)
|
||||
{
|
||||
var drive = System.IO.Path.GetPathRoot(path);
|
||||
|
||||
return path.Replace(drive, string.Empty);
|
||||
}
|
||||
|
||||
private static void SetFRSMQuotaOnFolder(int packageId, string path, string folderName, QuotaValueInfo quotaInfo, QuotaType quotaType)
|
||||
{
|
||||
var os = GetOS(packageId);
|
||||
|
||||
if (os != null && os.CheckFileServicesInstallation())
|
||||
{
|
||||
#region figure Quota Unit
|
||||
|
||||
// Quota Unit
|
||||
string unit = string.Empty;
|
||||
if (quotaInfo.QuotaDescription.ToLower().Contains("gb"))
|
||||
unit = "GB";
|
||||
else if (quotaInfo.QuotaDescription.ToLower().Contains("mb"))
|
||||
unit = "MB";
|
||||
else
|
||||
unit = "KB";
|
||||
|
||||
#endregion
|
||||
|
||||
os.SetQuotaLimitOnFolder(
|
||||
Path.Combine(GetDirectory(path), folderName),
|
||||
GetLocationDrive(path), quotaType,
|
||||
quotaInfo.QuotaAllocatedValue.ToString() + unit,
|
||||
0, String.Empty, String.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public static int DeleteUser(int itemId, int accountId)
|
||||
{
|
||||
// check account
|
||||
|
@ -1742,7 +2084,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
if (accountCheck < 0) return accountCheck;
|
||||
|
||||
// place log record
|
||||
TaskManager.StartTask("ORGANIZATION", "DELETE_USER", itemId);
|
||||
TaskManager.StartTask("ORGANIZATION", "REMOVE_USER", itemId);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -1770,13 +2112,32 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return -1;
|
||||
|
||||
// load account
|
||||
OrganizationUser user = GetAccount(itemId, accountId);
|
||||
ExchangeAccount user = ExchangeServerController.GetAccount(itemId, accountId);
|
||||
|
||||
Organizations orgProxy = GetOrganizationProxy(org.ServiceId);
|
||||
|
||||
string account = GetAccountName(user.AccountName);
|
||||
|
||||
if (user.AccountType == ExchangeAccountType.User)
|
||||
var accountType = user.AccountType;
|
||||
|
||||
if (accountType == ExchangeAccountType.DeletedUser)
|
||||
{
|
||||
var deletedUser = GetDeletedUser(user.AccountId);
|
||||
|
||||
if (deletedUser != null)
|
||||
{
|
||||
accountType = deletedUser.OriginAT;
|
||||
|
||||
if (!deletedUser.IsArchiveEmpty)
|
||||
{
|
||||
RemoveArchive(org.PackageId, deletedUser.StoragePath, deletedUser.FolderName, deletedUser.FileName);
|
||||
}
|
||||
|
||||
RemoveDeletedUser(deletedUser.Id);
|
||||
}
|
||||
}
|
||||
|
||||
if (user.AccountType == ExchangeAccountType.User )
|
||||
{
|
||||
//Delete user from AD
|
||||
orgProxy.DeleteUser(account, org.OrganizationId);
|
||||
|
@ -1800,6 +2161,30 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
}
|
||||
|
||||
public static OrganizationDeletedUser GetDeletedUser(int accountId)
|
||||
{
|
||||
OrganizationDeletedUser deletedUser = ObjectUtils.FillObjectFromDataReader<OrganizationDeletedUser>(
|
||||
DataProvider.GetOrganizationDeletedUser(accountId));
|
||||
|
||||
if (deletedUser == null)
|
||||
return null;
|
||||
|
||||
deletedUser.IsArchiveEmpty = string.IsNullOrEmpty(deletedUser.FileName);
|
||||
|
||||
return deletedUser;
|
||||
}
|
||||
|
||||
private static int AddDeletedUser(OrganizationDeletedUser deletedUser)
|
||||
{
|
||||
return DataProvider.AddOrganizationDeletedUser(
|
||||
deletedUser.AccountId, (int)deletedUser.OriginAT, deletedUser.StoragePath, deletedUser.FolderName, deletedUser.FileName, deletedUser.ExpirationDate);
|
||||
}
|
||||
|
||||
private static void RemoveDeletedUser(int id)
|
||||
{
|
||||
DataProvider.DeleteOrganizationDeletedUser(id);
|
||||
}
|
||||
|
||||
public static OrganizationUser GetAccount(int itemId, int userId)
|
||||
{
|
||||
OrganizationUser account = ObjectUtils.FillObjectFromDataReader<OrganizationUser>(
|
||||
|
@ -3090,6 +3475,22 @@ namespace WebsitePanel.EnterpriseServer
|
|||
|
||||
#endregion
|
||||
|
||||
#region OS
|
||||
|
||||
private static WebsitePanel.Providers.OS.OperatingSystem GetOS(int packageId)
|
||||
{
|
||||
int sid = PackageController.GetPackageServiceId(packageId, ResourceGroups.Os);
|
||||
if (sid <= 0)
|
||||
return null;
|
||||
|
||||
var os = new WebsitePanel.Providers.OS.OperatingSystem();
|
||||
ServiceProviderProxy.Init(os, sid);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public static DataSet GetOrganizationObjectsByDomain(int itemId, string domainName)
|
||||
{
|
||||
return DataProvider.GetOrganizationObjectsByDomain(itemId, domainName);
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return GetOrganizationRdsCollectionsInternal(itemId);
|
||||
}
|
||||
|
||||
public static ResultObject AddRdsCollection(int itemId, RdsCollection collection)
|
||||
public static int AddRdsCollection(int itemId, RdsCollection collection)
|
||||
{
|
||||
return AddRdsCollectionInternal(itemId, collection);
|
||||
}
|
||||
|
@ -203,6 +203,16 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return GetOrganizationRdsUsersCountInternal(itemId);
|
||||
}
|
||||
|
||||
public static int GetOrganizationRdsServersCount(int itemId)
|
||||
{
|
||||
return GetOrganizationRdsServersCountInternal(itemId);
|
||||
}
|
||||
|
||||
public static int GetOrganizationRdsCollectionsCount(int itemId)
|
||||
{
|
||||
return GetOrganizationRdsCollectionsCountInternal(itemId);
|
||||
}
|
||||
|
||||
public static List<string> GetApplicationUsers(int itemId, int collectionId, RemoteApplication remoteApp)
|
||||
{
|
||||
return GetApplicationUsersInternal(itemId, collectionId, remoteApp);
|
||||
|
@ -255,7 +265,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return collections;
|
||||
}
|
||||
|
||||
private static ResultObject AddRdsCollectionInternal(int itemId, RdsCollection collection)
|
||||
private static int AddRdsCollectionInternal(int itemId, RdsCollection collection)
|
||||
{
|
||||
var result = TaskManager.StartResultTask<ResultObject>("REMOTE_DESKTOP_SERVICES", "ADD_RDS_COLLECTION");
|
||||
|
||||
|
@ -265,9 +275,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
Organization org = OrganizationController.GetOrganization(itemId);
|
||||
if (org == null)
|
||||
{
|
||||
result.IsSuccess = false;
|
||||
result.AddError("", new NullReferenceException("Organization not found"));
|
||||
return result;
|
||||
return -1;
|
||||
}
|
||||
|
||||
var rds = GetRemoteDesktopServices(GetRemoteDesktopServiceID(org.PackageId));
|
||||
|
@ -282,7 +290,6 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.AddError("REMOTE_DESKTOP_SERVICES_ADD_RDS_COLLECTION", ex);
|
||||
throw TaskManager.WriteError(ex);
|
||||
}
|
||||
finally
|
||||
|
@ -297,7 +304,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return collection.Id;
|
||||
}
|
||||
|
||||
private static ResultObject EditRdsCollectionInternal(int itemId, RdsCollection collection)
|
||||
|
@ -591,6 +598,15 @@ namespace WebsitePanel.EnterpriseServer
|
|||
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<RdsServer> GetCollectionRdsServersInternal(int collectionId)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
// Copyright (c) 2014, 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.Diagnostics;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using WebsitePanel.Providers.Exchange;
|
||||
using WebsitePanel.Providers.HostedSolution;
|
||||
|
||||
namespace WebsitePanel.EnterpriseServer
|
||||
{
|
||||
public class DeleteExchangeAccountsTask : SchedulerTask
|
||||
{
|
||||
public override void DoWork()
|
||||
{
|
||||
DeletedAccounts();
|
||||
}
|
||||
|
||||
public void DeletedAccounts()
|
||||
{
|
||||
List<Organization> organizations = OrganizationController.GetOrganizations(TaskManager.TopTask.PackageId, true);
|
||||
|
||||
foreach (Organization organization in organizations)
|
||||
{
|
||||
List<OrganizationDeletedUser> deletedUsers = OrganizationController.GetOrganizationDeletedUsers(organization.Id);
|
||||
|
||||
foreach (OrganizationDeletedUser deletedUser in deletedUsers)
|
||||
{
|
||||
if (deletedUser.ExpirationDate > DateTime.UtcNow)
|
||||
{
|
||||
OrganizationController.DeleteUser(TaskManager.TopTask.ItemId, deletedUser.AccountId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -141,6 +141,7 @@
|
|||
<Compile Include="SchedulerTasks\ActivatePaidInvoicesTask.cs" />
|
||||
<Compile Include="SchedulerTasks\BackupDatabaseTask.cs" />
|
||||
<Compile Include="SchedulerTasks\BackupTask.cs" />
|
||||
<Compile Include="SchedulerTasks\DeleteExchangeAccountsTask.cs" />
|
||||
<Compile Include="SchedulerTasks\CalculateExchangeDiskspaceTask.cs" />
|
||||
<Compile Include="SchedulerTasks\CalculatePackagesBandwidthTask.cs" />
|
||||
<Compile Include="SchedulerTasks\CalculatePackagesDiskspaceTask.cs" />
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
</configSections>
|
||||
<!-- Connection strings -->
|
||||
<connectionStrings>
|
||||
<!--<add name="EnterpriseServer" connectionString="Server=(local)\SQLExpress;Database=WebsitePanel;uid=sa;pwd=Password12" providerName="System.Data.SqlClient"/>-->
|
||||
<add name="EnterpriseServer" connectionString="Data Source=CHERNETSI\BENQMSSERVER;Initial Catalog=WebsitePanel;uid=sa;pwd=Password12;Integrated Security=True;" providerName="System.Data.SqlClient" />
|
||||
<add name="EnterpriseServer" connectionString="Server=(local)\SQLExpress;Database=WebsitePanel;uid=sa;pwd=Password12" providerName="System.Data.SqlClient"/>
|
||||
</connectionStrings>
|
||||
<appSettings>
|
||||
<!-- Encryption util settings -->
|
||||
|
|
|
@ -56,6 +56,29 @@ namespace WebsitePanel.EnterpriseServer
|
|||
[ToolboxItem(false)]
|
||||
public class esEnterpriseStorage : WebService
|
||||
{
|
||||
[WebMethod]
|
||||
public int AddWebDavAccessToken(WebDavAccessToken accessToken)
|
||||
{
|
||||
return EnterpriseStorageController.AddWebDavAccessToken(accessToken);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public void DeleteExpiredWebDavAccessTokens()
|
||||
{
|
||||
EnterpriseStorageController.DeleteExpiredWebDavAccessTokens();
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public WebDavAccessToken GetWebDavAccessTokenById(int id)
|
||||
{
|
||||
return EnterpriseStorageController.GetWebDavAccessTokenById(id);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public WebDavAccessToken GetWebDavAccessTokenByAccessToken(Guid accessToken)
|
||||
{
|
||||
return EnterpriseStorageController.GetWebDavAccessTokenByAccessToken(accessToken);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public bool CheckFileServicesInstallation(int serviceId)
|
||||
|
|
|
@ -344,6 +344,18 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return ExchangeServerController.SetMailboxPermissions(itemId, accountId, sendAsaccounts, fullAccessAcounts);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public int ExportMailBox(int itemId, int accountId, string path)
|
||||
{
|
||||
return ExchangeServerController.ExportMailBox(itemId, accountId, path);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public int SetDeletedMailbox(int itemId, int accountId)
|
||||
{
|
||||
return ExchangeServerController.SetDeletedMailbox(itemId, accountId);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -193,6 +193,12 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return OrganizationController.ImportUser(itemId, accountName, displayName, name, domain, password, subscriberNumber);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public OrganizationDeletedUsersPaged GetOrganizationDeletedUsersPaged(int itemId, string filterColumn, string filterValue, string sortColumn,
|
||||
int startRow, int maximumRows)
|
||||
{
|
||||
return OrganizationController.GetOrganizationDeletedUsersPaged(itemId, filterColumn, filterValue, sortColumn, startRow, maximumRows);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public OrganizationUsersPaged GetOrganizationUsersPaged(int itemId, string filterColumn, string filterValue, string sortColumn,
|
||||
|
@ -248,6 +254,17 @@ namespace WebsitePanel.EnterpriseServer
|
|||
filterColumn, filterValue, sortColumn, includeMailboxes);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public int SetDeletedUser(int itemId, int accountId, bool enableForceArchive)
|
||||
{
|
||||
return OrganizationController.SetDeletedUser(itemId, accountId, enableForceArchive);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public byte[] GetArchiveFileBinaryChunk(int packageId, string path, int offset, int length)
|
||||
{
|
||||
return OrganizationController.GetArchiveFileBinaryChunk(packageId, path, offset, length);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public int DeleteUser(int itemId, int accountId)
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace WebsitePanel.EnterpriseServer
|
|||
}
|
||||
|
||||
[WebMethod]
|
||||
public ResultObject AddRdsCollection(int itemId, RdsCollection collection)
|
||||
public int AddRdsCollection(int itemId, RdsCollection collection)
|
||||
{
|
||||
return RemoteDesktopServicesController.AddRdsCollection(itemId, collection);
|
||||
}
|
||||
|
@ -236,6 +236,18 @@ namespace WebsitePanel.EnterpriseServer
|
|||
return RemoteDesktopServicesController.GetOrganizationRdsUsersCount(itemId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public int GetOrganizationRdsServersCount(int itemId)
|
||||
{
|
||||
return RemoteDesktopServicesController.GetOrganizationRdsServersCount(itemId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public int GetOrganizationRdsCollectionsCount(int itemId)
|
||||
{
|
||||
return RemoteDesktopServicesController.GetOrganizationRdsCollectionsCount(itemId);
|
||||
}
|
||||
|
||||
[WebMethod]
|
||||
public List<string> GetApplicationUsers(int itemId, int collectionId, RemoteApplication remoteApp)
|
||||
{
|
||||
|
|
|
@ -40,6 +40,7 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
User = 7,
|
||||
SecurityGroup = 8,
|
||||
DefaultSecurityGroup = 9,
|
||||
SharedMailbox = 10
|
||||
SharedMailbox = 10,
|
||||
DeletedUser = 11
|
||||
}
|
||||
}
|
||||
|
|
|
@ -247,6 +247,13 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
set { this.archiveWarningPct = value; }
|
||||
}
|
||||
|
||||
bool enableForceArchiveDeletion;
|
||||
public bool EnableForceArchiveDeletion
|
||||
{
|
||||
get { return this.enableForceArchiveDeletion; }
|
||||
set { this.enableForceArchiveDeletion = value; }
|
||||
}
|
||||
|
||||
public string WSPUniqueName
|
||||
{
|
||||
get
|
||||
|
|
|
@ -143,6 +143,7 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
int RemoveDisclamerMember(string name, string member);
|
||||
|
||||
// Archiving
|
||||
ResultObject ExportMailBox(string organizationId, string accountName, string storagePath);
|
||||
ResultObject SetMailBoxArchiving(string organizationId, string accountName, bool archive, long archiveQuotaKB, long archiveWarningQuotaKB, string RetentionPolicy);
|
||||
|
||||
// Retention policy
|
||||
|
|
|
@ -39,6 +39,8 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
|
||||
int CreateUser(string organizationId, string loginName, string displayName, string upn, string password, bool enabled);
|
||||
|
||||
void DisableUser(string loginName, string organizationId);
|
||||
|
||||
void DeleteUser(string loginName, string organizationId);
|
||||
|
||||
OrganizationUser GetUserGeneralSettings(string loginName, string organizationId);
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
// Copyright (c) 2014, 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;
|
||||
|
||||
namespace WebsitePanel.Providers.HostedSolution
|
||||
{
|
||||
public class OrganizationDeletedUser
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int AccountId { get; set; }
|
||||
|
||||
public ExchangeAccountType OriginAT { get; set; }
|
||||
|
||||
public string StoragePath { get; set; }
|
||||
|
||||
public string FolderName { get; set; }
|
||||
|
||||
public string FileName { get; set; }
|
||||
|
||||
public DateTime ExpirationDate { get; set; }
|
||||
|
||||
public OrganizationUser User { get; set; }
|
||||
|
||||
public bool IsArchiveEmpty { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
// Copyright (c) 2014, 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.
|
||||
|
||||
namespace WebsitePanel.Providers.HostedSolution
|
||||
{
|
||||
public class OrganizationDeletedUsersPaged
|
||||
{
|
||||
int recordsCount;
|
||||
OrganizationDeletedUser[] pageDeletedUsers;
|
||||
|
||||
public int RecordsCount
|
||||
{
|
||||
get { return recordsCount; }
|
||||
set { recordsCount = value; }
|
||||
}
|
||||
|
||||
public OrganizationDeletedUser[] PageDeletedUsers
|
||||
{
|
||||
get { return pageDeletedUsers; }
|
||||
set { pageDeletedUsers = value; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -82,6 +82,12 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
private int createdProfessionalCRMUsers;
|
||||
private int allocatedProfessionalCRMUsers;
|
||||
|
||||
private int allocatedDeletedUsers;
|
||||
private int deletedUsers;
|
||||
|
||||
private int allocatedDeletedUsersBackupStorageSpace;
|
||||
private int usedDeletedUsersBackupStorageSpace;
|
||||
|
||||
public int CreatedProfessionalCRMUsers
|
||||
{
|
||||
get { return createdProfessionalCRMUsers; }
|
||||
|
@ -370,7 +376,35 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
set { createdResourceMailboxes = value; }
|
||||
}
|
||||
|
||||
public int AllocatedDeletedUsers
|
||||
{
|
||||
get { return allocatedDeletedUsers; }
|
||||
set { allocatedDeletedUsers = value; }
|
||||
}
|
||||
|
||||
public int DeletedUsers
|
||||
{
|
||||
get { return deletedUsers; }
|
||||
set { deletedUsers = value; }
|
||||
}
|
||||
|
||||
public int AllocatedDeletedUsersBackupStorageSpace
|
||||
{
|
||||
get { return allocatedDeletedUsersBackupStorageSpace; }
|
||||
set { allocatedDeletedUsersBackupStorageSpace = value; }
|
||||
}
|
||||
public int UsedDeletedUsersBackupStorageSpace
|
||||
{
|
||||
get { return usedDeletedUsersBackupStorageSpace; }
|
||||
set { usedDeletedUsersBackupStorageSpace = value; }
|
||||
}
|
||||
|
||||
public int CreatedRdsServers { get; set; }
|
||||
public int CreatedRdsCollections { get; set; }
|
||||
public int CreatedRdsUsers { get; set; }
|
||||
public int AllocatedRdsServers { get; set; }
|
||||
public int AllocatedRdsCollections { get; set; }
|
||||
public int AllocatedRdsUsers { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -120,6 +120,8 @@
|
|||
<Compile Include="HostedSolution\LyncUsersPaged.cs" />
|
||||
<Compile Include="HostedSolution\LyncVoicePolicyType.cs" />
|
||||
<Compile Include="HostedSolution\OrganizationSecurityGroup.cs" />
|
||||
<Compile Include="HostedSolution\OrganizationDeletedUser.cs" />
|
||||
<Compile Include="HostedSolution\OrganizationDeletedUsersPaged.cs" />
|
||||
<Compile Include="HostedSolution\TransactionAction.cs" />
|
||||
<Compile Include="OS\MappedDrivesPaged.cs" />
|
||||
<Compile Include="OS\MappedDrive.cs" />
|
||||
|
|
|
@ -7482,6 +7482,43 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
|
||||
#region Archiving
|
||||
|
||||
public ResultObject ExportMailBox(string organizationId, string accountName, string storagePath)
|
||||
{
|
||||
return ExportMailBoxInternal(organizationId, accountName, storagePath);
|
||||
}
|
||||
|
||||
public ResultObject ExportMailBoxInternal(string organizationId, string accountName, string storagePath)
|
||||
{
|
||||
ExchangeLog.LogStart("ExportMailBoxInternal");
|
||||
ExchangeLog.DebugInfo("Account: {0}", accountName);
|
||||
|
||||
ResultObject res = new ResultObject() { IsSuccess = true };
|
||||
|
||||
Runspace runSpace = null;
|
||||
Runspace runSpaceEx = null;
|
||||
|
||||
try
|
||||
{
|
||||
runSpace = OpenRunspace();
|
||||
runSpaceEx = OpenRunspaceEx();
|
||||
|
||||
Command cmd = new Command("New-MailboxExportRequest");
|
||||
cmd.Parameters.Add("Mailbox", accountName);
|
||||
cmd.Parameters.Add("FilePath", storagePath);
|
||||
|
||||
ExecuteShellCommand(runSpace, cmd, res);
|
||||
}
|
||||
finally
|
||||
{
|
||||
CloseRunspace(runSpace);
|
||||
CloseRunspaceEx(runSpaceEx);
|
||||
}
|
||||
|
||||
ExchangeLog.LogEnd("ExportMailBoxInternal");
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public ResultObject SetMailBoxArchiving(string organizationId, string accountName, bool archive, long archiveQuotaKB, long archiveWarningQuotaKB, string RetentionPolicy)
|
||||
{
|
||||
return SetMailBoxArchivingInternal(organizationId, accountName, archive, archiveQuotaKB, archiveWarningQuotaKB, RetentionPolicy);
|
||||
|
|
|
@ -7103,6 +7103,13 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
#endregion
|
||||
|
||||
#region Archiving
|
||||
|
||||
public virtual ResultObject ExportMailBox(string organizationId, string accountName, string storagePath)
|
||||
{
|
||||
// not implemented
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual ResultObject SetMailBoxArchiving(string organizationId, string accountName, bool archive, long archiveQuotaKB, long archiveWarningQuotaKB, string RetentionPolicy)
|
||||
{
|
||||
// not implemented
|
||||
|
|
|
@ -526,6 +526,36 @@ namespace WebsitePanel.Providers.HostedSolution
|
|||
return res;
|
||||
}
|
||||
|
||||
public void DisableUser(string loginName, string organizationId)
|
||||
{
|
||||
DisableUserInternal(loginName, organizationId);
|
||||
}
|
||||
|
||||
public void DisableUserInternal(string loginName, string organizationId)
|
||||
{
|
||||
HostedSolutionLog.LogStart("DisableUserInternal");
|
||||
HostedSolutionLog.DebugInfo("loginName : {0}", loginName);
|
||||
HostedSolutionLog.DebugInfo("organizationId : {0}", organizationId);
|
||||
|
||||
if (string.IsNullOrEmpty(loginName))
|
||||
throw new ArgumentNullException("loginName");
|
||||
|
||||
if (string.IsNullOrEmpty(organizationId))
|
||||
throw new ArgumentNullException("organizationId");
|
||||
|
||||
string path = GetUserPath(organizationId, loginName);
|
||||
|
||||
if (ActiveDirectoryUtils.AdObjectExists(path))
|
||||
{
|
||||
DirectoryEntry entry = ActiveDirectoryUtils.GetADObject(path);
|
||||
|
||||
entry.InvokeSet(ADAttributes.AccountDisabled, true);
|
||||
|
||||
entry.CommitChanges();
|
||||
}
|
||||
|
||||
HostedSolutionLog.LogEnd("DisableUserInternal");
|
||||
}
|
||||
|
||||
public void DeleteUser(string loginName, string organizationId)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2015, Outercurve Foundation.
|
||||
// Copyright (c) 2015, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
|
@ -795,6 +795,7 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
|||
RemoveRdRap(runSpace, gatewayHost, policyName);
|
||||
}
|
||||
|
||||
Log.WriteWarning(gatewayHost);
|
||||
var userGroupParametr = string.Format("@({0})", string.Join(",", groups.Select(x => string.Format("\"{0}@{1}\"", x, RootDomain)).ToArray()));
|
||||
var computerGroupParametr = string.Format("\"{0}@{1}\"", GetComputersGroupName(collectionName), RootDomain);
|
||||
|
||||
|
@ -804,8 +805,10 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
|||
rdRapCommand.Parameters.Add("UserGroups", userGroupParametr);
|
||||
rdRapCommand.Parameters.Add("ComputerGroupType", 1);
|
||||
rdRapCommand.Parameters.Add("ComputerGroup", computerGroupParametr);
|
||||
|
||||
Log.WriteWarning("User Group:" + userGroupParametr);
|
||||
Log.WriteWarning("Computer Group:" + computerGroupParametr);
|
||||
ExecuteRemoteShellCommand(runSpace, gatewayHost, rdRapCommand, RdsModuleName);
|
||||
Log.WriteWarning("RD RAP Added");
|
||||
}
|
||||
|
||||
internal void RemoveRdRap(Runspace runSpace, string gatewayHost, string name)
|
||||
|
@ -1595,22 +1598,22 @@ namespace WebsitePanel.Providers.RemoteDesktopServices
|
|||
internal List<string> GetServersExistingInCollections(Runspace runSpace)
|
||||
{
|
||||
var existingHosts = new List<string>();
|
||||
var scripts = new List<string>();
|
||||
scripts.Add(string.Format("$sessions = Get-RDSessionCollection -ConnectionBroker {0}", ConnectionBroker));
|
||||
scripts.Add(string.Format("foreach($session in $sessions){{Get-RDSessionHost $session.CollectionName -ConnectionBroker {0}|Select SessionHost}}", ConnectionBroker));
|
||||
object[] errors;
|
||||
//var scripts = new List<string>();
|
||||
//scripts.Add(string.Format("$sessions = Get-RDSessionCollection -ConnectionBroker {0}", ConnectionBroker));
|
||||
//scripts.Add(string.Format("foreach($session in $sessions){{Get-RDSessionHost $session.CollectionName -ConnectionBroker {0}|Select SessionHost}}", ConnectionBroker));
|
||||
//object[] errors;
|
||||
|
||||
var sessionHosts = ExecuteShellCommand(runSpace, scripts, out errors);
|
||||
//var sessionHosts = ExecuteShellCommand(runSpace, scripts, out errors);
|
||||
|
||||
foreach(var host in sessionHosts)
|
||||
{
|
||||
var sessionHost = GetPSObjectProperty(host, "SessionHost");
|
||||
//foreach(var host in sessionHosts)
|
||||
//{
|
||||
// var sessionHost = GetPSObjectProperty(host, "SessionHost");
|
||||
|
||||
if (sessionHost != null)
|
||||
{
|
||||
existingHosts.Add(sessionHost.ToString());
|
||||
}
|
||||
}
|
||||
// if (sessionHost != null)
|
||||
// {
|
||||
// existingHosts.Add(sessionHost.ToString());
|
||||
// }
|
||||
//}
|
||||
|
||||
return existingHosts;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,11 @@ namespace WebsitePanel.Providers.Web.Delegation
|
|||
using (var srvman = new ServerManager())
|
||||
{
|
||||
var adminConfig = srvman.GetAdministrationConfiguration();
|
||||
//
|
||||
|
||||
// return if system.webServer/management/delegation section is not exist in config file
|
||||
if (!HasDelegationSection(adminConfig))
|
||||
return;
|
||||
|
||||
var delegationSection = adminConfig.GetSection("system.webServer/management/delegation");
|
||||
//
|
||||
var rulesCollection = delegationSection.GetCollection();
|
||||
|
@ -103,7 +107,11 @@ namespace WebsitePanel.Providers.Web.Delegation
|
|||
using (var srvman = new ServerManager())
|
||||
{
|
||||
var adminConfig = srvman.GetAdministrationConfiguration();
|
||||
//
|
||||
|
||||
// return if system.webServer/management/delegation section is not exist in config file
|
||||
if (!HasDelegationSection(adminConfig))
|
||||
return;
|
||||
|
||||
var delegationSection = adminConfig.GetSection("system.webServer/management/delegation");
|
||||
//
|
||||
var rulesCollection = delegationSection.GetCollection();
|
||||
|
@ -142,7 +150,11 @@ namespace WebsitePanel.Providers.Web.Delegation
|
|||
using (var srvman = new ServerManager())
|
||||
{
|
||||
var adminConfig = srvman.GetAdministrationConfiguration();
|
||||
//
|
||||
|
||||
// return if system.webServer/management/delegation section is not exist in config file
|
||||
if (!HasDelegationSection(adminConfig))
|
||||
return false;
|
||||
|
||||
var delegationSection = adminConfig.GetSection("system.webServer/management/delegation");
|
||||
//
|
||||
var rulesCollection = delegationSection.GetCollection();
|
||||
|
@ -171,7 +183,11 @@ namespace WebsitePanel.Providers.Web.Delegation
|
|||
using (var srvman = GetServerManager())
|
||||
{
|
||||
var adminConfig = srvman.GetAdministrationConfiguration();
|
||||
//
|
||||
|
||||
// return if system.webServer/management/delegation section is not exist in config file
|
||||
if (!HasDelegationSection(adminConfig))
|
||||
return;
|
||||
|
||||
var delegationSection = adminConfig.GetSection("system.webServer/management/delegation");
|
||||
//
|
||||
var rulesCollection = delegationSection.GetCollection();
|
||||
|
@ -245,7 +261,11 @@ namespace WebsitePanel.Providers.Web.Delegation
|
|||
using (var srvman = GetServerManager())
|
||||
{
|
||||
var adminConfig = srvman.GetAdministrationConfiguration();
|
||||
//
|
||||
|
||||
// return if system.webServer/management/delegation section is not exist in config file
|
||||
if (!HasDelegationSection(adminConfig))
|
||||
return;
|
||||
|
||||
var delegationSection = adminConfig.GetSection("system.webServer/management/delegation");
|
||||
//
|
||||
var rulesCollection = delegationSection.GetCollection();
|
||||
|
@ -264,5 +284,21 @@ namespace WebsitePanel.Providers.Web.Delegation
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool HasDelegationSection(Configuration adminConfig)
|
||||
{
|
||||
// try to get delegation section in config file (C:\Windows\system32\inetsrv\config\administration.config)
|
||||
try
|
||||
{
|
||||
adminConfig.GetSection("system.webServer/management/delegation");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
/* skip */
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2072,7 +2072,7 @@ namespace WebsitePanel.Providers.Web
|
|||
public new void GrantWebDeployPublishingAccess(string siteName, string accountName, string accountPassword)
|
||||
{
|
||||
// Web Publishing Access feature requires FullControl permissions on the web site's wwwroot folder
|
||||
//GrantWebManagementAccessInternally(siteName, accountName, accountPassword, NTFSPermission.FullControl);
|
||||
GrantWebManagementAccessInternally(siteName, accountName, accountPassword, NTFSPermission.FullControl);
|
||||
//
|
||||
EnforceDelegationRulesRestrictions(siteName, accountName);
|
||||
}
|
||||
|
@ -2086,7 +2086,7 @@ namespace WebsitePanel.Providers.Web
|
|||
public new void RevokeWebDeployPublishingAccess(string siteName, string accountName)
|
||||
{
|
||||
// Web Publishing Access feature requires FullControl permissions on the web site's wwwroot folder
|
||||
//RevokeWebManagementAccess(siteName, accountName);
|
||||
RevokeWebManagementAccess(siteName, accountName);
|
||||
//
|
||||
RemoveDelegationRulesRestrictions(siteName, accountName);
|
||||
}
|
||||
|
@ -4336,13 +4336,13 @@ namespace WebsitePanel.Providers.Web
|
|||
|
||||
protected string GetFullQualifiedAccountName(string accountName)
|
||||
{
|
||||
if (accountName.IndexOf("\\") != -1)
|
||||
return accountName; // already has domain information
|
||||
|
||||
//
|
||||
if (!ServerSettings.ADEnabled)
|
||||
return String.Format(@"{0}\{1}", Environment.MachineName, accountName);
|
||||
|
||||
if (accountName.IndexOf("\\") != -1)
|
||||
return accountName; // already has domain information
|
||||
|
||||
// DO IT FOR ACTIVE DIRECTORY MODE ONLY
|
||||
string domainName = null;
|
||||
try
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,7 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.30723.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Caching Application Block", "Caching Application Block", "{C8E6F2E4-A5B8-486A-A56E-92D864524682}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
Bin\Microsoft.Practices.EnterpriseLibrary.Common.dll = Bin\Microsoft.Practices.EnterpriseLibrary.Common.dll
|
||||
|
|
|
@ -1271,6 +1271,28 @@ namespace WebsitePanel.Server
|
|||
#endregion
|
||||
|
||||
#region Archiving
|
||||
|
||||
[WebMethod, SoapHeader("settings")]
|
||||
public ResultObject ExportMailBox(string organizationId, string accountName, string storagePath)
|
||||
{
|
||||
ResultObject res = null;
|
||||
try
|
||||
{
|
||||
LogStart("ExportMailBox");
|
||||
|
||||
res = ES.ExportMailBox(organizationId, accountName, storagePath);
|
||||
|
||||
LogEnd("ExportMailBox");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogError("ExportMailBox", ex);
|
||||
throw;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
[WebMethod, SoapHeader("settings")]
|
||||
public ResultObject SetMailBoxArchiving(string organizationId, string accountName, bool archive, long archiveQuotaKB, long archiveWarningQuotaKB, string RetentionPolicy)
|
||||
{
|
||||
|
|
|
@ -99,6 +99,12 @@ namespace WebsitePanel.Server
|
|||
return Organization.CreateUser(organizationId, loginName, displayName, upn, password, enabled);
|
||||
}
|
||||
|
||||
[WebMethod, SoapHeader("settings")]
|
||||
public void DisableUser(string loginName, string organizationId)
|
||||
{
|
||||
Organization.DisableUser(loginName, organizationId);
|
||||
}
|
||||
|
||||
[WebMethod, SoapHeader("settings")]
|
||||
public void DeleteUser(string loginName, string organizationId)
|
||||
{
|
||||
|
|
|
@ -5,21 +5,21 @@ using WebsitePanel.WebDavPortal.WebConfigSections;
|
|||
|
||||
namespace WebsitePanel.WebDav.Core.Config.Entities
|
||||
{
|
||||
public class OfficeOnlineCollection : AbstractConfigCollection, IReadOnlyCollection<string>
|
||||
public class OfficeOnlineCollection : AbstractConfigCollection, IReadOnlyCollection<OfficeOnlineElement>
|
||||
{
|
||||
private readonly IList<string> _officeExtensions;
|
||||
private readonly IList<OfficeOnlineElement> _officeExtensions;
|
||||
|
||||
public OfficeOnlineCollection()
|
||||
{
|
||||
IsEnabled = ConfigSection.OfficeOnline.IsEnabled;
|
||||
Url = ConfigSection.OfficeOnline.Url;
|
||||
_officeExtensions = ConfigSection.OfficeOnline.Cast<OfficeOnlineElement>().Select(x => x.Extension).ToList();
|
||||
_officeExtensions = ConfigSection.OfficeOnline.Cast<OfficeOnlineElement>().ToList();
|
||||
}
|
||||
|
||||
public bool IsEnabled { get; private set; }
|
||||
public string Url { get; private set; }
|
||||
|
||||
public IEnumerator<string> GetEnumerator()
|
||||
public IEnumerator<OfficeOnlineElement> GetEnumerator()
|
||||
{
|
||||
return _officeExtensions.GetEnumerator();
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ namespace WebsitePanel.WebDav.Core.Config.Entities
|
|||
|
||||
public bool Contains(string extension)
|
||||
{
|
||||
return _officeExtensions.Contains(extension);
|
||||
return _officeExtensions.Any(x=>x.Extension == extension);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
|
||||
using WebsitePanel.WebDav.Core.Config.WebConfigSections;
|
||||
using WebsitePanel.WebDavPortal.WebConfigSections;
|
||||
|
||||
namespace WebsitePanel.WebDav.Core.Config.Entities
|
||||
|
@ -33,6 +35,26 @@ namespace WebsitePanel.WebDav.Core.Config.Entities
|
|||
}
|
||||
}
|
||||
|
||||
public string UserGroupsKey
|
||||
{
|
||||
get
|
||||
{
|
||||
SessionKeysElement sessionKey =
|
||||
_sessionKeys.FirstOrDefault(x => x.Key == SessionKeysElement.UserGroupsKey);
|
||||
return sessionKey != null ? sessionKey.Value : null;
|
||||
}
|
||||
}
|
||||
|
||||
public string WebDavRootFoldersPermissions
|
||||
{
|
||||
get
|
||||
{
|
||||
SessionKeysElement sessionKey =
|
||||
_sessionKeys.FirstOrDefault(x => x.Key == SessionKeysElement.WebDavRootFolderPermissionsKey);
|
||||
return sessionKey != null ? sessionKey.Value : null;
|
||||
}
|
||||
}
|
||||
|
||||
public string ResourseRenderCount
|
||||
{
|
||||
get
|
||||
|
|
|
@ -5,6 +5,7 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections
|
|||
public class OfficeOnlineElement : ConfigurationElement
|
||||
{
|
||||
private const string ExtensionKey = "extension";
|
||||
private const string OwaOpenerKey = "owaOpener";
|
||||
|
||||
[ConfigurationProperty(ExtensionKey, IsKey = true, IsRequired = true)]
|
||||
public string Extension
|
||||
|
@ -12,5 +13,12 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections
|
|||
get { return this[ExtensionKey].ToString(); }
|
||||
set { this[ExtensionKey] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(OwaOpenerKey, IsKey = true, IsRequired = true)]
|
||||
public string OwaOpener
|
||||
{
|
||||
get { return this[OwaOpenerKey].ToString(); }
|
||||
set { this[OwaOpenerKey] = value; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
using System.Configuration;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.WebConfigSections
|
||||
namespace WebsitePanel.WebDav.Core.Config.WebConfigSections
|
||||
{
|
||||
public class SessionKeysElement : ConfigurationElement
|
||||
{
|
||||
|
@ -10,6 +10,8 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections
|
|||
public const string AccountInfoKey = "AccountInfoSessionKey";
|
||||
public const string AuthTicketKey = "AuthTicketKey";
|
||||
public const string WebDavManagerKey = "WebDavManagerSessionKey";
|
||||
public const string UserGroupsKey = "UserGroupsKey";
|
||||
public const string WebDavRootFolderPermissionsKey = "WebDavRootFolderPermissionsKey";
|
||||
public const string ResourseRenderCountKey = "ResourseRenderCountSessionKey";
|
||||
public const string ItemIdSessionKey = "ItemId";
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections
|
|||
public class WebDavExplorerConfigurationSettingsSection : ConfigurationSection
|
||||
{
|
||||
private const string UserDomainKey = "userDomain";
|
||||
private const string WebdavRootKey = "webdavRoot";
|
||||
private const string AuthTimeoutCookieNameKey = "authTimeoutCookieName";
|
||||
private const string AppName = "applicationName";
|
||||
private const string WebsitePanelConstantUserKey = "websitePanelConstantUser";
|
||||
|
@ -25,6 +26,13 @@ namespace WebsitePanel.WebDavPortal.WebConfigSections
|
|||
set { this[AuthTimeoutCookieNameKey] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(WebdavRootKey, IsRequired = true)]
|
||||
public WebdavRootElement WebdavRoot
|
||||
{
|
||||
get { return (WebdavRootElement)this[WebdavRootKey]; }
|
||||
set { this[WebdavRootKey] = value; }
|
||||
}
|
||||
|
||||
[ConfigurationProperty(UserDomainKey, IsRequired = true)]
|
||||
public UserDomainElement UserDomain
|
||||
{
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WebsitePanel.WebDav.Core.Config.WebConfigSections
|
||||
{
|
||||
public class WebdavRootElement : ConfigurationElement
|
||||
{
|
||||
private const string ValueKey = "value";
|
||||
|
||||
[ConfigurationProperty(ValueKey, IsKey = true, IsRequired = true)]
|
||||
public string Value
|
||||
{
|
||||
get { return (string)this[ValueKey]; }
|
||||
set { this[ValueKey] = value; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -30,6 +30,11 @@ namespace WebsitePanel.WebDav.Core.Config
|
|||
get { return _configSection.UserDomain.Value; }
|
||||
}
|
||||
|
||||
public string WebdavRoot
|
||||
{
|
||||
get { return _configSection.WebdavRoot.Value; }
|
||||
}
|
||||
|
||||
public string ApplicationName
|
||||
{
|
||||
get { return _configSection.ApplicationName.Value; }
|
||||
|
|
|
@ -0,0 +1,124 @@
|
|||
using System.Runtime.Serialization;
|
||||
|
||||
namespace WebsitePanel.WebDav.Core.Entities.Owa
|
||||
{
|
||||
[DataContract]
|
||||
public class CheckFileInfo
|
||||
{
|
||||
[DataMember]
|
||||
public string BaseFileName { get; set; }
|
||||
[DataMember]
|
||||
public string OwnerId { get; set; }
|
||||
[DataMember]
|
||||
public long Size { get; set; }
|
||||
[DataMember]
|
||||
public string Version { get; set; }
|
||||
|
||||
//[DataMember]
|
||||
//public string SHA256 { get; set; }
|
||||
//[DataMember]
|
||||
//public bool AllowExternalMarketplace { get; set; }
|
||||
//[DataMember]
|
||||
//public string BreadcrumbBrandName { get; set; }
|
||||
//[DataMember]
|
||||
//public string BreadcrumbBrandUrl { get; set; }
|
||||
//[DataMember]
|
||||
//public string BreadcrumbDocName { get; set; }
|
||||
//[DataMember]
|
||||
//public string BreadcrumbDocUrl { get; set; }
|
||||
//[DataMember]
|
||||
//public string BreadcrumbFolderName { get; set; }
|
||||
//[DataMember]
|
||||
//public string BreadcrumbFolderUrl { get; set; }
|
||||
//[DataMember]
|
||||
//public string ClientUrl { get; set; }
|
||||
//[DataMember]
|
||||
//public bool CloseButtonClosesWindow { get; set; }
|
||||
//[DataMember]
|
||||
//public string CloseUrl { get; set; }
|
||||
//[DataMember]
|
||||
//public bool DisableBrowserCachingOfUserContent { get; set; }
|
||||
//[DataMember]
|
||||
//public bool DisablePrint { get; set; }
|
||||
//[DataMember]
|
||||
//public bool DisableTranslation { get; set; }
|
||||
//[DataMember]
|
||||
//public string DownloadUrl { get; set; }
|
||||
//[DataMember]
|
||||
//public string FileSharingUrl { get; set; }
|
||||
//[DataMember]
|
||||
//public string FileUrl { get; set; }
|
||||
//[DataMember]
|
||||
//public string HostAuthenticationId { get; set; }
|
||||
//[DataMember]
|
||||
//public string HostEditUrl { get; set; }
|
||||
//[DataMember]
|
||||
//public string HostEmbeddedEditUrl { get; set; }
|
||||
//[DataMember]
|
||||
//public string HostEmbeddedViewUrl { get; set; }
|
||||
//[DataMember]
|
||||
//public string HostName { get; set; }
|
||||
//[DataMember]
|
||||
//public string HostNotes { get; set; }
|
||||
//[DataMember]
|
||||
//public string HostRestUrl { get; set; }
|
||||
//[DataMember]
|
||||
//public string HostViewUrl { get; set; }
|
||||
//[DataMember]
|
||||
//public string IrmPolicyDescription { get; set; }
|
||||
//[DataMember]
|
||||
//public string IrmPolicyTitle { get; set; }
|
||||
|
||||
//[DataMember]
|
||||
//public string PresenceProvider { get; set; }
|
||||
//[DataMember]
|
||||
//public string PresenceUserId { get; set; }
|
||||
//[DataMember]
|
||||
//public string PrivacyUrl { get; set; }
|
||||
//[DataMember]
|
||||
//public bool ProtectInClient { get; set; }
|
||||
//[DataMember]
|
||||
//public bool ReadOnly { get; set; }
|
||||
//[DataMember]
|
||||
//public bool RestrictedWebViewOnly { get; set; }
|
||||
|
||||
//[DataMember]
|
||||
//public string SignoutUrl { get; set; }
|
||||
|
||||
//[DataMember]
|
||||
//public bool SupportsCoauth { get; set; }
|
||||
//[DataMember]
|
||||
//public bool SupportsCobalt { get; set; }
|
||||
//[DataMember]
|
||||
//public bool SupportsFolders { get; set; }
|
||||
//[DataMember]
|
||||
//public bool SupportsLocks { get; set; }
|
||||
//[DataMember]
|
||||
//public bool SupportsScenarioLinks { get; set; }
|
||||
//[DataMember]
|
||||
//public bool SupportsSecureStore { get; set; }
|
||||
//[DataMember]
|
||||
//public bool SupportsUpdate { get; set; }
|
||||
//[DataMember]
|
||||
//public string TenantId { get; set; }
|
||||
//[DataMember]
|
||||
//public string TermsOfUseUrl { get; set; }
|
||||
//[DataMember]
|
||||
//public string TimeZone { get; set; }
|
||||
//[DataMember]
|
||||
//public bool UserCanAttend { get; set; }
|
||||
//[DataMember]
|
||||
//public bool UserCanNotWriteRelative { get; set; }
|
||||
//[DataMember]
|
||||
//public bool UserCanPresent { get; set; }
|
||||
//[DataMember]
|
||||
//public bool UserCanWrite { get; set; }
|
||||
//[DataMember]
|
||||
//public string UserFriendlyName { get; set; }
|
||||
//[DataMember]
|
||||
//public string UserId { get; set; }
|
||||
|
||||
//[DataMember]
|
||||
//public bool WebEditingDisabled { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Exceptions
|
||||
namespace WebsitePanel.WebDav.Core.Exceptions
|
||||
{
|
||||
[Serializable]
|
||||
public class ConnectToWebDavServerException : Exception
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Exceptions
|
||||
namespace WebsitePanel.WebDav.Core.Exceptions
|
||||
{
|
||||
[Serializable]
|
||||
public class ResourceNotFoundException : Exception
|
|
@ -4,5 +4,19 @@ namespace WebsitePanel.WebDav.Core.Exceptions
|
|||
{
|
||||
public class WebDavException : Exception
|
||||
{
|
||||
public WebDavException()
|
||||
: base() { }
|
||||
|
||||
public WebDavException(string message)
|
||||
: base(message) { }
|
||||
|
||||
public WebDavException(string format, params object[] args)
|
||||
: base(string.Format(format, args)) { }
|
||||
|
||||
public WebDavException(string message, Exception innerException)
|
||||
: base(message, innerException) { }
|
||||
|
||||
public WebDavException(string format, Exception innerException, params object[] args)
|
||||
: base(string.Format(format, args), innerException) { }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace WebsitePanel.WebDav.Core.Extensions
|
||||
{
|
||||
static class UriExtensions
|
||||
{
|
||||
public static Uri Append(this Uri uri, params string[] paths)
|
||||
{
|
||||
return new Uri(paths.Aggregate(uri.AbsoluteUri, (current, path) => string.Format("{0}/{1}", current.TrimEnd('/'), path.TrimStart('/'))));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.DirectoryServices.AccountManagement;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
|
@ -6,6 +7,7 @@ using System.Net.Security;
|
|||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml;
|
||||
using WebsitePanel.WebDav.Core.Config;
|
||||
using WebsitePanel.WebDav.Core.Exceptions;
|
||||
|
||||
namespace WebsitePanel.WebDav.Core
|
||||
|
@ -18,6 +20,7 @@ namespace WebsitePanel.WebDav.Core
|
|||
IFolder CreateFolder(string name);
|
||||
IHierarchyItem[] GetChildren();
|
||||
IResource GetResource(string name);
|
||||
Uri Path { get; }
|
||||
}
|
||||
|
||||
public class WebDavFolder : WebDavHierarchyItem, IFolder
|
||||
|
@ -25,6 +28,8 @@ namespace WebsitePanel.WebDav.Core
|
|||
private IHierarchyItem[] _children = new IHierarchyItem[0];
|
||||
private Uri _path;
|
||||
|
||||
public Uri Path { get { return _path; } }
|
||||
|
||||
/// <summary>
|
||||
/// The constructor
|
||||
/// </summary>
|
||||
|
@ -143,7 +148,7 @@ namespace WebsitePanel.WebDav.Core
|
|||
public IResource GetResource(string name)
|
||||
{
|
||||
IHierarchyItem item =
|
||||
_children.Single(i => i.ItemType == ItemType.Resource && i.DisplayName.Trim('/') == name.Trim('/'));
|
||||
_children.Single(i => i.DisplayName.Trim('/') == name.Trim('/'));
|
||||
var resource = new WebDavResource();
|
||||
resource.SetCredentials(_credentials);
|
||||
resource.SetHierarchyItem(item);
|
||||
|
@ -155,7 +160,7 @@ namespace WebsitePanel.WebDav.Core
|
|||
/// </summary>
|
||||
public void Open()
|
||||
{
|
||||
var request = (HttpWebRequest) WebRequest.Create(_path);
|
||||
var request = (HttpWebRequest)WebRequest.Create(_path);
|
||||
request.PreAuthenticate = true;
|
||||
request.Method = "PROPFIND";
|
||||
request.ContentType = "application/xml";
|
||||
|
@ -163,10 +168,10 @@ namespace WebsitePanel.WebDav.Core
|
|||
//TODO Disable SSL
|
||||
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return true; });
|
||||
|
||||
var credentials = (NetworkCredential) _credentials;
|
||||
var credentials = (NetworkCredential)_credentials;
|
||||
if (credentials != null && credentials.UserName != null)
|
||||
{
|
||||
request.Credentials = credentials;
|
||||
//request.Credentials = credentials;
|
||||
string auth = "Basic " +
|
||||
Convert.ToBase64String(
|
||||
Encoding.Default.GetBytes(credentials.UserName + ":" + credentials.Password));
|
||||
|
|
|
@ -17,8 +17,9 @@ namespace WebsitePanel.WebDav.Core
|
|||
DateTime CreationDate { get; }
|
||||
string CreatorDisplayName { get; }
|
||||
string DisplayName { get; }
|
||||
bool IsRootItem { get; set; }
|
||||
Uri Href { get; }
|
||||
ItemType ItemType { get; }
|
||||
ItemType ItemType { get;}
|
||||
DateTime LastModified { get; }
|
||||
Property[] Properties { get; }
|
||||
|
||||
|
@ -73,6 +74,8 @@ namespace WebsitePanel.WebDav.Core
|
|||
}
|
||||
}
|
||||
|
||||
public bool IsRootItem { get; set; }
|
||||
|
||||
public Uri Href
|
||||
{
|
||||
get { return _href; }
|
||||
|
|
|
@ -7,6 +7,7 @@ namespace WebsitePanel.WebDav.Core
|
|||
public interface IItemContent
|
||||
{
|
||||
long ContentLength { get; }
|
||||
long AllocatedSpace { get; set; }
|
||||
string ContentType { get; }
|
||||
|
||||
void Download(string filename);
|
||||
|
|
|
@ -64,6 +64,7 @@ namespace WebsitePanel.WebDav.Core
|
|||
public long ContentLength
|
||||
{
|
||||
get { return _contentLength; }
|
||||
set { _contentLength = value; }
|
||||
}
|
||||
|
||||
public string ContentType
|
||||
|
@ -110,6 +111,23 @@ namespace WebsitePanel.WebDav.Core
|
|||
webClient.UploadFile(Href, "PUT", filename);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Uploads content of a file specified by filename to the server
|
||||
/// </summary>
|
||||
/// <param name="data">Posted file data to be uploaded</param>
|
||||
public void Upload(byte[] data)
|
||||
{
|
||||
var credentials = (NetworkCredential)_credentials;
|
||||
string auth = "Basic " +
|
||||
Convert.ToBase64String(
|
||||
Encoding.Default.GetBytes(credentials.UserName + ":" + credentials.Password));
|
||||
var webClient = new WebClient();
|
||||
webClient.Credentials = credentials;
|
||||
webClient.Headers.Add("Authorization", auth);
|
||||
|
||||
webClient.UploadData(Href, "PUT", data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads content of the resource from WebDAV server.
|
||||
/// </summary>
|
||||
|
@ -233,14 +251,19 @@ namespace WebsitePanel.WebDav.Core
|
|||
}
|
||||
}
|
||||
|
||||
public long AllocatedSpace { get; set; }
|
||||
public bool IsRootItem { get; set; }
|
||||
|
||||
public Uri Href
|
||||
{
|
||||
get { return _href; }
|
||||
set { SetHref(value.ToString(), new Uri(value.Scheme + "://" + value.Host + value.Segments[0] + value.Segments[1])); }
|
||||
}
|
||||
|
||||
public ItemType ItemType
|
||||
{
|
||||
get { return _itemType; }
|
||||
set { _itemType = value; }
|
||||
}
|
||||
|
||||
public DateTime LastModified
|
||||
|
@ -405,6 +428,15 @@ namespace WebsitePanel.WebDav.Core
|
|||
_lastModified = lastModified;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// For internal use only.
|
||||
/// </summary>
|
||||
/// <param name="comment"></param>
|
||||
public void SetItemType(ItemType type)
|
||||
{
|
||||
_itemType = type;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// For internal use only.
|
||||
/// </summary>
|
||||
|
@ -518,6 +550,7 @@ namespace WebsitePanel.WebDav.Core
|
|||
SetHref(item.Href);
|
||||
SetLastModified(item.LastModified);
|
||||
SetProperties(item.Properties);
|
||||
SetItemType(item.ItemType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
|
||||
using WebsitePanel.WebDav.Core.Security.Authentication.Principals;
|
||||
|
||||
namespace WebsitePanel.WebDav.Core.Interfaces.Managers
|
||||
{
|
||||
public interface IAccessTokenManager
|
||||
{
|
||||
WebDavAccessToken CreateToken(WspPrincipal principal, string filePath);
|
||||
WebDavAccessToken GetToken(int id);
|
||||
WebDavAccessToken GetToken(Guid guid);
|
||||
void ClearExpiredTokens();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using WebsitePanel.WebDav.Core.Client;
|
||||
|
||||
namespace WebsitePanel.WebDav.Core.Interfaces.Managers
|
||||
{
|
||||
public interface IWebDavManager
|
||||
{
|
||||
IEnumerable<IHierarchyItem> OpenFolder(string path);
|
||||
bool IsFile(string path);
|
||||
byte[] GetFileBytes(string path);
|
||||
void UploadFile(string path, HttpPostedFileBase file);
|
||||
IResource GetResource(string path);
|
||||
string GetFileUrl(string path);
|
||||
void DeleteResource(string path);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
using System.Web.Mvc;
|
||||
using WebsitePanel.WebDav.Core.Client;
|
||||
using WebsitePanel.WebDav.Core.Entities.Owa;
|
||||
|
||||
namespace WebsitePanel.WebDav.Core.Interfaces.Owa
|
||||
{
|
||||
public interface IWopiServer
|
||||
{
|
||||
CheckFileInfo GetCheckFileInfo(string path);
|
||||
FileResult GetFile(string path);
|
||||
}
|
||||
}
|
|
@ -3,6 +3,8 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Security;
|
||||
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
|
||||
using WebsitePanel.WebDav.Core.Security.Authentication.Principals;
|
||||
|
||||
namespace WebsitePanel.WebDav.Core.Interfaces.Security
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
using WebsitePanel.WebDav.Core.Security.Authentication.Principals;
|
||||
using WebsitePanel.WebDav.Core.Security.Authorization.Enums;
|
||||
|
||||
namespace WebsitePanel.WebDav.Core.Interfaces.Security
|
||||
{
|
||||
public interface IWebDavAuthorizationService
|
||||
{
|
||||
bool HasAccess(WspPrincipal principal, string path);
|
||||
WebDavPermissions GetPermissions(WspPrincipal principal, string path);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
using System;
|
||||
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
|
||||
using WebsitePanel.WebDav.Core.Interfaces.Managers;
|
||||
using WebsitePanel.WebDav.Core.Security.Authentication.Principals;
|
||||
using WebsitePanel.WebDav.Core.Wsp.Framework;
|
||||
|
||||
namespace WebsitePanel.WebDav.Core.Managers
|
||||
{
|
||||
public class AccessTokenManager : IAccessTokenManager
|
||||
{
|
||||
public WebDavAccessToken CreateToken(WspPrincipal principal, string filePath)
|
||||
{
|
||||
var token = new WebDavAccessToken();
|
||||
|
||||
token.AccessToken = Guid.NewGuid();
|
||||
token.AccountId = principal.AccountId;
|
||||
token.ItemId = principal.ItemId;
|
||||
token.AuthData = principal.EncryptedPassword;
|
||||
token.ExpirationDate = DateTime.Now.AddHours(3);
|
||||
token.FilePath = filePath;
|
||||
|
||||
token.Id = WSP.Services.EnterpriseStorage.AddWebDavAccessToken(token);
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
public WebDavAccessToken GetToken(int id)
|
||||
{
|
||||
return WSP.Services.EnterpriseStorage.GetWebDavAccessTokenById(id);
|
||||
}
|
||||
|
||||
public WebDavAccessToken GetToken(Guid guid)
|
||||
{
|
||||
return WSP.Services.EnterpriseStorage.GetWebDavAccessTokenByAccessToken(guid);
|
||||
}
|
||||
|
||||
public void ClearExpiredTokens()
|
||||
{
|
||||
WSP.Services.EnterpriseStorage.DeleteExpiredWebDavAccessTokens();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,293 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Xml.Serialization;
|
||||
using log4net;
|
||||
using WebsitePanel.Providers.OS;
|
||||
using WebsitePanel.WebDav.Core.Client;
|
||||
using WebsitePanel.WebDav.Core.Config;
|
||||
using WebsitePanel.WebDav.Core.Exceptions;
|
||||
using WebsitePanel.WebDav.Core.Extensions;
|
||||
using WebsitePanel.WebDav.Core.Interfaces.Managers;
|
||||
using WebsitePanel.WebDav.Core.Resources;
|
||||
using WebsitePanel.WebDav.Core.Security.Cryptography;
|
||||
using WebsitePanel.WebDav.Core.Wsp.Framework;
|
||||
|
||||
namespace WebsitePanel.WebDav.Core.Managers
|
||||
{
|
||||
public class WebDavManager : IWebDavManager
|
||||
{
|
||||
private readonly ICryptography _cryptography;
|
||||
private readonly WebDavSession _webDavSession;
|
||||
|
||||
private readonly ILog Log;
|
||||
|
||||
private bool _isRoot = true;
|
||||
private IFolder _currentFolder;
|
||||
|
||||
public WebDavManager(ICryptography cryptography)
|
||||
{
|
||||
_cryptography = cryptography;
|
||||
Log = LogManager.GetLogger(this.GetType());
|
||||
|
||||
_webDavSession = new WebDavSession();
|
||||
}
|
||||
|
||||
public IEnumerable<IHierarchyItem> OpenFolder(string pathPart)
|
||||
{
|
||||
IHierarchyItem[] children;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(pathPart))
|
||||
{
|
||||
var resources = ConnectToWebDavServer().Select(x => new WebDavResource { Href = new Uri(x.Url), ItemType = ItemType.Folder }).ToArray();
|
||||
|
||||
var items = WSP.Services.EnterpriseStorage.GetEnterpriseFolders(WspContext.User.ItemId);
|
||||
|
||||
foreach (var resource in resources)
|
||||
{
|
||||
var folder = items.FirstOrDefault(x => x.Name == resource.DisplayName);
|
||||
|
||||
if (folder == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
resource.ContentLength = folder.Size;
|
||||
resource.AllocatedSpace = folder.FRSMQuotaMB;
|
||||
resource.IsRootItem = true;
|
||||
}
|
||||
|
||||
children = resources;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_currentFolder == null || _currentFolder.Path.ToString() != pathPart)
|
||||
{
|
||||
_webDavSession.Credentials = new NetworkCredential(WspContext.User.Login,
|
||||
_cryptography.Decrypt(WspContext.User.EncryptedPassword),
|
||||
WebDavAppConfigManager.Instance.UserDomain);
|
||||
|
||||
_currentFolder = _webDavSession.OpenFolder(string.Format("{0}{1}/{2}", WebDavAppConfigManager.Instance.WebdavRoot, WspContext.User.OrganizationId, pathPart.TrimStart('/')));
|
||||
}
|
||||
|
||||
children = _currentFolder.GetChildren().Where(x => !WebDavAppConfigManager.Instance.ElementsRendering.ElementsToIgnore.Contains(x.DisplayName.Trim('/'))).ToArray();
|
||||
}
|
||||
|
||||
List<IHierarchyItem> sortedChildren = children.Where(x => x.ItemType == ItemType.Folder).OrderBy(x => x.DisplayName).ToList();
|
||||
sortedChildren.AddRange(children.Where(x => x.ItemType != ItemType.Folder).OrderBy(x => x.DisplayName));
|
||||
|
||||
return sortedChildren;
|
||||
}
|
||||
|
||||
public bool IsFile(string path)
|
||||
{
|
||||
string folder = GetFileFolder(path);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(folder))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var resourceName = GetResourceName(path);
|
||||
|
||||
OpenFolder(folder);
|
||||
|
||||
IResource resource = _currentFolder.GetResource(resourceName);
|
||||
|
||||
return resource.ItemType != ItemType.Folder;
|
||||
}
|
||||
|
||||
|
||||
public byte[] GetFileBytes(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
string folder = GetFileFolder(path);
|
||||
|
||||
var resourceName = GetResourceName(path);
|
||||
|
||||
OpenFolder(folder);
|
||||
|
||||
IResource resource = _currentFolder.GetResource(resourceName);
|
||||
|
||||
Stream stream = resource.GetReadStream();
|
||||
byte[] fileBytes = ReadFully(stream);
|
||||
|
||||
return fileBytes;
|
||||
}
|
||||
catch (InvalidOperationException exception)
|
||||
{
|
||||
throw new ResourceNotFoundException("Resource not found", exception);
|
||||
}
|
||||
}
|
||||
|
||||
public void UploadFile(string path, HttpPostedFileBase file)
|
||||
{
|
||||
var resource = new WebDavResource();
|
||||
|
||||
var fileUrl = new Uri(WebDavAppConfigManager.Instance.WebdavRoot)
|
||||
.Append(WspContext.User.OrganizationId)
|
||||
.Append(path)
|
||||
.Append(Path.GetFileName(file.FileName));
|
||||
|
||||
resource.SetHref(fileUrl);
|
||||
resource.SetCredentials(new NetworkCredential(WspContext.User.Login, _cryptography.Decrypt(WspContext.User.EncryptedPassword)));
|
||||
|
||||
file.InputStream.Seek(0, SeekOrigin.Begin);
|
||||
var bytes = ReadFully(file.InputStream);
|
||||
|
||||
resource.Upload(bytes);
|
||||
}
|
||||
|
||||
public void DeleteResource(string path)
|
||||
{
|
||||
path = RemoveLeadingFromPath(path, "office365");
|
||||
path = RemoveLeadingFromPath(path, WspContext.User.OrganizationId);
|
||||
|
||||
string folderPath = GetFileFolder(path);
|
||||
|
||||
OpenFolder(folderPath);
|
||||
|
||||
var resourceName = GetResourceName(path);
|
||||
|
||||
IResource resource = _currentFolder.GetResource(resourceName);
|
||||
|
||||
if (resource.ItemType == ItemType.Folder && GetFoldersItemsCount(path) > 0)
|
||||
{
|
||||
throw new WebDavException(string.Format(WebDavResources.FolderIsNotEmptyFormat, resource.DisplayName));
|
||||
}
|
||||
|
||||
resource.Delete();
|
||||
}
|
||||
|
||||
public IResource GetResource(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
string folder = GetFileFolder(path);
|
||||
|
||||
var resourceName = GetResourceName(path);
|
||||
|
||||
OpenFolder(folder);
|
||||
|
||||
return _currentFolder.GetResource(resourceName);
|
||||
}
|
||||
catch (InvalidOperationException exception)
|
||||
{
|
||||
throw new ResourceNotFoundException("Resource not found", exception);
|
||||
}
|
||||
}
|
||||
|
||||
public string GetFileUrl(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
string folder = GetFileFolder(path);
|
||||
|
||||
var resourceName = GetResourceName(path);
|
||||
|
||||
OpenFolder(folder);
|
||||
|
||||
IResource resource = _currentFolder.GetResource(resourceName);
|
||||
return resource.Href.ToString();
|
||||
}
|
||||
catch (InvalidOperationException exception)
|
||||
{
|
||||
throw new ResourceNotFoundException("Resource not found", exception);
|
||||
}
|
||||
}
|
||||
|
||||
private IList<SystemFile> ConnectToWebDavServer()
|
||||
{
|
||||
var rootFolders = new List<SystemFile>();
|
||||
var user = WspContext.User;
|
||||
|
||||
var userGroups = WSP.Services.Organizations.GetSecurityGroupsByMember(user.ItemId, user.AccountId);
|
||||
|
||||
foreach (var folder in WSP.Services.EnterpriseStorage.GetEnterpriseFolders(WspContext.User.ItemId))
|
||||
{
|
||||
var permissions = WSP.Services.EnterpriseStorage.GetEnterpriseFolderPermissions(WspContext.User.ItemId, folder.Name);
|
||||
|
||||
foreach (var permission in permissions)
|
||||
{
|
||||
if ((!permission.IsGroup
|
||||
&& (permission.DisplayName == user.UserName || permission.DisplayName == user.DisplayName))
|
||||
|| (permission.IsGroup && userGroups.Any(x => x.DisplayName == permission.DisplayName)))
|
||||
{
|
||||
rootFolders.Add(folder);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return rootFolders;
|
||||
}
|
||||
|
||||
private int GetFoldersItemsCount(string path)
|
||||
{
|
||||
var items = OpenFolder(path);
|
||||
|
||||
return items.Count();
|
||||
}
|
||||
|
||||
#region Helpers
|
||||
|
||||
private string RemoveLeadingFromPath(string pathPart, string toRemove)
|
||||
{
|
||||
return pathPart.StartsWith('/' + toRemove) ? pathPart.Substring(toRemove.Length + 1) : pathPart;
|
||||
}
|
||||
|
||||
private byte[] ReadFully(Stream input)
|
||||
{
|
||||
var buffer = new byte[16 * 1024];
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
int read;
|
||||
while ((read = input.Read(buffer, 0, buffer.Length)) > 0)
|
||||
ms.Write(buffer, 0, read);
|
||||
return ms.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public void WriteTo(Stream sourceStream, Stream targetStream)
|
||||
{
|
||||
byte[] buffer = new byte[16 * 1024];
|
||||
int n;
|
||||
while ((n = sourceStream.Read(buffer, 0, buffer.Length)) != 0)
|
||||
targetStream.Write(buffer, 0, n);
|
||||
}
|
||||
|
||||
private string GetFileFolder(string path)
|
||||
{
|
||||
path = path.TrimEnd('/');
|
||||
|
||||
if (string.IsNullOrEmpty(path) || !path.Contains('/'))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
string fileName = path.Split('/').Last();
|
||||
int index = path.LastIndexOf(fileName, StringComparison.InvariantCultureIgnoreCase);
|
||||
string folder = string.IsNullOrEmpty(fileName)? path : path.Remove(index - 1, fileName.Length + 1);
|
||||
|
||||
return folder;
|
||||
}
|
||||
|
||||
private string GetResourceName(string path)
|
||||
{
|
||||
path = path.TrimEnd('/');
|
||||
|
||||
if (string.IsNullOrEmpty(path) || !path.Contains('/'))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return path.Split('/').Last(); ;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Mime;
|
||||
using System.Runtime.Serialization.Json;
|
||||
using System.Text;
|
||||
using System.Web.Mvc;
|
||||
using WebsitePanel.WebDav.Core.Client;
|
||||
using WebsitePanel.WebDav.Core.Entities.Owa;
|
||||
using WebsitePanel.WebDav.Core.Interfaces.Managers;
|
||||
using WebsitePanel.WebDav.Core.Interfaces.Owa;
|
||||
|
||||
namespace WebsitePanel.WebDav.Core.Owa
|
||||
{
|
||||
public class WopiServer : IWopiServer
|
||||
{
|
||||
private readonly IWebDavManager _webDavManager;
|
||||
|
||||
public WopiServer(IWebDavManager webDavManager)
|
||||
{
|
||||
_webDavManager = webDavManager;
|
||||
}
|
||||
|
||||
public CheckFileInfo GetCheckFileInfo(string path)
|
||||
{
|
||||
var resource = _webDavManager.GetResource(path);
|
||||
|
||||
var cFileInfo = new CheckFileInfo
|
||||
{
|
||||
BaseFileName = resource.DisplayName,
|
||||
OwnerId = @"4257508bfe174aa28b461536d8b6b648",
|
||||
Size = resource.ContentLength,
|
||||
Version = @"%22%7B59CCD75F%2D0687%2D4F86%2DBBCF%2D059126640640%7D%2C1%22"
|
||||
};
|
||||
|
||||
return cFileInfo;
|
||||
}
|
||||
|
||||
public FileResult GetFile(string path)
|
||||
{
|
||||
var fileBytes = _webDavManager.GetFileBytes(path);
|
||||
|
||||
return new FileContentResult(fileBytes, MediaTypeNames.Application.Octet);
|
||||
}
|
||||
}
|
||||
}
|
72
WebsitePanel/Sources/WebsitePanel.WebDav.Core/Resources/WebDavResources.Designer.cs
generated
Normal file
72
WebsitePanel/Sources/WebsitePanel.WebDav.Core/Resources/WebDavResources.Designer.cs
generated
Normal file
|
@ -0,0 +1,72 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.33440
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace WebsitePanel.WebDav.Core.Resources {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class WebDavResources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal WebDavResources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WebsitePanel.WebDav.Core.Resources.WebDavResources", typeof(WebDavResources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Folder {0} is not empty..
|
||||
/// </summary>
|
||||
internal static string FolderIsNotEmptyFormat {
|
||||
get {
|
||||
return ResourceManager.GetString("FolderIsNotEmptyFormat", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="FolderIsNotEmptyFormat" xml:space="preserve">
|
||||
<value>Folder {0} is not empty.</value>
|
||||
</data>
|
||||
</root>
|
|
@ -1,8 +1,10 @@
|
|||
using System;
|
||||
using System.DirectoryServices.AccountManagement;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Web.Security;
|
||||
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
|
||||
using WebsitePanel.WebDav.Core.Config;
|
||||
using WebsitePanel.WebDav.Core.Interfaces.Security;
|
||||
using WebsitePanel.WebDav.Core.Security.Authentication.Principals;
|
||||
|
@ -24,7 +26,14 @@ namespace WebsitePanel.WebDav.Core.Security.Authentication
|
|||
|
||||
public WspPrincipal LogIn(string login, string password)
|
||||
{
|
||||
if (_principalContext.ValidateCredentials(login, password) == false)
|
||||
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var user = UserPrincipal.FindByIdentity(_principalContext, IdentityType.UserPrincipalName, login);
|
||||
|
||||
if (user == null || _principalContext.ValidateCredentials(login, password) == false)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -40,9 +49,12 @@ namespace WebsitePanel.WebDav.Core.Security.Authentication
|
|||
principal.DisplayName = exchangeAccount.DisplayName;
|
||||
principal.EncryptedPassword = _cryptography.Encrypt(password);
|
||||
|
||||
CreateAuthenticationTicket(principal);
|
||||
|
||||
if (HttpContext.Current != null)
|
||||
{
|
||||
HttpContext.Current.User = principal;
|
||||
}
|
||||
|
||||
Thread.CurrentPrincipal = principal;
|
||||
|
||||
return principal;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ namespace WebsitePanel.WebDav.Core.Security.Authentication.Principals
|
|||
public int ItemId { get; set; }
|
||||
|
||||
public string Login { get; set; }
|
||||
public string EncryptedPassword { get; set; }
|
||||
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
|
@ -27,9 +26,11 @@ namespace WebsitePanel.WebDav.Core.Security.Authentication.Principals
|
|||
[XmlIgnore, ScriptIgnore]
|
||||
public IIdentity Identity { get; private set; }
|
||||
|
||||
public string EncryptedPassword { get; set; }
|
||||
|
||||
public WspPrincipal(string username)
|
||||
{
|
||||
Identity = new GenericIdentity(username);
|
||||
Identity = new GenericIdentity(username);//new WindowsIdentity(username, "WindowsAuthentication");
|
||||
Login = username;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
|
||||
namespace WebsitePanel.WebDav.Core.Security.Authorization.Enums
|
||||
{
|
||||
[Flags]
|
||||
public enum WebDavPermissions
|
||||
{
|
||||
Empty = 0,
|
||||
None = 1,
|
||||
Read = 2,
|
||||
Write = 4
|
||||
}
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
|
||||
using WebsitePanel.Providers.HostedSolution;
|
||||
using WebsitePanel.WebDav.Core.Config;
|
||||
using WebsitePanel.WebDav.Core.Interfaces.Security;
|
||||
using WebsitePanel.WebDav.Core.Security.Authentication.Principals;
|
||||
using WebsitePanel.WebDav.Core.Security.Authorization.Enums;
|
||||
using WebsitePanel.WebDav.Core.Wsp.Framework;
|
||||
|
||||
namespace WebsitePanel.WebDav.Core.Security.Authorization
|
||||
{
|
||||
public class WebDavAuthorizationService : IWebDavAuthorizationService
|
||||
{
|
||||
public bool HasAccess(WspPrincipal principal, string path)
|
||||
{
|
||||
var permissions = GetPermissions(principal, path);
|
||||
|
||||
return permissions.HasFlag(WebDavPermissions.Read) || permissions.HasFlag(WebDavPermissions.Write);
|
||||
}
|
||||
|
||||
public WebDavPermissions GetPermissions(WspPrincipal principal, string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
return WebDavPermissions.Read;
|
||||
}
|
||||
|
||||
var resultPermissions = WebDavPermissions.Empty;
|
||||
|
||||
var rootFolder = GetRootFolder(path);
|
||||
|
||||
var userGroups = GetUserSecurityGroups(principal);
|
||||
|
||||
var permissions = GetFolderEsPermissions(principal, rootFolder);
|
||||
|
||||
foreach (var permission in permissions)
|
||||
{
|
||||
if ((!permission.IsGroup
|
||||
&& (permission.DisplayName == principal.UserName || permission.DisplayName == principal.DisplayName))
|
||||
|| (permission.IsGroup && userGroups.Any(x => x.DisplayName == permission.DisplayName)))
|
||||
{
|
||||
if (permission.Access.ToLowerInvariant().Contains("read"))
|
||||
{
|
||||
resultPermissions |= WebDavPermissions.Read;
|
||||
}
|
||||
|
||||
if (permission.Access.ToLowerInvariant().Contains("write"))
|
||||
{
|
||||
resultPermissions |= WebDavPermissions.Write;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return resultPermissions;
|
||||
}
|
||||
|
||||
private string GetRootFolder(string path)
|
||||
{
|
||||
return path.Split(new[]{'/'}, StringSplitOptions.RemoveEmptyEntries)[0];
|
||||
}
|
||||
|
||||
private IEnumerable<ESPermission> GetFolderEsPermissions(WspPrincipal principal, string rootFolderName)
|
||||
{
|
||||
var dictionary = HttpContext.Current.Session[WebDavAppConfigManager.Instance.SessionKeys.WebDavRootFoldersPermissions] as
|
||||
Dictionary<string, IEnumerable<ESPermission>>;
|
||||
|
||||
if (dictionary == null)
|
||||
{
|
||||
dictionary = new Dictionary<string, IEnumerable<ESPermission>>();
|
||||
|
||||
var rootFolders = WSP.Services.EnterpriseStorage.GetEnterpriseFolders(principal.ItemId);
|
||||
|
||||
foreach (var rootFolder in rootFolders)
|
||||
{
|
||||
var permissions = WSP.Services.EnterpriseStorage.GetEnterpriseFolderPermissions(principal.ItemId, rootFolder.Name);
|
||||
|
||||
dictionary.Add(rootFolder.Name, permissions);
|
||||
}
|
||||
|
||||
HttpContext.Current.Session[WebDavAppConfigManager.Instance.SessionKeys.WebDavRootFoldersPermissions] = dictionary;
|
||||
}
|
||||
|
||||
return dictionary.ContainsKey(rootFolderName) ? dictionary[rootFolderName] : new ESPermission[0];
|
||||
}
|
||||
|
||||
private IEnumerable<ExchangeAccount> GetUserSecurityGroups(WspPrincipal principal)
|
||||
{
|
||||
var groups = HttpContext.Current.Session[WebDavAppConfigManager.Instance.SessionKeys.UserGroupsKey] as
|
||||
IEnumerable<ExchangeAccount>;
|
||||
|
||||
if (groups == null)
|
||||
{
|
||||
groups = WSP.Services.Organizations.GetSecurityGroupsByMember(principal.ItemId, principal.AccountId);
|
||||
|
||||
HttpContext.Current.Session[WebDavAppConfigManager.Instance.SessionKeys.UserGroupsKey] = groups;
|
||||
}
|
||||
|
||||
return groups ?? new ExchangeAccount[0];
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,6 +32,9 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="log4net">
|
||||
<HintPath>..\packages\log4net.2.0.0\lib\net40-full\log4net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
|
||||
|
@ -42,9 +45,11 @@
|
|||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.DirectoryServices.AccountManagement" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.Web">
|
||||
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Web.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -79,6 +84,9 @@
|
|||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WebsitePanel.EnterpriseServer.Base">
|
||||
<HintPath>..\WebsitePanel.WebPortal\Bin\WebsitePanel.EnterpriseServer.Base.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WebsitePanel.EnterpriseServer.Client">
|
||||
<HintPath>..\WebsitePanel.WebPortal\Bin\WebsitePanel.EnterpriseServer.Client.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -106,20 +114,31 @@
|
|||
<Compile Include="Config\WebConfigSections\SessionKeysElementCollection.cs" />
|
||||
<Compile Include="Config\WebConfigSections\UserDomainElement.cs" />
|
||||
<Compile Include="Config\WebConfigSections\WebDavExplorerConfigurationSettingsSection.cs" />
|
||||
<Compile Include="Config\WebConfigSections\WebdavRootElement.cs" />
|
||||
<Compile Include="Config\WebConfigSections\WebsitePanelConstantUserElement.cs" />
|
||||
<Compile Include="Config\WebDavAppConfigManager.cs" />
|
||||
<Compile Include="Entities\Owa\CheckFileInfo.cs" />
|
||||
<Compile Include="Exceptions\ConnectToWebDavServerException.cs" />
|
||||
<Compile Include="Exceptions\ResourceNotFoundException.cs" />
|
||||
<Compile Include="Exceptions\UnauthorizedException.cs" />
|
||||
<Compile Include="Exceptions\WebDavException.cs" />
|
||||
<Compile Include="Exceptions\WebDavHttpException.cs" />
|
||||
<Compile Include="Extensions\UriExtensions.cs" />
|
||||
<Compile Include="IConnectionSettings.cs" />
|
||||
<Compile Include="IFolder.cs" />
|
||||
<Compile Include="IHierarchyItem.cs" />
|
||||
<Compile Include="IItemContent.cs" />
|
||||
<Compile Include="Interfaces\Security\IWebDavAuthorizationService.cs" />
|
||||
<Compile Include="Managers\AccessTokenManager.cs" />
|
||||
<Compile Include="Interfaces\Managers\IAccessTokenManager.cs" />
|
||||
<Compile Include="Interfaces\Managers\IWebDavManager.cs" />
|
||||
<Compile Include="Interfaces\Owa\IWopiServer.cs" />
|
||||
<Compile Include="Interfaces\Security\IAuthenticationService.cs" />
|
||||
<Compile Include="IResource.cs" />
|
||||
<Compile Include="IResumableUpload.cs" />
|
||||
<Compile Include="ItemType.cs" />
|
||||
<Compile Include="LockUriTokenPair.cs" />
|
||||
<Compile Include="Managers\WebDavManager.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Property.cs" />
|
||||
<Compile Include="PropertyName.cs" />
|
||||
|
@ -128,10 +147,18 @@
|
|||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>HttpErrors.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Resources\WebDavResources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>WebDavResources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Security\Authorization\Enums\WebDavPermissions.cs" />
|
||||
<Compile Include="Security\Authorization\WebDavAuthorizationService.cs" />
|
||||
<Compile Include="Security\Cryptography\CryptoUtils.cs" />
|
||||
<Compile Include="Security\Cryptography\ICryptography.cs" />
|
||||
<Compile Include="Security\Authentication\FormsAuthenticationService.cs" />
|
||||
<Compile Include="Security\Authentication\Principals\WspPrincipal.cs" />
|
||||
<Compile Include="Owa\WopiServer.cs" />
|
||||
<Compile Include="WebDavSession.cs" />
|
||||
<Compile Include="WspContext.cs" />
|
||||
<Compile Include="Wsp\Framework\WSP.cs" />
|
||||
|
@ -153,6 +180,10 @@
|
|||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>HttpErrors.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Resources\WebDavResources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>WebDavResources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="log4net" version="2.0.0" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Mvc" version="5.2.2" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Razor" version="3.2.2" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebPages" version="3.2.2" targetFramework="net45" />
|
||||
|
|
|
@ -26,7 +26,12 @@ namespace WebsitePanel.WebDavPortal
|
|||
bundles.Add(new ScriptBundle("~/bundles/appScripts").Include(
|
||||
"~/Scripts/appScripts/recalculateResourseHeight.js",
|
||||
"~/Scripts/appScripts/uploadingData2.js",
|
||||
"~/Scripts/appScripts/authentication.js"));
|
||||
"~/Scripts/appScripts/authentication.js",
|
||||
"~/Scripts/appScripts/messages.js",
|
||||
"~/Scripts/appScripts/fileBrowsing.js",
|
||||
"~/Scripts/appScripts/dialogs.js",
|
||||
"~/Scripts/appScripts/wsp.js"
|
||||
));
|
||||
|
||||
bundles.Add(new ScriptBundle("~/bundles/authScripts").Include(
|
||||
"~/Scripts/appScripts/authentication.js"));
|
||||
|
|
|
@ -26,14 +26,48 @@ namespace WebsitePanel.WebDavPortal
|
|||
|
||||
#endregion
|
||||
|
||||
#region Owa
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Office365DocumentRoute",
|
||||
name: OwaRouteNames.GetFile,
|
||||
url: "owa/wopi*/files/{accessTokenId}/contents",
|
||||
defaults: new { controller = "Owa", action = "GetFile" }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: OwaRouteNames.CheckFileInfo,
|
||||
url: "owa/wopi*/files/{accessTokenId}",
|
||||
defaults: new { controller = "Owa", action = "CheckFileInfo" }
|
||||
);
|
||||
|
||||
#endregion
|
||||
|
||||
routes.MapRoute(
|
||||
name: FileSystemRouteNames.DeleteFiles,
|
||||
url: "files-group-action/delete",
|
||||
defaults: new { controller = "FileSystem", action = "DeleteFiles" }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: FileSystemRouteNames.UploadFile,
|
||||
url: "upload-file/{org}/{*pathPart}",
|
||||
defaults: new { controller = "FileSystem", action = "UploadFile" }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: FileSystemRouteNames.ShowOfficeOnlinePath,
|
||||
url: "office365/{org}/{*pathPart}",
|
||||
defaults: new { controller = "FileSystem", action = "ShowOfficeDocument", pathPart = UrlParameter.Optional }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: FileSystemRouteNames.FilePath,
|
||||
name: FileSystemRouteNames.ShowAdditionalContent,
|
||||
url: "show-additional-content/{*path}",
|
||||
defaults: new { controller = "FileSystem", action = "ShowAdditionalContent", path = UrlParameter.Optional }
|
||||
);
|
||||
|
||||
routes.MapRoute(
|
||||
name: FileSystemRouteNames.ShowContentPath,
|
||||
url: "{org}/{*pathPart}",
|
||||
defaults: new { controller = "FileSystem", action = "ShowContent", pathPart = UrlParameter.Optional }
|
||||
);
|
||||
|
|
|
@ -26,6 +26,32 @@ textarea {
|
|||
.element-container {
|
||||
margin-bottom: 15px;
|
||||
text-align:center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.element-container .element {
|
||||
position: relative;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
.selected-file .element {
|
||||
position: relative;
|
||||
box-sizing:border-box;
|
||||
-moz-box-sizing:border-box;
|
||||
-webkit-box-sizing:border-box;
|
||||
border: 1px solid rgb(80, 152, 249);
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
.selected-file .element div.selected-element-overlay {
|
||||
position:absolute;
|
||||
top:0px;
|
||||
left: 0px;
|
||||
width:100%;
|
||||
height:100%;
|
||||
background:rgb(200, 224, 255);
|
||||
opacity:0.3;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
#errorMessage {
|
||||
|
@ -46,3 +72,26 @@ textarea {
|
|||
#logout :hover {
|
||||
color: white;
|
||||
}
|
||||
|
||||
|
||||
.web-dav-folder-progress {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
.modal-vertical-centered {
|
||||
margin-top: 25%;
|
||||
}
|
||||
|
||||
|
||||
.file-actions-menu {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.file-actions-menu .file-deletion {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#message-area {
|
||||
margin-top: 15px;
|
||||
}
|
|
@ -3,9 +3,11 @@ using System.Net;
|
|||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using WebsitePanel.WebDav.Core.Config;
|
||||
using WebsitePanel.WebDav.Core.Security.Authentication;
|
||||
using WebsitePanel.WebDav.Core.Security.Cryptography;
|
||||
using WebsitePanel.WebDavPortal.Exceptions;
|
||||
using WebsitePanel.WebDavPortal.Models;
|
||||
using WebsitePanel.WebDavPortal.Models.Common;
|
||||
using WebsitePanel.WebDavPortal.Models.Common.Enums;
|
||||
using WebsitePanel.WebDavPortal.UI.Routes;
|
||||
using WebsitePanel.WebDav.Core.Interfaces.Security;
|
||||
using WebsitePanel.WebDav.Core;
|
||||
|
@ -29,7 +31,7 @@ namespace WebsitePanel.WebDavPortal.Controllers
|
|||
{
|
||||
if (WspContext.User != null && WspContext.User.Identity.IsAuthenticated)
|
||||
{
|
||||
return RedirectToRoute(FileSystemRouteNames.FilePath, new { org = WspContext.User.OrganizationId });
|
||||
return RedirectToRoute(FileSystemRouteNames.ShowContentPath, new { org = WspContext.User.OrganizationId });
|
||||
}
|
||||
|
||||
return View();
|
||||
|
@ -40,13 +42,13 @@ namespace WebsitePanel.WebDavPortal.Controllers
|
|||
{
|
||||
var user = _authenticationService.LogIn(model.Login, model.Password);
|
||||
|
||||
ViewBag.LdapIsAuthentication = user.Identity.IsAuthenticated;
|
||||
ViewBag.LdapIsAuthentication = user != null;
|
||||
|
||||
if (user.Identity.IsAuthenticated)
|
||||
if (user != null && user.Identity.IsAuthenticated)
|
||||
{
|
||||
Session[WebDavAppConfigManager.Instance.SessionKeys.WebDavManager] = null;
|
||||
_authenticationService.CreateAuthenticationTicket(user);
|
||||
|
||||
return RedirectToRoute(FileSystemRouteNames.FilePath, new { org = WspContext.User.OrganizationId });
|
||||
return RedirectToRoute(FileSystemRouteNames.ShowContentPath, new { org = WspContext.User.OrganizationId });
|
||||
}
|
||||
|
||||
return View(new AccountModel { LdapError = "The user name or password is incorrect" });
|
||||
|
@ -57,8 +59,6 @@ namespace WebsitePanel.WebDavPortal.Controllers
|
|||
{
|
||||
_authenticationService.LogOut();
|
||||
|
||||
Session[WebDavAppConfigManager.Instance.SessionKeys.WebDavManager] = null;
|
||||
|
||||
return RedirectToRoute(AccountRouteNames.Login);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,29 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Mime;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using log4net;
|
||||
using WebsitePanel.WebDav.Core;
|
||||
using WebsitePanel.WebDav.Core.Client;
|
||||
using WebsitePanel.WebDav.Core.Config;
|
||||
using WebsitePanel.WebDav.Core.Exceptions;
|
||||
using WebsitePanel.WebDav.Core.Interfaces.Managers;
|
||||
using WebsitePanel.WebDav.Core.Interfaces.Security;
|
||||
using WebsitePanel.WebDav.Core.Security.Cryptography;
|
||||
using WebsitePanel.WebDavPortal.CustomAttributes;
|
||||
using WebsitePanel.WebDavPortal.Extensions;
|
||||
using WebsitePanel.WebDavPortal.Models;
|
||||
using System.Net;
|
||||
using WebsitePanel.WebDavPortal.Models.Common;
|
||||
using WebsitePanel.WebDavPortal.Models.Common.Enums;
|
||||
using WebsitePanel.WebDavPortal.Models.FileSystem;
|
||||
using WebsitePanel.WebDavPortal.UI;
|
||||
using WebsitePanel.WebDavPortal.UI.Routes;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Controllers
|
||||
|
||||
|
@ -20,37 +32,51 @@ namespace WebsitePanel.WebDavPortal.Controllers
|
|||
[LdapAuthorization]
|
||||
public class FileSystemController : Controller
|
||||
{
|
||||
private readonly ICryptography _cryptography;
|
||||
private readonly IWebDavManager _webdavManager;
|
||||
private readonly IAuthenticationService _authenticationService;
|
||||
private readonly IAccessTokenManager _tokenManager;
|
||||
private readonly IWebDavAuthorizationService _webDavAuthorizationService;
|
||||
private readonly ILog Log;
|
||||
|
||||
public FileSystemController(IWebDavManager webdavManager)
|
||||
public FileSystemController(ICryptography cryptography, IWebDavManager webdavManager, IAuthenticationService authenticationService, IAccessTokenManager tokenManager, IWebDavAuthorizationService webDavAuthorizationService)
|
||||
{
|
||||
_cryptography = cryptography;
|
||||
_webdavManager = webdavManager;
|
||||
_authenticationService = authenticationService;
|
||||
_tokenManager = tokenManager;
|
||||
_webDavAuthorizationService = webDavAuthorizationService;
|
||||
|
||||
Log = LogManager.GetLogger(this.GetType());
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult ShowContent(string org, string pathPart = "")
|
||||
{
|
||||
if (org != WspContext.User.OrganizationId)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.NoContent);
|
||||
}
|
||||
|
||||
string fileName = pathPart.Split('/').Last();
|
||||
if (_webdavManager.IsFile(fileName))
|
||||
|
||||
if (_webdavManager.IsFile(pathPart))
|
||||
{
|
||||
var fileBytes = _webdavManager.GetFileBytes(fileName);
|
||||
var fileBytes = _webdavManager.GetFileBytes(pathPart);
|
||||
return File(fileBytes, MediaTypeNames.Application.Octet, fileName);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_webdavManager.OpenFolder(pathPart);
|
||||
IEnumerable<IHierarchyItem> children = _webdavManager.GetChildren().Where(x => !WebDavAppConfigManager.Instance.ElementsRendering.ElementsToIgnore.Contains(x.DisplayName.Trim('/')));
|
||||
IEnumerable<IHierarchyItem> children = _webdavManager.OpenFolder(pathPart);
|
||||
|
||||
var model = new ModelForWebDav { Items = children.Take(WebDavAppConfigManager.Instance.ElementsRendering.DefaultCount), UrlSuffix = pathPart };
|
||||
Session[WebDavAppConfigManager.Instance.SessionKeys.ResourseRenderCount] = WebDavAppConfigManager.Instance.ElementsRendering.DefaultCount;
|
||||
var permissions = _webDavAuthorizationService.GetPermissions(WspContext.User, pathPart);
|
||||
|
||||
var model = new ModelForWebDav { Items = children.Take(WebDavAppConfigManager.Instance.ElementsRendering.DefaultCount), UrlSuffix = pathPart, Permissions = permissions};
|
||||
|
||||
return View(model);
|
||||
}
|
||||
catch (UnauthorizedException)
|
||||
catch (UnauthorizedException e)
|
||||
{
|
||||
throw new HttpException(404, "Not Found");
|
||||
}
|
||||
|
@ -58,29 +84,80 @@ namespace WebsitePanel.WebDavPortal.Controllers
|
|||
|
||||
public ActionResult ShowOfficeDocument(string org, string pathPart = "")
|
||||
{
|
||||
string fileUrl = _webdavManager.RootPath.TrimEnd('/') + "/" + pathPart.TrimStart('/');
|
||||
var uri = new Uri(WebDavAppConfigManager.Instance.OfficeOnline.Url).AddParameter("src", fileUrl).ToString();
|
||||
var owaOpener = WebDavAppConfigManager.Instance.OfficeOnline.Single(x => x.Extension == Path.GetExtension(pathPart));
|
||||
|
||||
string fileUrl = WebDavAppConfigManager.Instance.WebdavRoot+ org + "/" + pathPart.TrimStart('/');
|
||||
var accessToken = _tokenManager.CreateToken(WspContext.User, pathPart);
|
||||
|
||||
string wopiSrc = Server.UrlDecode(Url.RouteUrl(OwaRouteNames.CheckFileInfo, new { accessTokenId = accessToken.Id }, Request.Url.Scheme));
|
||||
|
||||
var uri = string.Format("{0}/{1}?WOPISrc={2}&access_token={3}", WebDavAppConfigManager.Instance.OfficeOnline.Url, owaOpener.OwaOpener, Server.UrlEncode(wopiSrc), Server.UrlEncode(accessToken.AccessToken.ToString("N")));
|
||||
|
||||
return View(new OfficeOnlineModel(uri, new Uri(fileUrl).Segments.Last()));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult ShowAdditionalContent()
|
||||
public ActionResult ShowAdditionalContent(string path = "", int resourseRenderCount = 0)
|
||||
{
|
||||
if (Session[WebDavAppConfigManager.Instance.SessionKeys.ResourseRenderCount] != null)
|
||||
{
|
||||
var renderedElementsCount = (int)Session[WebDavAppConfigManager.Instance.SessionKeys.ResourseRenderCount];
|
||||
path = path.Replace(WspContext.User.OrganizationId, "").Trim('/');
|
||||
|
||||
IEnumerable<IHierarchyItem> children = _webdavManager.GetChildren();
|
||||
IEnumerable<IHierarchyItem> children = _webdavManager.OpenFolder(path);
|
||||
|
||||
var result = children.Skip(renderedElementsCount).Take(WebDavAppConfigManager.Instance.ElementsRendering.AddElementsCount);
|
||||
|
||||
Session[WebDavAppConfigManager.Instance.SessionKeys.ResourseRenderCount] = renderedElementsCount + WebDavAppConfigManager.Instance.ElementsRendering.AddElementsCount;
|
||||
var result = children.Skip(resourseRenderCount).Take(WebDavAppConfigManager.Instance.ElementsRendering.AddElementsCount);
|
||||
|
||||
return PartialView("_ResourseCollectionPartial", result);
|
||||
}
|
||||
|
||||
return new HttpStatusCodeResult(HttpStatusCode.NoContent); ;
|
||||
[HttpPost]
|
||||
public ActionResult UploadFile(string org, string pathPart)
|
||||
{
|
||||
foreach (string fileName in Request.Files)
|
||||
{
|
||||
var file = Request.Files[fileName];
|
||||
|
||||
if (file == null || file.ContentLength == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
_webdavManager.UploadFile(pathPart, file);
|
||||
}
|
||||
|
||||
return RedirectToRoute(FileSystemRouteNames.ShowContentPath);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public JsonResult DeleteFiles(IEnumerable<string> filePathes = null)
|
||||
{
|
||||
var model = new DeleteFilesModel();
|
||||
|
||||
if (filePathes == null)
|
||||
{
|
||||
model.AddMessage(MessageType.Error, Resources.NoFilesAreSelected);
|
||||
|
||||
return Json(model);
|
||||
}
|
||||
|
||||
foreach (var file in filePathes)
|
||||
{
|
||||
try
|
||||
{
|
||||
_webdavManager.DeleteResource(Server.UrlDecode(file));
|
||||
|
||||
model.DeletedFiles.Add(file);
|
||||
}
|
||||
catch (WebDavException exception)
|
||||
{
|
||||
model.AddMessage(MessageType.Error, exception.Message);
|
||||
}
|
||||
}
|
||||
|
||||
if (model.DeletedFiles.Any())
|
||||
{
|
||||
model.AddMessage(MessageType.Success, string.Format(Resources.ItemsWasRemovedFormat, model.DeletedFiles.Count));
|
||||
}
|
||||
|
||||
return Json(model);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
|
||||
using WebsitePanel.WebDav.Core.Interfaces.Managers;
|
||||
using WebsitePanel.WebDav.Core.Interfaces.Owa;
|
||||
using WebsitePanel.WebDav.Core.Interfaces.Security;
|
||||
using WebsitePanel.WebDav.Core.Security.Cryptography;
|
||||
using WebsitePanel.WebDav.Core.Wsp.Framework;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Controllers
|
||||
{
|
||||
[AllowAnonymous]
|
||||
public class OwaController : Controller
|
||||
{
|
||||
private readonly IWopiServer _wopiServer;
|
||||
private readonly IWebDavManager _webDavManager;
|
||||
private readonly IAuthenticationService _authenticationService;
|
||||
private readonly IAccessTokenManager _tokenManager;
|
||||
private readonly ICryptography _cryptography;
|
||||
private WebDavAccessToken _token;
|
||||
|
||||
|
||||
public OwaController(IWopiServer wopiServer, IWebDavManager webDavManager, IAuthenticationService authenticationService, IAccessTokenManager tokenManager, ICryptography cryptography)
|
||||
{
|
||||
_wopiServer = wopiServer;
|
||||
_webDavManager = webDavManager;
|
||||
_authenticationService = authenticationService;
|
||||
_tokenManager = tokenManager;
|
||||
_cryptography = cryptography;
|
||||
}
|
||||
|
||||
public ActionResult CheckFileInfo(int accessTokenId)
|
||||
{
|
||||
if (!CheckAccess(accessTokenId))
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.NoContent);
|
||||
}
|
||||
|
||||
var fileInfo = _wopiServer.GetCheckFileInfo(_token.FilePath);
|
||||
|
||||
return Json(fileInfo, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
|
||||
public ActionResult GetFile(int accessTokenId)
|
||||
{
|
||||
if (!CheckAccess(accessTokenId))
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.NoContent);
|
||||
}
|
||||
|
||||
return _wopiServer.GetFile((_token.FilePath));
|
||||
}
|
||||
|
||||
protected override void OnActionExecuting(ActionExecutingContext filterContext)
|
||||
{
|
||||
base.OnActionExecuting(filterContext);
|
||||
|
||||
if (!string.IsNullOrEmpty(Request["access_token"]))
|
||||
{
|
||||
var guid = Guid.Parse((Request["access_token"]));
|
||||
|
||||
_tokenManager.ClearExpiredTokens();
|
||||
|
||||
_token = _tokenManager.GetToken(guid);
|
||||
|
||||
var user = WSP.Services.ExchangeServer.GetAccount(_token.ItemId, _token.AccountId);
|
||||
|
||||
_authenticationService.LogIn(user.UserPrincipalName, _cryptography.Decrypt(_token.AuthData));
|
||||
}
|
||||
}
|
||||
|
||||
private bool CheckAccess(int accessTokenId)
|
||||
{
|
||||
if (_token == null || accessTokenId != _token.Id)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
using System.Reflection;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.CustomAttributes
|
||||
{
|
||||
public class FormValueRequiredAttribute : ActionMethodSelectorAttribute
|
||||
{
|
||||
private readonly string _submitButtonName;
|
||||
|
||||
public FormValueRequiredAttribute(string submitButtonName)
|
||||
{
|
||||
_submitButtonName = submitButtonName;
|
||||
}
|
||||
|
||||
public override bool IsValidForRequest(ControllerContext controllerContext, MethodInfo methodInfo)
|
||||
{
|
||||
var value = controllerContext.HttpContext.Request.Form[_submitButtonName];
|
||||
return !string.IsNullOrEmpty(value);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,15 +1,14 @@
|
|||
using Ninject;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.SessionState;
|
||||
using WebsitePanel.WebDav.Core.Interfaces.Managers;
|
||||
using WebsitePanel.WebDav.Core.Interfaces.Owa;
|
||||
using WebsitePanel.WebDav.Core.Interfaces.Security;
|
||||
using WebsitePanel.WebDav.Core.Security;
|
||||
using WebsitePanel.WebDav.Core.Managers;
|
||||
using WebsitePanel.WebDav.Core.Owa;
|
||||
using WebsitePanel.WebDav.Core.Security.Authentication;
|
||||
using WebsitePanel.WebDav.Core.Security.Authorization;
|
||||
using WebsitePanel.WebDav.Core.Security.Cryptography;
|
||||
using WebsitePanel.WebDavPortal.DependencyInjection.Providers;
|
||||
using WebsitePanel.WebDavPortal.Models;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.DependencyInjection
|
||||
{
|
||||
|
@ -20,7 +19,10 @@ namespace WebsitePanel.WebDavPortal.DependencyInjection
|
|||
kernel.Bind<HttpSessionState>().ToProvider<HttpSessionStateProvider>();
|
||||
kernel.Bind<ICryptography>().To<CryptoUtils>();
|
||||
kernel.Bind<IAuthenticationService>().To<FormsAuthenticationService>();
|
||||
kernel.Bind<IWebDavManager>().ToProvider<WebDavManagerProvider>();
|
||||
kernel.Bind<IWebDavManager>().To<WebDavManager>();
|
||||
kernel.Bind<IAccessTokenManager>().To<AccessTokenManager>();
|
||||
kernel.Bind<IWopiServer>().To<WopiServer>();
|
||||
kernel.Bind<IWebDavAuthorizationService>().To<WebDavAuthorizationService>();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,8 +4,8 @@ using Ninject;
|
|||
using Ninject.Activation;
|
||||
using WebsitePanel.WebDav.Core;
|
||||
using WebsitePanel.WebDav.Core.Config;
|
||||
using WebsitePanel.WebDav.Core.Managers;
|
||||
using WebsitePanel.WebDav.Core.Security.Cryptography;
|
||||
using WebsitePanel.WebDavPortal.Exceptions;
|
||||
using WebsitePanel.WebDavPortal.Models;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.DependencyInjection.Providers
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace WebsitePanel.WebDavPortal.FileOperations
|
|||
public FileOpenerManager()
|
||||
{
|
||||
if (WebDavAppConfigManager.Instance.OfficeOnline.IsEnabled)
|
||||
_operationTypes.AddRange(WebDavAppConfigManager.Instance.OfficeOnline.ToDictionary(x => x, y => FileOpenerType.OfficeOnline));
|
||||
_operationTypes.AddRange(WebDavAppConfigManager.Instance.OfficeOnline.ToDictionary(x => x.Extension, y => FileOpenerType.OfficeOnline));
|
||||
}
|
||||
|
||||
public FileOpenerType this[string fileExtension]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Optimization;
|
||||
|
@ -6,9 +7,12 @@ using System.Web.Routing;
|
|||
using System.Web.Script.Serialization;
|
||||
using System.Web.Security;
|
||||
using WebsitePanel.WebDav.Core.Config;
|
||||
using WebsitePanel.WebDav.Core.Interfaces.Security;
|
||||
using WebsitePanel.WebDav.Core.Security.Authentication.Principals;
|
||||
using WebsitePanel.WebDav.Core.Security.Cryptography;
|
||||
using WebsitePanel.WebDavPortal.Controllers;
|
||||
using WebsitePanel.WebDavPortal.DependencyInjection;
|
||||
using WebsitePanel.WebDavPortal.HttpHandlers;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal
|
||||
{
|
||||
|
@ -55,8 +59,11 @@ namespace WebsitePanel.WebDavPortal
|
|||
|
||||
protected void Application_PostAuthenticateRequest(Object sender, EventArgs e)
|
||||
{
|
||||
HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];
|
||||
var contextWrapper = new HttpContextWrapper(Context);
|
||||
HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];
|
||||
|
||||
var authService = DependencyResolver.Current.GetService<IAuthenticationService>();
|
||||
var cryptography = DependencyResolver.Current.GetService<ICryptography>();
|
||||
|
||||
if (authCookie != null)
|
||||
{
|
||||
|
@ -66,15 +73,7 @@ namespace WebsitePanel.WebDavPortal
|
|||
|
||||
var principalSerialized = serializer.Deserialize<WspPrincipal>(authTicket.UserData);
|
||||
|
||||
var principal = new WspPrincipal(principalSerialized.Login);
|
||||
|
||||
principal.AccountId = principalSerialized.AccountId;
|
||||
principal.ItemId = principalSerialized.ItemId;
|
||||
principal.OrganizationId = principalSerialized.OrganizationId;
|
||||
principal.DisplayName = principalSerialized.DisplayName;
|
||||
principal.EncryptedPassword = principalSerialized.EncryptedPassword;
|
||||
|
||||
HttpContext.Current.User = principal;
|
||||
authService.LogIn(principalSerialized.Login, cryptography.Decrypt(principalSerialized.EncryptedPassword));
|
||||
|
||||
if (!contextWrapper.Request.IsAjaxRequest())
|
||||
{
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using WebsitePanel.Providers.HostedSolution;
|
||||
using WebsitePanel.WebDavPortal.Models.Common;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Models
|
||||
{
|
||||
public class AccountModel
|
||||
public class AccountModel : BaseModel
|
||||
{
|
||||
[Required]
|
||||
[Display(Name = @"Login")]
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using WebsitePanel.WebDavPortal.Models.Common.Enums;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Models.Common
|
||||
{
|
||||
public class BaseModel
|
||||
{
|
||||
public BaseModel()
|
||||
{
|
||||
Messages = new List<Message>();
|
||||
}
|
||||
|
||||
public List<Message> Messages { get; private set; }
|
||||
|
||||
public void AddMessage(MessageType type, string value)
|
||||
{
|
||||
Messages.Add(new Message
|
||||
{
|
||||
Type =type,
|
||||
Value = value
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
namespace WebsitePanel.WebDavPortal.Models.Common.Enums
|
||||
{
|
||||
public enum MessageType
|
||||
{
|
||||
Success,
|
||||
Info,
|
||||
Warning,
|
||||
Error
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
using WebsitePanel.WebDavPortal.Models.Common.Enums;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Models.Common
|
||||
{
|
||||
public class Message
|
||||
{
|
||||
public MessageType Type {get;set;}
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,8 +1,9 @@
|
|||
using System;
|
||||
using WebsitePanel.WebDavPortal.Models.Common;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Models
|
||||
{
|
||||
public class ErrorModel
|
||||
public class ErrorModel : BaseModel
|
||||
{
|
||||
public int HttpStatusCode { get; set; }
|
||||
public string Message { get; set; }
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
using System.Collections.Generic;
|
||||
using WebsitePanel.WebDavPortal.Models.Common;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Models.FileSystem
|
||||
{
|
||||
public class DeleteFilesModel : BaseModel
|
||||
{
|
||||
public DeleteFilesModel()
|
||||
{
|
||||
DeletedFiles = new List<string>();
|
||||
}
|
||||
|
||||
public List<string> DeletedFiles { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
using WebsitePanel.WebDav.Core.Client;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Models
|
||||
{
|
||||
public interface IWebDavManager
|
||||
{
|
||||
string RootPath { get; }
|
||||
void OpenFolder(string pathPart);
|
||||
IEnumerable<IHierarchyItem> GetChildren();
|
||||
bool IsFile(string fileName);
|
||||
byte[] GetFileBytes(string fileName);
|
||||
string GetFileUrl(string fileName);
|
||||
}
|
||||
}
|
|
@ -1,12 +1,15 @@
|
|||
using System.Collections.Generic;
|
||||
using WebsitePanel.WebDav.Core.Client;
|
||||
using WebsitePanel.WebDav.Core.Security.Authorization.Enums;
|
||||
using WebsitePanel.WebDavPortal.Models.Common;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Models
|
||||
{
|
||||
public class ModelForWebDav
|
||||
public class ModelForWebDav : BaseModel
|
||||
{
|
||||
public IEnumerable<IHierarchyItem> Items { get; set; }
|
||||
public string UrlSuffix { get; set; }
|
||||
public string Error { get; set; }
|
||||
public WebDavPermissions Permissions { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
namespace WebsitePanel.WebDavPortal.Models
|
||||
using WebsitePanel.WebDavPortal.Models.Common;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Models
|
||||
{
|
||||
public class OfficeOnlineModel
|
||||
public class OfficeOnlineModel : BaseModel
|
||||
{
|
||||
public string Url { get; set; }
|
||||
public string FileName { get; set; }
|
||||
|
|
|
@ -1,172 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text.RegularExpressions;
|
||||
using WebsitePanel.WebDav.Core;
|
||||
using WebsitePanel.WebDav.Core.Client;
|
||||
using WebsitePanel.WebDav.Core.Config;
|
||||
using WebsitePanel.WebDav.Core.Security.Cryptography;
|
||||
using WebsitePanel.WebDav.Core.Wsp.Framework;
|
||||
using WebsitePanel.WebDavPortal.Exceptions;
|
||||
using WebsitePanel.Providers.OS;
|
||||
using Ninject;
|
||||
using WebsitePanel.WebDavPortal.DependencyInjection;
|
||||
using System.Web.Mvc;
|
||||
using log4net;
|
||||
|
||||
namespace WebsitePanel.WebDavPortal.Models
|
||||
{
|
||||
public class WebDavManager : IWebDavManager
|
||||
{
|
||||
private readonly ICryptography _cryptography;
|
||||
private readonly WebDavSession _webDavSession;
|
||||
|
||||
private readonly ILog Log;
|
||||
|
||||
private IList<SystemFile> _rootFolders;
|
||||
private int _itemId;
|
||||
private IFolder _currentFolder;
|
||||
private string _webDavRootPath;
|
||||
private bool _isRoot = true;
|
||||
|
||||
public string RootPath
|
||||
{
|
||||
get { return _webDavRootPath; }
|
||||
}
|
||||
|
||||
public WebDavManager(ICryptography cryptography)
|
||||
{
|
||||
_cryptography = cryptography;
|
||||
Log = LogManager.GetLogger(this.GetType());
|
||||
|
||||
var credential = new NetworkCredential(WspContext.User.Login, _cryptography.Decrypt(WspContext.User.EncryptedPassword), WebDavAppConfigManager.Instance.UserDomain);
|
||||
|
||||
_webDavSession = new WebDavSession();
|
||||
|
||||
_webDavSession.Credentials = credential;
|
||||
_itemId = WspContext.User.ItemId;
|
||||
_rootFolders = ConnectToWebDavServer();
|
||||
|
||||
if (_rootFolders.Any())
|
||||
{
|
||||
var folder = _rootFolders.First();
|
||||
var uri = new Uri(folder.Url);
|
||||
_webDavRootPath = uri.Scheme + "://" + uri.Host + uri.Segments[0] + uri.Segments[1];
|
||||
}
|
||||
}
|
||||
|
||||
public void OpenFolder(string pathPart)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(pathPart))
|
||||
{
|
||||
_isRoot = true;
|
||||
return;
|
||||
}
|
||||
_isRoot = false;
|
||||
_currentFolder = _webDavSession.OpenFolder(_webDavRootPath + pathPart);
|
||||
}
|
||||
|
||||
public IEnumerable<IHierarchyItem> GetChildren()
|
||||
{
|
||||
IHierarchyItem[] children;
|
||||
|
||||
if (_isRoot)
|
||||
{
|
||||
children = _rootFolders.Select(x => new WebDavHierarchyItem {Href = new Uri(x.Url), ItemType = ItemType.Folder}).ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
children = _currentFolder.GetChildren();
|
||||
}
|
||||
|
||||
List<IHierarchyItem> sortedChildren = children.Where(x => x.ItemType == ItemType.Folder).OrderBy(x => x.DisplayName).ToList();
|
||||
sortedChildren.AddRange(children.Where(x => x.ItemType != ItemType.Folder).OrderBy(x => x.DisplayName));
|
||||
|
||||
return sortedChildren;
|
||||
}
|
||||
|
||||
public bool IsFile(string fileName)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(fileName) | _currentFolder == null)
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
IResource resource = _currentFolder.GetResource(fileName);
|
||||
//Stream stream = resource.GetReadStream();
|
||||
return true;
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public byte[] GetFileBytes(string fileName)
|
||||
{
|
||||
try
|
||||
{
|
||||
IResource resource = _currentFolder.GetResource(fileName);
|
||||
Stream stream = resource.GetReadStream();
|
||||
byte[] fileBytes = ReadFully(stream);
|
||||
return fileBytes;
|
||||
}
|
||||
catch (InvalidOperationException exception)
|
||||
{
|
||||
throw new ResourceNotFoundException("Resource not found", exception);
|
||||
}
|
||||
}
|
||||
|
||||
public string GetFileUrl(string fileName)
|
||||
{
|
||||
try
|
||||
{
|
||||
IResource resource = _currentFolder.GetResource(fileName);
|
||||
return resource.Href.ToString();
|
||||
}
|
||||
catch (InvalidOperationException exception)
|
||||
{
|
||||
throw new ResourceNotFoundException("Resource not found", exception);
|
||||
}
|
||||
}
|
||||
|
||||
private IList<SystemFile> ConnectToWebDavServer()
|
||||
{
|
||||
var rootFolders = new List<SystemFile>();
|
||||
var user = WspContext.User;
|
||||
|
||||
var userGroups = WSP.Services.Organizations.GetSecurityGroupsByMember(user.ItemId, user.AccountId);
|
||||
|
||||
foreach (var folder in WSP.Services.EnterpriseStorage.GetEnterpriseFolders(_itemId))
|
||||
{
|
||||
var permissions = WSP.Services.EnterpriseStorage.GetEnterpriseFolderPermissions(_itemId, folder.Name);
|
||||
|
||||
foreach (var permission in permissions)
|
||||
{
|
||||
if ((!permission.IsGroup
|
||||
&& (permission.DisplayName == user.UserName || permission.DisplayName == user.DisplayName))
|
||||
|| (permission.IsGroup && userGroups.Any(x => x.DisplayName == permission.DisplayName)))
|
||||
{
|
||||
rootFolders.Add(folder);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return rootFolders;
|
||||
}
|
||||
|
||||
private byte[] ReadFully(Stream input)
|
||||
{
|
||||
var buffer = new byte[16*1024];
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
int read;
|
||||
while ((read = input.Read(buffer, 0, buffer.Length)) > 0)
|
||||
ms.Write(buffer, 0, read);
|
||||
return ms.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,13 @@
|
|||
/// <reference path="modernizr-2.8.3.js" />
|
||||
/// <reference path="jquery-2.1.1.js" />
|
||||
/// <autosync enabled="true" />
|
||||
/// <autosync enabled="true" />
|
||||
/// <reference path="bootstrap.js" />
|
||||
/// <reference path="jquery-2.1.1.js" />
|
||||
/// <reference path="jquery.cookie.js" />
|
||||
/// <reference path="jquery.validate.js" />
|
||||
/// <reference path="jquery.validate.unobtrusive.js" />
|
||||
/// <reference path="modernizr-2.8.3.js" />
|
||||
/// <reference path="npm.js" />
|
||||
/// <reference path="respond.js" />
|
||||
/// <reference path="respond.matchmedia.addlistener.js" />
|
||||
/// <reference path="appscripts/authentication.js" />
|
||||
/// <reference path="appscripts/recalculateresourseheight.js" />
|
||||
/// <reference path="appscripts/uploadingdata2.js" />
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
function WspDialogs() {
|
||||
this.settings = { dialogId: "#confirm-dialog", processDialogId: "#processDialog" };
|
||||
}
|
||||
|
||||
WspDialogs.prototype =
|
||||
{
|
||||
showConfirmDialog: function(title, content, positiveButton, positiveClickFunction, dialogId) {
|
||||
dialogId = dialogId || this.settings.dialogId;
|
||||
|
||||
//title replace
|
||||
if (title) {
|
||||
$(dialogId).find('.modal-title').empty();
|
||||
$(dialogId).find('.modal-title').text(title);
|
||||
}
|
||||
|
||||
//body replace
|
||||
$(dialogId).find('.modal-body').empty();
|
||||
$(dialogId).find('.modal-body').html(content);
|
||||
|
||||
//title replace
|
||||
if (positiveButton) {
|
||||
$(dialogId).find('.modal-footer .positive-button').empty();
|
||||
$(dialogId).find('.modal-footer .positive-button').text(positiveButton);
|
||||
}
|
||||
|
||||
//binding click event
|
||||
$(dialogId).find('.modal-footer .positive-button').unbind('click');
|
||||
$(dialogId).find('.modal-footer .positive-button').click(positiveClickFunction);
|
||||
|
||||
$(dialogId).modal();
|
||||
},
|
||||
|
||||
showProcessDialog: function() {
|
||||
$(this.settings.processDialogId).modal();
|
||||
},
|
||||
|
||||
hideProcessDialog: function() {
|
||||
$(this.settings.processDialogId).modal('hide');
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
wsp.dialogs = wsp.dialogs || (function () {
|
||||
var settings = { dialogId: "#confirm-dialog" };
|
||||
|
||||
return {
|
||||
settings: settings,
|
||||
|
||||
showConfirmDialog : function (title, content, positiveButton, positiveClickFunction, dialogId) {
|
||||
dialogId = dialogId || this.settings.dialogId;
|
||||
|
||||
//title replace
|
||||
if (title) {
|
||||
$(dialogId).find('.modal-title').empty();
|
||||
$(dialogId).find('.modal-title').text(title);
|
||||
}
|
||||
|
||||
//body replace
|
||||
$(dialogId).find('.modal-body').empty();
|
||||
$(dialogId).find('.modal-body').html(content);
|
||||
|
||||
//title replace
|
||||
if (positiveButton) {
|
||||
$(dialogId).find('.modal-footer .positive-button').empty();
|
||||
$(dialogId).find('.modal-footer .positive-button').text(positiveButton);
|
||||
}
|
||||
|
||||
//binding click event
|
||||
$(dialogId).find('.modal-footer .positive-button').unbind('click');
|
||||
$(dialogId).find('.modal-footer .positive-button').click(positiveClickFunction);
|
||||
|
||||
$(dialogId).modal();
|
||||
},
|
||||
|
||||
showProcessDialog: function () {
|
||||
$('#processDialog').modal();
|
||||
}
|
||||
};
|
||||
})();*/
|
|
@ -0,0 +1,89 @@
|
|||
function WspFileBrowser() {
|
||||
this.settings = { deletionBlockSelector: ".file-actions-menu .file-deletion", deletionUrl: "files-group-action/delete1" };
|
||||
}
|
||||
|
||||
WspFileBrowser.prototype = {
|
||||
setSettings: function(options) {
|
||||
this.settings = $.extend(this.settings, options);
|
||||
},
|
||||
|
||||
clearAllSelectedItems: function() {
|
||||
$('.element-container').removeClass("selected-file");
|
||||
},
|
||||
|
||||
selectItem: function(item) {
|
||||
$(item).addClass("selected-file");
|
||||
},
|
||||
|
||||
openItem: function(item) {
|
||||
var links = $(item).find('.file-link');
|
||||
|
||||
if (links.length != 0) {
|
||||
links[0].click();
|
||||
}
|
||||
},
|
||||
|
||||
getSelectedItemsCount: function() {
|
||||
return $('.element-container.selected-file').length;
|
||||
},
|
||||
|
||||
getSelectedItemsPaths: function() {
|
||||
return $('.element-container.selected-file a').map(function() {
|
||||
return $(this).attr('href');
|
||||
}).get();
|
||||
},
|
||||
|
||||
deleteSelectedItems: function(e) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: wsp.fileBrowser.settings.deletionUrl,
|
||||
data: { filePathes: wsp.fileBrowser.getSelectedItemsPaths() },
|
||||
dataType: "json",
|
||||
success: function(model) {
|
||||
wsp.messages.showMessages(model.Messages);
|
||||
|
||||
wsp.fileBrowser.clearDeletedItems(model.DeletedFiles);
|
||||
|
||||
wsp.fileBrowser.refreshDeletionBlock();
|
||||
|
||||
wsp.dialogs.hideProcessDialog();
|
||||
},
|
||||
error: function(jqXHR, textStatus, errorThrown) {
|
||||
wsp.messages.addErrorMessage(errorThrown);
|
||||
wsp.fileBrowser.refreshDeletionBlock();
|
||||
wsp.dialogs.hideProcessDialog();
|
||||
}
|
||||
});
|
||||
|
||||
wsp.dialogs.showProcessDialog();
|
||||
},
|
||||
|
||||
clearDeletedItems: function(items) {
|
||||
$.each(items, function(i, item) {
|
||||
$('.element-container').has('a[href="' + item + '"]').remove();
|
||||
});
|
||||
},
|
||||
refreshDeletionBlock: function() {
|
||||
if (this.getSelectedItemsCount() > 0) {
|
||||
|
||||
$(this.settings.deletionBlockSelector).css('display', 'inline-block');
|
||||
|
||||
} else {
|
||||
$(this.settings.deletionBlockSelector).hide();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
function WspMessager(messageDivId) {
|
||||
this.settings = {
|
||||
messageDivId: messageDivId,
|
||||
successClass: "alert-success",
|
||||
infoClass: "alert-info",
|
||||
warningClass: "alert-warning",
|
||||
dangerClass: "alert-danger",
|
||||
messageDivtemplate: '<div class="alert {0} alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>{1}</div>'
|
||||
};
|
||||
}
|
||||
|
||||
WspMessager.prototype = {
|
||||
addMessage: function(cssClass, message) {
|
||||
var messageDiv = jQuery.validator.format(this.settings.messageDivtemplate, cssClass, message);
|
||||
|
||||
$(messageDiv).appendTo(this.settings.messageDivId);
|
||||
},
|
||||
|
||||
addSuccessMessage: function(message) {
|
||||
this.addMessage(this.settings.successClass, message);
|
||||
},
|
||||
|
||||
addInfoMessage: function(message) {
|
||||
this.addMessage(this.settings.infoClass, message);
|
||||
},
|
||||
|
||||
addWarningMessage : function (message) {
|
||||
this.addMessage(this.settings.warningClass, message);
|
||||
},
|
||||
|
||||
addErrorMessage: function (message) {
|
||||
this.addMessage(this.settings.dangerClass, message);
|
||||
},
|
||||
|
||||
showMessages: function (messages) {
|
||||
var objthis = this;
|
||||
|
||||
$.each(messages, function(i, message) {
|
||||
|
||||
if ((message.Type == 0)) {
|
||||
objthis.addSuccessMessage(message.Value);
|
||||
}
|
||||
else if (message.Type == 1) {
|
||||
objthis.addInfoMessage(message.Value);
|
||||
}
|
||||
else if (message.Type == 2) {
|
||||
objthis.addWarningMessage(message.Value);
|
||||
}
|
||||
else if (message.Type == 3) {
|
||||
objthis.addErrorMessage(message.Value);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
|
@ -6,6 +6,10 @@
|
|||
|
||||
maxHeight = Math.max.apply(null, heights);
|
||||
|
||||
if (maxHeight < 135) {
|
||||
maxHeight = 135;
|
||||
}
|
||||
|
||||
$(".element-container").height(maxHeight);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -14,8 +14,8 @@ var oldResourcesDivHeight = $('#resourcesDiv').height();
|
|||
function GetResources() {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/FileSystem/ShowAdditionalContent',
|
||||
data: '',
|
||||
url: '/show-additional-content',
|
||||
data: { path: window.location.pathname, resourseRenderCount: $(".element-container").length },
|
||||
dataType: "html",
|
||||
success: function (result) {
|
||||
var domElement = $(result);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue