add new functionallity "Additional Default Groups"
This commit is contained in:
parent
b56981b1a6
commit
9d5e559604
22 changed files with 913 additions and 279 deletions
|
@ -2240,4 +2240,94 @@ LEFT OUTER JOIN ExchangeMailboxPlans AS P ON EA.MailboxPlanId = P.MailboxPlanId
|
||||||
EXEC sp_executesql @sql, N'@ItemID int', @ItemID
|
EXEC sp_executesql @sql, N'@ItemID int', @ItemID
|
||||||
|
|
||||||
RETURN
|
RETURN
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
---- Additional Default Groups-------------
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.TABLES WHERE name = 'AdditionalGroups')
|
||||||
|
DROP TABLE AdditionalGroups
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE TABLE AdditionalGroups
|
||||||
|
(
|
||||||
|
ID INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
|
||||||
|
UserID INT NOT NULL,
|
||||||
|
GroupName NVARCHAR(255)
|
||||||
|
)
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'GetAdditionalGroups')
|
||||||
|
DROP PROCEDURE GetAdditionalGroups
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[GetAdditionalGroups]
|
||||||
|
(
|
||||||
|
@UserID INT
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
AG.ID,
|
||||||
|
AG.UserID,
|
||||||
|
AG.GroupName
|
||||||
|
FROM AdditionalGroups AS AG
|
||||||
|
WHERE AG.UserID = @UserID
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'AddAdditionalGroup')
|
||||||
|
DROP PROCEDURE AddAdditionalGroup
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[AddAdditionalGroup]
|
||||||
|
(
|
||||||
|
@GroupID INT OUTPUT,
|
||||||
|
@UserID INT,
|
||||||
|
@GroupName NVARCHAR(255)
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
INSERT INTO AdditionalGroups
|
||||||
|
(
|
||||||
|
UserID,
|
||||||
|
GroupName
|
||||||
|
)
|
||||||
|
VALUES
|
||||||
|
(
|
||||||
|
@UserID,
|
||||||
|
@GroupName
|
||||||
|
)
|
||||||
|
|
||||||
|
SET @GroupID = SCOPE_IDENTITY()
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'DeleteAdditionalGroup')
|
||||||
|
DROP PROCEDURE DeleteAdditionalGroup
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[DeleteAdditionalGroup]
|
||||||
|
(
|
||||||
|
@GroupID INT
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
DELETE FROM AdditionalGroups
|
||||||
|
WHERE ID = @GroupID
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF EXISTS (SELECT * FROM SYS.OBJECTS WHERE type = 'P' AND name = 'UpdateAdditionalGroup')
|
||||||
|
DROP PROCEDURE UpdateAdditionalGroup
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[UpdateAdditionalGroup]
|
||||||
|
(
|
||||||
|
@GroupID INT,
|
||||||
|
@GroupName NVARCHAR(255)
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
UPDATE AdditionalGroups SET
|
||||||
|
GroupName = @GroupName
|
||||||
|
WHERE ID = @GroupID
|
||||||
|
GO
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
namespace WebsitePanel.EnterpriseServer.Base.HostedSolution
|
||||||
|
{
|
||||||
|
public class AdditionalGroup
|
||||||
|
{
|
||||||
|
int groupId;
|
||||||
|
string groupName;
|
||||||
|
|
||||||
|
public int GroupId
|
||||||
|
{
|
||||||
|
get { return this.groupId; }
|
||||||
|
set { this.groupId = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GroupName
|
||||||
|
{
|
||||||
|
get { return this.groupName; }
|
||||||
|
set { this.groupName = value; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -116,6 +116,7 @@
|
||||||
<Compile Include="Ecommerce\TransactionResult.cs" />
|
<Compile Include="Ecommerce\TransactionResult.cs" />
|
||||||
<Compile Include="Ecommerce\TriggerSystem\ITriggerHandler.cs" />
|
<Compile Include="Ecommerce\TriggerSystem\ITriggerHandler.cs" />
|
||||||
<Compile Include="ExchangeServer\ExchangeEmailAddress.cs" />
|
<Compile Include="ExchangeServer\ExchangeEmailAddress.cs" />
|
||||||
|
<Compile Include="HostedSolution\AdditionalGroup.cs" />
|
||||||
<Compile Include="Log\LogRecord.cs" />
|
<Compile Include="Log\LogRecord.cs" />
|
||||||
<Compile Include="Packages\HostingPlanContext.cs" />
|
<Compile Include="Packages\HostingPlanContext.cs" />
|
||||||
<Compile Include="Packages\HostingPlanGroupInfo.cs" />
|
<Compile Include="Packages\HostingPlanGroupInfo.cs" />
|
||||||
|
@ -236,6 +237,7 @@
|
||||||
<Install>true</Install>
|
<Install>true</Install>
|
||||||
</BootstrapperPackage>
|
</BootstrapperPackage>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup />
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|
|
@ -53,6 +53,7 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution
|
||||||
using WebsitePanel.Providers.Common;
|
using WebsitePanel.Providers.Common;
|
||||||
using WebsitePanel.Providers.HostedSolution;
|
using WebsitePanel.Providers.HostedSolution;
|
||||||
using WebsitePanel.Providers.ResultObjects;
|
using WebsitePanel.Providers.ResultObjects;
|
||||||
|
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
|
||||||
|
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
|
@ -135,6 +136,14 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution
|
||||||
|
|
||||||
private System.Threading.SendOrPostCallback SearchOrganizationAccountsOperationCompleted;
|
private System.Threading.SendOrPostCallback SearchOrganizationAccountsOperationCompleted;
|
||||||
|
|
||||||
|
private System.Threading.SendOrPostCallback GetAdditionalGroupsOperationCompleted;
|
||||||
|
|
||||||
|
private System.Threading.SendOrPostCallback UpdateAdditionalGroupOperationCompleted;
|
||||||
|
|
||||||
|
private System.Threading.SendOrPostCallback DeleteAdditionalGroupOperationCompleted;
|
||||||
|
|
||||||
|
private System.Threading.SendOrPostCallback AddAdditionalGroupOperationCompleted;
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
public esOrganizations()
|
public esOrganizations()
|
||||||
{
|
{
|
||||||
|
@ -246,6 +255,19 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
public event SearchOrganizationAccountsCompletedEventHandler SearchOrganizationAccountsCompleted;
|
public event SearchOrganizationAccountsCompletedEventHandler SearchOrganizationAccountsCompleted;
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public event GetAdditionalGroupsCompletedEventHandler GetAdditionalGroupsCompleted;
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public event UpdateAdditionalGroupCompletedEventHandler UpdateAdditionalGroupCompleted;
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public event DeleteAdditionalGroupCompletedEventHandler DeleteAdditionalGroupCompleted;
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public event AddAdditionalGroupCompletedEventHandler AddAdditionalGroupCompleted;
|
||||||
|
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/CheckOrgIdExists", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/CheckOrgIdExists", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||||
public bool CheckOrgIdExists(string orgId)
|
public bool CheckOrgIdExists(string orgId)
|
||||||
|
@ -2388,6 +2410,204 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetAdditionalGroups", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||||
|
public AdditionalGroup[] GetAdditionalGroups(int userId)
|
||||||
|
{
|
||||||
|
object[] results = this.Invoke("GetAdditionalGroups", new object[] {
|
||||||
|
userId});
|
||||||
|
return ((AdditionalGroup[])(results[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public System.IAsyncResult BeginGetAdditionalGroups(int userId, System.AsyncCallback callback, object asyncState)
|
||||||
|
{
|
||||||
|
return this.BeginInvoke("GetAdditionalGroups", new object[] {
|
||||||
|
userId}, callback, asyncState);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public AdditionalGroup[] EndGetAdditionalGroups(System.IAsyncResult asyncResult)
|
||||||
|
{
|
||||||
|
object[] results = this.EndInvoke(asyncResult);
|
||||||
|
return ((AdditionalGroup[])(results[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void GetAdditionalGroupsAsync(int userId)
|
||||||
|
{
|
||||||
|
this.GetAdditionalGroupsAsync(userId, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void GetAdditionalGroupsAsync(int userId, object userState)
|
||||||
|
{
|
||||||
|
if ((this.GetAdditionalGroupsOperationCompleted == null))
|
||||||
|
{
|
||||||
|
this.GetAdditionalGroupsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetAdditionalGroupsOperationCompleted);
|
||||||
|
}
|
||||||
|
this.InvokeAsync("GetAdditionalGroups", new object[] {
|
||||||
|
userId}, this.GetAdditionalGroupsOperationCompleted, userState);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnGetAdditionalGroupsOperationCompleted(object arg)
|
||||||
|
{
|
||||||
|
if ((this.GetAdditionalGroupsCompleted != null))
|
||||||
|
{
|
||||||
|
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||||
|
this.GetAdditionalGroupsCompleted(this, new GetAdditionalGroupsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/UpdateAdditionalGroup", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||||
|
public void UpdateAdditionalGroup(int groupId, string groupName)
|
||||||
|
{
|
||||||
|
this.Invoke("UpdateAdditionalGroup", new object[] {
|
||||||
|
groupId,
|
||||||
|
groupName});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public System.IAsyncResult BeginUpdateAdditionalGroup(int groupId, string groupName, System.AsyncCallback callback, object asyncState)
|
||||||
|
{
|
||||||
|
return this.BeginInvoke("UpdateAdditionalGroup", new object[] {
|
||||||
|
groupId,
|
||||||
|
groupName}, callback, asyncState);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void EndUpdateAdditionalGroup(System.IAsyncResult asyncResult)
|
||||||
|
{
|
||||||
|
this.EndInvoke(asyncResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void UpdateAdditionalGroupAsync(int groupId, string groupName)
|
||||||
|
{
|
||||||
|
this.UpdateAdditionalGroupAsync(groupId, groupName, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void UpdateAdditionalGroupAsync(int groupId, string groupName, object userState)
|
||||||
|
{
|
||||||
|
if ((this.UpdateAdditionalGroupOperationCompleted == null))
|
||||||
|
{
|
||||||
|
this.UpdateAdditionalGroupOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdateAdditionalGroupOperationCompleted);
|
||||||
|
}
|
||||||
|
this.InvokeAsync("UpdateAdditionalGroup", new object[] {
|
||||||
|
groupId,
|
||||||
|
groupName}, this.UpdateAdditionalGroupOperationCompleted, userState);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnUpdateAdditionalGroupOperationCompleted(object arg)
|
||||||
|
{
|
||||||
|
if ((this.UpdateAdditionalGroupCompleted != null))
|
||||||
|
{
|
||||||
|
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||||
|
this.UpdateAdditionalGroupCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/DeleteAdditionalGroup", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||||
|
public void DeleteAdditionalGroup(int groupId)
|
||||||
|
{
|
||||||
|
this.Invoke("DeleteAdditionalGroup", new object[] {
|
||||||
|
groupId});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public System.IAsyncResult BeginDeleteAdditionalGroup(int groupId, System.AsyncCallback callback, object asyncState)
|
||||||
|
{
|
||||||
|
return this.BeginInvoke("DeleteAdditionalGroup", new object[] {
|
||||||
|
groupId}, callback, asyncState);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void EndDeleteAdditionalGroup(System.IAsyncResult asyncResult)
|
||||||
|
{
|
||||||
|
this.EndInvoke(asyncResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void DeleteAdditionalGroupAsync(int groupId)
|
||||||
|
{
|
||||||
|
this.DeleteAdditionalGroupAsync(groupId, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void DeleteAdditionalGroupAsync(int groupId, object userState)
|
||||||
|
{
|
||||||
|
if ((this.DeleteAdditionalGroupOperationCompleted == null))
|
||||||
|
{
|
||||||
|
this.DeleteAdditionalGroupOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDeleteAdditionalGroupOperationCompleted);
|
||||||
|
}
|
||||||
|
this.InvokeAsync("DeleteAdditionalGroup", new object[] {
|
||||||
|
groupId}, this.DeleteAdditionalGroupOperationCompleted, userState);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDeleteAdditionalGroupOperationCompleted(object arg)
|
||||||
|
{
|
||||||
|
if ((this.DeleteAdditionalGroupCompleted != null))
|
||||||
|
{
|
||||||
|
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||||
|
this.DeleteAdditionalGroupCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/AddAdditionalGroup", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||||
|
public int AddAdditionalGroup(int userId, string groupName)
|
||||||
|
{
|
||||||
|
object[] results = this.Invoke("AddAdditionalGroup", new object[] {
|
||||||
|
userId,
|
||||||
|
groupName});
|
||||||
|
return ((int)(results[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public System.IAsyncResult BeginAddAdditionalGroup(int userId, string groupName, System.AsyncCallback callback, object asyncState)
|
||||||
|
{
|
||||||
|
return this.BeginInvoke("AddAdditionalGroup", new object[] {
|
||||||
|
userId,
|
||||||
|
groupName}, callback, asyncState);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public int EndAddAdditionalGroup(System.IAsyncResult asyncResult)
|
||||||
|
{
|
||||||
|
object[] results = this.EndInvoke(asyncResult);
|
||||||
|
return ((int)(results[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void AddAdditionalGroupAsync(int userId, string groupName)
|
||||||
|
{
|
||||||
|
this.AddAdditionalGroupAsync(userId, groupName, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public void AddAdditionalGroupAsync(int userId, string groupName, object userState)
|
||||||
|
{
|
||||||
|
if ((this.AddAdditionalGroupOperationCompleted == null))
|
||||||
|
{
|
||||||
|
this.AddAdditionalGroupOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddAdditionalGroupOperationCompleted);
|
||||||
|
}
|
||||||
|
this.InvokeAsync("AddAdditionalGroup", new object[] {
|
||||||
|
userId,
|
||||||
|
groupName}, this.AddAdditionalGroupOperationCompleted, userState);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnAddAdditionalGroupOperationCompleted(object arg)
|
||||||
|
{
|
||||||
|
if ((this.AddAdditionalGroupCompleted != null))
|
||||||
|
{
|
||||||
|
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
|
||||||
|
this.AddAdditionalGroupCompleted(this, new AddAdditionalGroupCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
public new void CancelAsync(object userState)
|
public new void CancelAsync(object userState)
|
||||||
{
|
{
|
||||||
|
@ -3444,4 +3664,72 @@ namespace WebsitePanel.EnterpriseServer.HostedSolution
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||||
|
public delegate void GetAdditionalGroupsCompletedEventHandler(object sender, GetAdditionalGroupsCompletedEventArgs e);
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||||
|
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||||
|
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||||
|
public partial class GetAdditionalGroupsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
|
||||||
|
{
|
||||||
|
|
||||||
|
private object[] results;
|
||||||
|
|
||||||
|
internal GetAdditionalGroupsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
|
||||||
|
base(exception, cancelled, userState)
|
||||||
|
{
|
||||||
|
this.results = results;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
public AdditionalGroup[] Result
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
this.RaiseExceptionIfNecessary();
|
||||||
|
return ((AdditionalGroup[])(this.results[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||||
|
public delegate void UpdateAdditionalGroupCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||||
|
public delegate void DeleteAdditionalGroupCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||||
|
public delegate void AddAdditionalGroupCompletedEventHandler(object sender, AddAdditionalGroupCompletedEventArgs e);
|
||||||
|
|
||||||
|
/// <remarks/>
|
||||||
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
|
||||||
|
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||||
|
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||||
|
public partial class AddAdditionalGroupCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
|
||||||
|
{
|
||||||
|
|
||||||
|
private object[] results;
|
||||||
|
|
||||||
|
internal AddAdditionalGroupCompletedEventArgs(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]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -2981,6 +2981,53 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
#region Organizations
|
#region Organizations
|
||||||
|
|
||||||
|
public static IDataReader GetAdditionalGroups(int userId)
|
||||||
|
{
|
||||||
|
return SqlHelper.ExecuteReader(
|
||||||
|
ConnectionString,
|
||||||
|
CommandType.StoredProcedure,
|
||||||
|
"GetAdditionalGroups",
|
||||||
|
new SqlParameter("@UserID", userId)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static int AddAdditionalGroup(int userId, string groupName)
|
||||||
|
{
|
||||||
|
SqlParameter prmId = new SqlParameter("@GroupID", SqlDbType.Int);
|
||||||
|
prmId.Direction = ParameterDirection.Output;
|
||||||
|
|
||||||
|
SqlHelper.ExecuteNonQuery(
|
||||||
|
ConnectionString,
|
||||||
|
CommandType.StoredProcedure,
|
||||||
|
"AddAdditionalGroup",
|
||||||
|
prmId,
|
||||||
|
new SqlParameter("@UserID", userId),
|
||||||
|
new SqlParameter("@GroupName", groupName));
|
||||||
|
|
||||||
|
// read identity
|
||||||
|
return Convert.ToInt32(prmId.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void DeleteAdditionalGroup(int groupId)
|
||||||
|
{
|
||||||
|
SqlHelper.ExecuteNonQuery(ConnectionString,
|
||||||
|
CommandType.StoredProcedure,
|
||||||
|
"DeleteAdditionalGroup",
|
||||||
|
new SqlParameter("@GroupID", groupId));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void UpdateAdditionalGroup(int groupId, string groupName)
|
||||||
|
{
|
||||||
|
SqlHelper.ExecuteNonQuery(
|
||||||
|
ConnectionString,
|
||||||
|
CommandType.StoredProcedure,
|
||||||
|
"UpdateAdditionalGroup",
|
||||||
|
new SqlParameter("@GroupID", groupId),
|
||||||
|
new SqlParameter("@GroupName", groupName)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public static void DeleteOrganizationUser(int itemId)
|
public static void DeleteOrganizationUser(int itemId)
|
||||||
{
|
{
|
||||||
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, "DeleteOrganizationUsers", new SqlParameter("@ItemID", itemId));
|
SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.StoredProcedure, "DeleteOrganizationUsers", new SqlParameter("@ItemID", itemId));
|
||||||
|
|
|
@ -47,6 +47,7 @@ using System.Linq;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
|
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
|
||||||
|
|
||||||
namespace WebsitePanel.EnterpriseServer
|
namespace WebsitePanel.EnterpriseServer
|
||||||
{
|
{
|
||||||
|
@ -304,21 +305,6 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
if (OrganizationIdentifierExists(organizationId))
|
if (OrganizationIdentifierExists(organizationId))
|
||||||
return BusinessErrorCodes.ERROR_ORG_ID_EXISTS;
|
return BusinessErrorCodes.ERROR_ORG_ID_EXISTS;
|
||||||
|
|
||||||
// load user info
|
|
||||||
UserInfo user = PackageController.GetPackageOwner(packageId);
|
|
||||||
|
|
||||||
// get letter settings
|
|
||||||
UserSettings settings = UserController.GetUserSettings(user.UserId, UserSettings.EXCHANGE_POLICY);
|
|
||||||
|
|
||||||
bool enableDefaultGroup = true;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// parse settings
|
|
||||||
string[] parts = settings["OrgPolicy"].Split(';');
|
|
||||||
enableDefaultGroup = Convert.ToBoolean(parts[0]) && Convert.ToBoolean(parts[1]);
|
|
||||||
}
|
|
||||||
catch { /* skip */ }
|
|
||||||
|
|
||||||
// Create Organization Unit
|
// Create Organization Unit
|
||||||
int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.HostedOrganizations);
|
int serviceId = PackageController.GetPackageServiceId(packageId, ResourceGroups.HostedOrganizations);
|
||||||
|
|
||||||
|
@ -326,7 +312,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
Organization org = null;
|
Organization org = null;
|
||||||
if (!orgProxy.OrganizationExists(organizationId))
|
if (!orgProxy.OrganizationExists(organizationId))
|
||||||
{
|
{
|
||||||
org = orgProxy.CreateOrganization(organizationId, enableDefaultGroup);
|
org = orgProxy.CreateOrganization(organizationId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return BusinessErrorCodes.ERROR_ORG_ID_EXISTS;
|
return BusinessErrorCodes.ERROR_ORG_ID_EXISTS;
|
||||||
|
@ -386,12 +372,40 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
// register domain
|
// register domain
|
||||||
DataProvider.AddExchangeOrganizationDomain(itemId, domainId, true);
|
DataProvider.AddExchangeOrganizationDomain(itemId, domainId, true);
|
||||||
|
|
||||||
if (enableDefaultGroup)
|
//add to exchangeAcounts
|
||||||
|
AddAccount(itemId, ExchangeAccountType.DefaultSecurityGroup, org.GroupName,
|
||||||
|
org.GroupName, null, false,
|
||||||
|
0, org.GroupName, null, 0, null);
|
||||||
|
|
||||||
|
|
||||||
|
// load user info
|
||||||
|
UserInfo user = PackageController.GetPackageOwner(packageId);
|
||||||
|
|
||||||
|
// get letter settings
|
||||||
|
UserSettings settings = UserController.GetUserSettings(user.UserId, UserSettings.EXCHANGE_POLICY);
|
||||||
|
|
||||||
|
bool enableAdditionalGroup = false;
|
||||||
|
try
|
||||||
{
|
{
|
||||||
//add to exchangeAcounts
|
// parse settings
|
||||||
AddAccount(itemId, ExchangeAccountType.DefaultSecurityGroup, org.GroupName,
|
enableAdditionalGroup = Utils.ParseBool(settings["OrgPolicy"], false);
|
||||||
org.GroupName, null, false,
|
}
|
||||||
0, org.GroupName, null, 0, null);
|
catch { /* skip */ }
|
||||||
|
|
||||||
|
if (enableAdditionalGroup)
|
||||||
|
{
|
||||||
|
foreach (AdditionalGroup additionalGroup in GetAdditionalGroups(settings.UserId))
|
||||||
|
{
|
||||||
|
string additionalGroupName = BuildAccountNameWithOrgId(org.OrganizationId, additionalGroup.GroupName.Replace(" ", ""), org.ServiceId);
|
||||||
|
|
||||||
|
if (orgProxy.CreateSecurityGroup(org.OrganizationId, additionalGroupName) == 0)
|
||||||
|
{
|
||||||
|
OrganizationSecurityGroup retSecurityGroup = orgProxy.GetSecurityGroupGeneralSettings(additionalGroupName, org.OrganizationId);
|
||||||
|
|
||||||
|
AddAccount(itemId, ExchangeAccountType.SecurityGroup, additionalGroupName,
|
||||||
|
additionalGroup.GroupName, null, false, 0, retSecurityGroup.SAMAccountName, null, 0, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// register organization domain service item
|
// register organization domain service item
|
||||||
|
@ -1359,9 +1373,7 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
TaskManager.Write("accountName :" + sAMAccountName);
|
TaskManager.Write("accountName :" + sAMAccountName);
|
||||||
TaskManager.Write("upn :" + upn);
|
TaskManager.Write("upn :" + upn);
|
||||||
|
|
||||||
bool enableDefaultGroup = !string.IsNullOrEmpty(org.SecurityGroup);
|
if (orgProxy.CreateUser(org.OrganizationId, sAMAccountName, displayName, upn, password, enabled) == 0)
|
||||||
|
|
||||||
if (orgProxy.CreateUser(org.OrganizationId, sAMAccountName, displayName, upn, password, enabled, enableDefaultGroup) == 0)
|
|
||||||
{
|
{
|
||||||
accountName = sAMAccountName;
|
accountName = sAMAccountName;
|
||||||
OrganizationUser retUser = orgProxy.GetUserGeneralSettings(sAMAccountName, org.OrganizationId);
|
OrganizationUser retUser = orgProxy.GetUserGeneralSettings(sAMAccountName, org.OrganizationId);
|
||||||
|
@ -2236,6 +2248,45 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
mailboxManagerActions.ToString(), samAccountName, CryptoUtils.Encrypt(accountPassword), mailboxPlanId, (string.IsNullOrEmpty(subscriberNumber) ? null : subscriberNumber.Trim()));
|
mailboxManagerActions.ToString(), samAccountName, CryptoUtils.Encrypt(accountPassword), mailboxPlanId, (string.IsNullOrEmpty(subscriberNumber) ? null : subscriberNumber.Trim()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Additional Default Groups
|
||||||
|
|
||||||
|
public static List<AdditionalGroup> GetAdditionalGroups(int userId)
|
||||||
|
{
|
||||||
|
List<AdditionalGroup> additionalGroups = new List<AdditionalGroup>();
|
||||||
|
|
||||||
|
IDataReader reader = DataProvider.GetAdditionalGroups(userId);
|
||||||
|
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
additionalGroups.Add(new AdditionalGroup
|
||||||
|
{
|
||||||
|
GroupId = (int)reader["ID"],
|
||||||
|
GroupName = (string)reader["GroupName"]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
reader.Close();
|
||||||
|
|
||||||
|
return additionalGroups;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void UpdateAdditionalGroup(int groupId, string groupName)
|
||||||
|
{
|
||||||
|
DataProvider.UpdateAdditionalGroup(groupId, groupName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void DeleteAdditionalGroup(int groupId)
|
||||||
|
{
|
||||||
|
DataProvider.DeleteAdditionalGroup(groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int AddAdditionalGroup(int userId, string groupName)
|
||||||
|
{
|
||||||
|
return DataProvider.AddAdditionalGroup(userId, groupName);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
public static int CreateSecurityGroup(int itemId, string displayName)
|
public static int CreateSecurityGroup(int itemId, string displayName)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(displayName))
|
if (string.IsNullOrEmpty(displayName))
|
||||||
|
|
|
@ -30,6 +30,7 @@ using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Web.Services;
|
using System.Web.Services;
|
||||||
|
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
|
||||||
using WebsitePanel.Providers.HostedSolution;
|
using WebsitePanel.Providers.HostedSolution;
|
||||||
using WebsitePanel.Providers.ResultObjects;
|
using WebsitePanel.Providers.ResultObjects;
|
||||||
|
|
||||||
|
@ -119,7 +120,6 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region Domains
|
#region Domains
|
||||||
|
|
||||||
[WebMethod]
|
[WebMethod]
|
||||||
|
@ -154,7 +154,6 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region Users
|
#region Users
|
||||||
|
|
||||||
[WebMethod]
|
[WebMethod]
|
||||||
|
@ -303,5 +302,33 @@ namespace WebsitePanel.EnterpriseServer
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Additional Default Groups
|
||||||
|
|
||||||
|
[WebMethod]
|
||||||
|
public List<AdditionalGroup> GetAdditionalGroups(int userId)
|
||||||
|
{
|
||||||
|
return OrganizationController.GetAdditionalGroups(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
[WebMethod]
|
||||||
|
public void UpdateAdditionalGroup(int groupId, string groupName)
|
||||||
|
{
|
||||||
|
OrganizationController.UpdateAdditionalGroup(groupId, groupName);
|
||||||
|
}
|
||||||
|
|
||||||
|
[WebMethod]
|
||||||
|
public void DeleteAdditionalGroup(int groupId)
|
||||||
|
{
|
||||||
|
OrganizationController.DeleteAdditionalGroup(groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
[WebMethod]
|
||||||
|
public int AddAdditionalGroup(int userId, string groupName)
|
||||||
|
{
|
||||||
|
return OrganizationController.AddAdditionalGroup(userId, groupName);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,11 +32,11 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
{
|
{
|
||||||
public interface IOrganization
|
public interface IOrganization
|
||||||
{
|
{
|
||||||
Organization CreateOrganization(string organizationId, bool enableDefaultGroup);
|
Organization CreateOrganization(string organizationId);
|
||||||
|
|
||||||
void DeleteOrganization(string organizationId);
|
void DeleteOrganization(string organizationId);
|
||||||
|
|
||||||
int CreateUser(string organizationId, string loginName, string displayName, string upn, string password, bool enabled, bool enableDefaultGroup);
|
int CreateUser(string organizationId, string loginName, string displayName, string upn, string password, bool enabled);
|
||||||
|
|
||||||
void DeleteUser(string loginName, string organizationId);
|
void DeleteUser(string loginName, string organizationId);
|
||||||
|
|
||||||
|
|
|
@ -771,42 +771,28 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
string server = GetServerName();
|
string server = GetServerName();
|
||||||
string securityGroupPath = AddADPrefix(securityGroup);
|
string securityGroupPath = AddADPrefix(securityGroup);
|
||||||
|
|
||||||
bool enableDefaultGroup = !string.IsNullOrEmpty(securityGroup);
|
//Create mail enabled organization security group
|
||||||
|
EnableMailSecurityDistributionGroup(runSpace, securityGroup, organizationId);
|
||||||
if (enableDefaultGroup)
|
transaction.RegisterMailEnabledDistributionGroup(securityGroup);
|
||||||
{
|
UpdateSecurityDistributionGroup(runSpace, securityGroup, organizationId, IsConsumer);
|
||||||
//Create mail enabled organization security group
|
|
||||||
EnableMailSecurityDistributionGroup(runSpace, securityGroup, organizationId);
|
|
||||||
transaction.RegisterMailEnabledDistributionGroup(securityGroup);
|
|
||||||
UpdateSecurityDistributionGroup(runSpace, securityGroup, organizationId, IsConsumer);
|
|
||||||
}
|
|
||||||
|
|
||||||
//create GAL
|
//create GAL
|
||||||
string galId = CreateGlobalAddressList(runSpace, organizationId);
|
string galId = CreateGlobalAddressList(runSpace, organizationId);
|
||||||
transaction.RegisterNewGlobalAddressList(galId);
|
transaction.RegisterNewGlobalAddressList(galId);
|
||||||
ExchangeLog.LogInfo(" Global Address List: {0}", galId);
|
ExchangeLog.LogInfo(" Global Address List: {0}", galId);
|
||||||
if (enableDefaultGroup)
|
UpdateGlobalAddressList(runSpace, galId, securityGroupPath);
|
||||||
{
|
|
||||||
UpdateGlobalAddressList(runSpace, galId, securityGroupPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
//create AL
|
//create AL
|
||||||
string alId = CreateAddressList(runSpace, organizationId);
|
string alId = CreateAddressList(runSpace, organizationId);
|
||||||
transaction.RegisterNewAddressList(alId);
|
transaction.RegisterNewAddressList(alId);
|
||||||
ExchangeLog.LogInfo(" Address List: {0}", alId);
|
ExchangeLog.LogInfo(" Address List: {0}", alId);
|
||||||
if (enableDefaultGroup)
|
UpdateAddressList(runSpace, alId, securityGroupPath);
|
||||||
{
|
|
||||||
UpdateAddressList(runSpace, alId, securityGroupPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
//create RAL
|
//create RAL
|
||||||
string ralId = CreateRoomsAddressList(runSpace, organizationId);
|
string ralId = CreateRoomsAddressList(runSpace, organizationId);
|
||||||
transaction.RegisterNewRoomsAddressList(ralId);
|
transaction.RegisterNewRoomsAddressList(ralId);
|
||||||
ExchangeLog.LogInfo(" Rooms Address List: {0}", ralId);
|
ExchangeLog.LogInfo(" Rooms Address List: {0}", ralId);
|
||||||
if (enableDefaultGroup)
|
UpdateAddressList(runSpace, ralId, securityGroupPath);
|
||||||
{
|
|
||||||
UpdateAddressList(runSpace, ralId, securityGroupPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
//create ActiveSync policy
|
//create ActiveSync policy
|
||||||
string asId = CreateActiveSyncPolicy(runSpace, organizationId);
|
string asId = CreateActiveSyncPolicy(runSpace, organizationId);
|
||||||
|
@ -898,13 +884,8 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
string oabId = CreateOfflineAddressBook(runSpace, organizationId, server, oabVirtualDir);
|
string oabId = CreateOfflineAddressBook(runSpace, organizationId, server, oabVirtualDir);
|
||||||
transaction.RegisterNewOfflineAddressBook(oabId);
|
transaction.RegisterNewOfflineAddressBook(oabId);
|
||||||
|
|
||||||
bool enableDefaultGroup = !string.IsNullOrEmpty(securityGroup);
|
string securityGroupId = AddADPrefix(securityGroup);
|
||||||
|
UpdateOfflineAddressBook(runSpace, oabId, securityGroupId);
|
||||||
if (enableDefaultGroup)
|
|
||||||
{
|
|
||||||
string securityGroupId = AddADPrefix(securityGroup);
|
|
||||||
UpdateOfflineAddressBook(runSpace, oabId, securityGroupId);
|
|
||||||
}
|
|
||||||
|
|
||||||
info.OfflineAddressBook = oabId;
|
info.OfflineAddressBook = oabId;
|
||||||
}
|
}
|
||||||
|
@ -1098,12 +1079,7 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
//disable mail security distribution group
|
//disable mail security distribution group
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bool enableDefaultGroup = !string.IsNullOrEmpty(securityGroup);
|
DisableMailSecurityDistributionGroup(runSpace, securityGroup);
|
||||||
|
|
||||||
if (enableDefaultGroup)
|
|
||||||
{
|
|
||||||
DisableMailSecurityDistributionGroup(runSpace, securityGroup);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -4361,12 +4337,7 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
string id = AddPublicFolder(runSpace, folderName, parentFolder, orgCanonicalName+"/"+GetPublicFolderMailboxName(organizationId));
|
string id = AddPublicFolder(runSpace, folderName, parentFolder, orgCanonicalName+"/"+GetPublicFolderMailboxName(organizationId));
|
||||||
transaction.RegisterNewPublicFolder(GetPublicFolderMailboxName(organizationId), id);
|
transaction.RegisterNewPublicFolder(GetPublicFolderMailboxName(organizationId), id);
|
||||||
|
|
||||||
bool enableDefaultGroup = !string.IsNullOrEmpty(securityGroup);
|
SetPublicFolderPermissions(runSpace, id, securityGroup);
|
||||||
|
|
||||||
if (enableDefaultGroup)
|
|
||||||
{
|
|
||||||
SetPublicFolderPermissions(runSpace, id, securityGroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mailEnabled)
|
if (mailEnabled)
|
||||||
{
|
{
|
||||||
|
|
|
@ -718,42 +718,28 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
string server = GetServerName();
|
string server = GetServerName();
|
||||||
string securityGroupPath = AddADPrefix(securityGroup);
|
string securityGroupPath = AddADPrefix(securityGroup);
|
||||||
|
|
||||||
bool enableDefaultGroup = !string.IsNullOrEmpty(securityGroup);
|
//Create mail enabled organization security group
|
||||||
|
EnableMailSecurityDistributionGroup(runSpace, securityGroup, organizationId);
|
||||||
if (enableDefaultGroup)
|
transaction.RegisterMailEnabledDistributionGroup(securityGroup);
|
||||||
{
|
UpdateSecurityDistributionGroup(runSpace, securityGroup, organizationId, IsConsumer);
|
||||||
//Create mail enabled organization security group
|
|
||||||
EnableMailSecurityDistributionGroup(runSpace, securityGroup, organizationId);
|
|
||||||
transaction.RegisterMailEnabledDistributionGroup(securityGroup);
|
|
||||||
UpdateSecurityDistributionGroup(runSpace, securityGroup, organizationId, IsConsumer);
|
|
||||||
}
|
|
||||||
|
|
||||||
//create GAL
|
//create GAL
|
||||||
string galId = CreateGlobalAddressList(runSpace, organizationId);
|
string galId = CreateGlobalAddressList(runSpace, organizationId);
|
||||||
transaction.RegisterNewGlobalAddressList(galId);
|
transaction.RegisterNewGlobalAddressList(galId);
|
||||||
ExchangeLog.LogInfo(" Global Address List: {0}", galId);
|
ExchangeLog.LogInfo(" Global Address List: {0}", galId);
|
||||||
if (enableDefaultGroup)
|
UpdateGlobalAddressList(runSpace, galId, securityGroupPath);
|
||||||
{
|
|
||||||
UpdateGlobalAddressList(runSpace, galId, securityGroupPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
//create AL
|
//create AL
|
||||||
string alId = CreateAddressList(runSpace, organizationId);
|
string alId = CreateAddressList(runSpace, organizationId);
|
||||||
transaction.RegisterNewAddressList(alId);
|
transaction.RegisterNewAddressList(alId);
|
||||||
ExchangeLog.LogInfo(" Address List: {0}", alId);
|
ExchangeLog.LogInfo(" Address List: {0}", alId);
|
||||||
if (enableDefaultGroup)
|
UpdateAddressList(runSpace, alId, securityGroupPath);
|
||||||
{
|
|
||||||
UpdateAddressList(runSpace, alId, securityGroupPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
//create RAL
|
//create RAL
|
||||||
string ralId = CreateRoomsAddressList(runSpace, organizationId);
|
string ralId = CreateRoomsAddressList(runSpace, organizationId);
|
||||||
transaction.RegisterNewRoomsAddressList(ralId);
|
transaction.RegisterNewRoomsAddressList(ralId);
|
||||||
ExchangeLog.LogInfo(" Rooms Address List: {0}", ralId);
|
ExchangeLog.LogInfo(" Rooms Address List: {0}", ralId);
|
||||||
if (enableDefaultGroup)
|
UpdateAddressList(runSpace, ralId, securityGroupPath);
|
||||||
{
|
|
||||||
UpdateAddressList(runSpace, ralId, securityGroupPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
//create ActiveSync policy
|
//create ActiveSync policy
|
||||||
string asId = CreateActiveSyncPolicy(runSpace, organizationId);
|
string asId = CreateActiveSyncPolicy(runSpace, organizationId);
|
||||||
|
@ -855,13 +841,8 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
string oabId = CreateOfflineAddressBook(runSpace, organizationId, server, oabVirtualDir);
|
string oabId = CreateOfflineAddressBook(runSpace, organizationId, server, oabVirtualDir);
|
||||||
transaction.RegisterNewOfflineAddressBook(oabId);
|
transaction.RegisterNewOfflineAddressBook(oabId);
|
||||||
|
|
||||||
bool enableDefaultGroup = !string.IsNullOrEmpty(securityGroup);
|
string securityGroupId = AddADPrefix(securityGroup);
|
||||||
|
UpdateOfflineAddressBook(runSpace, oabId, securityGroupId);
|
||||||
if (enableDefaultGroup)
|
|
||||||
{
|
|
||||||
string securityGroupId = AddADPrefix(securityGroup);
|
|
||||||
UpdateOfflineAddressBook(runSpace, oabId, securityGroupId);
|
|
||||||
}
|
|
||||||
|
|
||||||
info.OfflineAddressBook = oabId;
|
info.OfflineAddressBook = oabId;
|
||||||
}
|
}
|
||||||
|
@ -1016,12 +997,7 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
//disable mail security distribution group
|
//disable mail security distribution group
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bool enableDefaultGroup = !string.IsNullOrEmpty(securityGroup);
|
DisableMailSecurityDistributionGroup(runSpace, securityGroup);
|
||||||
|
|
||||||
if (enableDefaultGroup)
|
|
||||||
{
|
|
||||||
DisableMailSecurityDistributionGroup(runSpace, securityGroup);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -4111,12 +4087,7 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
string id = AddPublicFolder(runSpace, folderName, parentFolder);
|
string id = AddPublicFolder(runSpace, folderName, parentFolder);
|
||||||
transaction.RegisterNewPublicFolder(string.Empty, id);
|
transaction.RegisterNewPublicFolder(string.Empty, id);
|
||||||
|
|
||||||
bool enableDefaultGroup = !string.IsNullOrEmpty(securityGroup);
|
SetPublicFolderPermissions(runSpace, id, securityGroup);
|
||||||
|
|
||||||
if (enableDefaultGroup)
|
|
||||||
{
|
|
||||||
SetPublicFolderPermissions(runSpace, id, securityGroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mailEnabled)
|
if (mailEnabled)
|
||||||
{
|
{
|
||||||
|
|
|
@ -92,42 +92,28 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
string server = GetServerName();
|
string server = GetServerName();
|
||||||
string securityGroupPath = AddADPrefix(securityGroup);
|
string securityGroupPath = AddADPrefix(securityGroup);
|
||||||
|
|
||||||
bool enableDefaultGroup = !string.IsNullOrEmpty(securityGroup);
|
//Create mail enabled organization security group
|
||||||
|
EnableMailSecurityDistributionGroup(runSpace, securityGroup, organizationId);
|
||||||
if (enableDefaultGroup)
|
transaction.RegisterMailEnabledDistributionGroup(securityGroup);
|
||||||
{
|
UpdateSecurityDistributionGroup(runSpace, securityGroup, organizationId, IsConsumer);
|
||||||
//Create mail enabled organization security group
|
|
||||||
EnableMailSecurityDistributionGroup(runSpace, securityGroup, organizationId);
|
|
||||||
transaction.RegisterMailEnabledDistributionGroup(securityGroup);
|
|
||||||
UpdateSecurityDistributionGroup(runSpace, securityGroup, organizationId, IsConsumer);
|
|
||||||
}
|
|
||||||
|
|
||||||
//create GAL
|
//create GAL
|
||||||
string galId = CreateGlobalAddressList(runSpace, organizationId);
|
string galId = CreateGlobalAddressList(runSpace, organizationId);
|
||||||
transaction.RegisterNewGlobalAddressList(galId);
|
transaction.RegisterNewGlobalAddressList(galId);
|
||||||
ExchangeLog.LogInfo(" Global Address List: {0}", galId);
|
ExchangeLog.LogInfo(" Global Address List: {0}", galId);
|
||||||
if (enableDefaultGroup)
|
UpdateGlobalAddressList(runSpace, galId, securityGroupPath);
|
||||||
{
|
|
||||||
UpdateGlobalAddressList(runSpace, galId, securityGroupPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
//create AL
|
//create AL
|
||||||
string alId = CreateAddressList(runSpace, organizationId);
|
string alId = CreateAddressList(runSpace, organizationId);
|
||||||
transaction.RegisterNewAddressList(alId);
|
transaction.RegisterNewAddressList(alId);
|
||||||
ExchangeLog.LogInfo(" Address List: {0}", alId);
|
ExchangeLog.LogInfo(" Address List: {0}", alId);
|
||||||
if (enableDefaultGroup)
|
UpdateAddressList(runSpace, alId, securityGroupPath);
|
||||||
{
|
|
||||||
UpdateAddressList(runSpace, alId, securityGroupPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
//create RAL
|
//create RAL
|
||||||
string ralId = CreateRoomsAddressList(runSpace, organizationId);
|
string ralId = CreateRoomsAddressList(runSpace, organizationId);
|
||||||
transaction.RegisterNewRoomsAddressList(ralId);
|
transaction.RegisterNewRoomsAddressList(ralId);
|
||||||
ExchangeLog.LogInfo(" Rooms Address List: {0}", ralId);
|
ExchangeLog.LogInfo(" Rooms Address List: {0}", ralId);
|
||||||
if (enableDefaultGroup)
|
UpdateAddressList(runSpace, ralId, securityGroupPath);
|
||||||
{
|
|
||||||
UpdateAddressList(runSpace, ralId, securityGroupPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
//create ActiveSync policy
|
//create ActiveSync policy
|
||||||
string asId = CreateActiveSyncPolicy(runSpace, organizationId);
|
string asId = CreateActiveSyncPolicy(runSpace, organizationId);
|
||||||
|
@ -297,12 +283,7 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
//disable mail security distribution group
|
//disable mail security distribution group
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bool enableDefaultGroup = !string.IsNullOrEmpty(securityGroup);
|
DisableMailSecurityDistributionGroup(runSpace, securityGroup);
|
||||||
|
|
||||||
if (enableDefaultGroup)
|
|
||||||
{
|
|
||||||
DisableMailSecurityDistributionGroup(runSpace, securityGroup);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -206,12 +206,12 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
return ActiveDirectoryUtils.AdObjectExists(orgPath);
|
return ActiveDirectoryUtils.AdObjectExists(orgPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Organization CreateOrganization(string organizationId, bool enableDefaultGroup)
|
public Organization CreateOrganization(string organizationId)
|
||||||
{
|
{
|
||||||
return CreateOrganizationInternal(organizationId, enableDefaultGroup);
|
return CreateOrganizationInternal(organizationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Organization CreateOrganizationInternal(string organizationId, bool enableDefaultGroup)
|
internal Organization CreateOrganizationInternal(string organizationId)
|
||||||
{
|
{
|
||||||
HostedSolutionLog.LogStart("CreateOrganizationInternal");
|
HostedSolutionLog.LogStart("CreateOrganizationInternal");
|
||||||
HostedSolutionLog.DebugInfo("OrganizationId : {0}", organizationId);
|
HostedSolutionLog.DebugInfo("OrganizationId : {0}", organizationId);
|
||||||
|
@ -232,19 +232,14 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
ActiveDirectoryUtils.CreateOrganizationalUnit(organizationId, parentPath);
|
ActiveDirectoryUtils.CreateOrganizationalUnit(organizationId, parentPath);
|
||||||
ouCreated = true;
|
ouCreated = true;
|
||||||
|
|
||||||
if (enableDefaultGroup)
|
//Create security group
|
||||||
{
|
ActiveDirectoryUtils.CreateGroup(orgPath, organizationId);
|
||||||
//Create security group
|
groupCreated = true;
|
||||||
ActiveDirectoryUtils.CreateGroup(orgPath, organizationId);
|
|
||||||
groupCreated = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
org = new Organization();
|
org = new Organization();
|
||||||
org.OrganizationId = organizationId;
|
org.OrganizationId = organizationId;
|
||||||
org.DistinguishedName = ActiveDirectoryUtils.RemoveADPrefix(orgPath);
|
org.DistinguishedName = ActiveDirectoryUtils.RemoveADPrefix(orgPath);
|
||||||
org.SecurityGroup = enableDefaultGroup
|
org.SecurityGroup = ActiveDirectoryUtils.RemoveADPrefix(GetGroupPath(organizationId));
|
||||||
? ActiveDirectoryUtils.RemoveADPrefix(GetGroupPath(organizationId))
|
|
||||||
: "";
|
|
||||||
|
|
||||||
org.GroupName = organizationId;
|
org.GroupName = organizationId;
|
||||||
}
|
}
|
||||||
|
@ -378,12 +373,12 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
|
|
||||||
#region Users
|
#region Users
|
||||||
|
|
||||||
public int CreateUser(string organizationId, string loginName, string displayName, string upn, string password, bool enabled, bool enableDefaultGroup)
|
public int CreateUser(string organizationId, string loginName, string displayName, string upn, string password, bool enabled)
|
||||||
{
|
{
|
||||||
return CreateUserInternal(organizationId, loginName, displayName, upn, password, enabled, enableDefaultGroup);
|
return CreateUserInternal(organizationId, loginName, displayName, upn, password, enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal int CreateUserInternal(string organizationId, string loginName, string displayName, string upn, string password, bool enabled, bool enableDefaultGroup)
|
internal int CreateUserInternal(string organizationId, string loginName, string displayName, string upn, string password, bool enabled)
|
||||||
{
|
{
|
||||||
HostedSolutionLog.LogStart("CreateUserInternal");
|
HostedSolutionLog.LogStart("CreateUserInternal");
|
||||||
HostedSolutionLog.DebugInfo("organizationId : {0}", organizationId);
|
HostedSolutionLog.DebugInfo("organizationId : {0}", organizationId);
|
||||||
|
@ -421,14 +416,11 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
return Errors.AD_OBJECT_ALREADY_EXISTS;
|
return Errors.AD_OBJECT_ALREADY_EXISTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enableDefaultGroup)
|
string groupPath = GetGroupPath(organizationId);
|
||||||
{
|
HostedSolutionLog.DebugInfo("Group retrieved: {0}", groupPath);
|
||||||
string groupPath = GetGroupPath(organizationId);
|
|
||||||
HostedSolutionLog.DebugInfo("Group retrieved: {0}", groupPath);
|
|
||||||
|
|
||||||
ActiveDirectoryUtils.AddObjectToGroup(userPath, groupPath);
|
ActiveDirectoryUtils.AddObjectToGroup(userPath, groupPath);
|
||||||
HostedSolutionLog.DebugInfo("Added to group: {0}", groupPath);
|
HostedSolutionLog.DebugInfo("Added to group: {0}", groupPath);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -224,20 +224,18 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
|
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
|
||||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/CreateOrganization", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/CreateOrganization", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||||
public Organization CreateOrganization(string organizationId, bool enableDefaultGroup)
|
public Organization CreateOrganization(string organizationId)
|
||||||
{
|
{
|
||||||
object[] results = this.Invoke("CreateOrganization", new object[] {
|
object[] results = this.Invoke("CreateOrganization", new object[] {
|
||||||
organizationId,
|
organizationId});
|
||||||
enableDefaultGroup});
|
|
||||||
return ((Organization)(results[0]));
|
return ((Organization)(results[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
public System.IAsyncResult BeginCreateOrganization(string organizationId, bool enableDefaultGroup, System.AsyncCallback callback, object asyncState)
|
public System.IAsyncResult BeginCreateOrganization(string organizationId, System.AsyncCallback callback, object asyncState)
|
||||||
{
|
{
|
||||||
return this.BeginInvoke("CreateOrganization", new object[] {
|
return this.BeginInvoke("CreateOrganization", new object[] {
|
||||||
organizationId,
|
organizationId}, callback, asyncState);
|
||||||
enableDefaultGroup}, callback, asyncState);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
|
@ -248,21 +246,20 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
public void CreateOrganizationAsync(string organizationId, bool enableDefaultGroup)
|
public void CreateOrganizationAsync(string organizationId)
|
||||||
{
|
{
|
||||||
this.CreateOrganizationAsync(organizationId, enableDefaultGroup, null);
|
this.CreateOrganizationAsync(organizationId, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
public void CreateOrganizationAsync(string organizationId, bool enableDefaultGroup, object userState)
|
public void CreateOrganizationAsync(string organizationId, object userState)
|
||||||
{
|
{
|
||||||
if ((this.CreateOrganizationOperationCompleted == null))
|
if ((this.CreateOrganizationOperationCompleted == null))
|
||||||
{
|
{
|
||||||
this.CreateOrganizationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateOrganizationOperationCompleted);
|
this.CreateOrganizationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateOrganizationOperationCompleted);
|
||||||
}
|
}
|
||||||
this.InvokeAsync("CreateOrganization", new object[] {
|
this.InvokeAsync("CreateOrganization", new object[] {
|
||||||
organizationId,
|
organizationId}, this.CreateOrganizationOperationCompleted, userState);
|
||||||
enableDefaultGroup}, this.CreateOrganizationOperationCompleted, userState);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnCreateOrganizationOperationCompleted(object arg)
|
private void OnCreateOrganizationOperationCompleted(object arg)
|
||||||
|
@ -325,7 +322,7 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
|
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
|
||||||
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/CreateUser", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/CreateUser", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
|
||||||
public int CreateUser(string organizationId, string loginName, string displayName, string upn, string password, bool enabled, bool enableDefaultGroup)
|
public int CreateUser(string organizationId, string loginName, string displayName, string upn, string password, bool enabled)
|
||||||
{
|
{
|
||||||
object[] results = this.Invoke("CreateUser", new object[] {
|
object[] results = this.Invoke("CreateUser", new object[] {
|
||||||
organizationId,
|
organizationId,
|
||||||
|
@ -333,13 +330,12 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
displayName,
|
displayName,
|
||||||
upn,
|
upn,
|
||||||
password,
|
password,
|
||||||
enabled,
|
enabled});
|
||||||
enableDefaultGroup});
|
|
||||||
return ((int)(results[0]));
|
return ((int)(results[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
public System.IAsyncResult BeginCreateUser(string organizationId, string loginName, string displayName, string upn, string password, bool enabled, bool enableDefaultGroup, System.AsyncCallback callback, object asyncState)
|
public System.IAsyncResult BeginCreateUser(string organizationId, string loginName, string displayName, string upn, string password, bool enabled, System.AsyncCallback callback, object asyncState)
|
||||||
{
|
{
|
||||||
return this.BeginInvoke("CreateUser", new object[] {
|
return this.BeginInvoke("CreateUser", new object[] {
|
||||||
organizationId,
|
organizationId,
|
||||||
|
@ -347,8 +343,7 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
displayName,
|
displayName,
|
||||||
upn,
|
upn,
|
||||||
password,
|
password,
|
||||||
enabled,
|
enabled}, callback, asyncState);
|
||||||
enableDefaultGroup}, callback, asyncState);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
|
@ -359,13 +354,13 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
public void CreateUserAsync(string organizationId, string loginName, string displayName, string upn, string password, bool enabled, bool enableDefaultGroup)
|
public void CreateUserAsync(string organizationId, string loginName, string displayName, string upn, string password, bool enabled)
|
||||||
{
|
{
|
||||||
this.CreateUserAsync(organizationId, loginName, displayName, upn, password, enabled, enableDefaultGroup, null);
|
this.CreateUserAsync(organizationId, loginName, displayName, upn, password, enabled, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <remarks/>
|
/// <remarks/>
|
||||||
public void CreateUserAsync(string organizationId, string loginName, string displayName, string upn, string password, bool enabled, bool enableDefaultGroup, object userState)
|
public void CreateUserAsync(string organizationId, string loginName, string displayName, string upn, string password, bool enabled, object userState)
|
||||||
{
|
{
|
||||||
if ((this.CreateUserOperationCompleted == null))
|
if ((this.CreateUserOperationCompleted == null))
|
||||||
{
|
{
|
||||||
|
@ -377,8 +372,7 @@ namespace WebsitePanel.Providers.HostedSolution
|
||||||
displayName,
|
displayName,
|
||||||
upn,
|
upn,
|
||||||
password,
|
password,
|
||||||
enabled,
|
enabled}, this.CreateUserOperationCompleted, userState);
|
||||||
enableDefaultGroup}, this.CreateUserOperationCompleted, userState);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnCreateUserOperationCompleted(object arg)
|
private void OnCreateUserOperationCompleted(object arg)
|
||||||
|
|
|
@ -70,12 +70,12 @@ namespace WebsitePanel.Server
|
||||||
|
|
||||||
|
|
||||||
[WebMethod, SoapHeader("settings")]
|
[WebMethod, SoapHeader("settings")]
|
||||||
public Organization CreateOrganization(string organizationId, bool enableDefaultGroup)
|
public Organization CreateOrganization(string organizationId)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Log.WriteStart("'{0}' CreateOrganization", ProviderSettings.ProviderName);
|
Log.WriteStart("'{0}' CreateOrganization", ProviderSettings.ProviderName);
|
||||||
Organization ret = Organization.CreateOrganization(organizationId, enableDefaultGroup);
|
Organization ret = Organization.CreateOrganization(organizationId);
|
||||||
Log.WriteEnd("'{0}' CreateOrganization", ProviderSettings.ProviderName);
|
Log.WriteEnd("'{0}' CreateOrganization", ProviderSettings.ProviderName);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -93,9 +93,9 @@ namespace WebsitePanel.Server
|
||||||
}
|
}
|
||||||
|
|
||||||
[WebMethod, SoapHeader("settings")]
|
[WebMethod, SoapHeader("settings")]
|
||||||
public int CreateUser(string organizationId, string loginName, string displayName, string upn, string password, bool enabled, bool enableDefaultGroup)
|
public int CreateUser(string organizationId, string loginName, string displayName, string upn, string password, bool enabled)
|
||||||
{
|
{
|
||||||
return Organization.CreateUser(organizationId, loginName, displayName, upn, password, enabled, enableDefaultGroup);
|
return Organization.CreateUser(organizationId, loginName, displayName, upn, password, enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
[WebMethod, SoapHeader("settings")]
|
[WebMethod, SoapHeader("settings")]
|
||||||
|
|
|
@ -112,10 +112,10 @@
|
||||||
<value>2.0</value>
|
<value>2.0</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<resheader name="reader">
|
<resheader name="reader">
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="secMailboxPassword.Text" xml:space="preserve">
|
<data name="secMailboxPassword.Text" xml:space="preserve">
|
||||||
<value>User Password Policy</value>
|
<value>User Password Policy</value>
|
||||||
|
@ -124,6 +124,6 @@
|
||||||
<value>Organization Id Policy</value>
|
<value>Organization Id Policy</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="threeOrg.Text" xml:space="preserve">
|
<data name="threeOrg.Text" xml:space="preserve">
|
||||||
<value>Organization Policy</value>
|
<value>Additional Default Security Groups</value>
|
||||||
</data>
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -32,7 +32,7 @@
|
||||||
</table>
|
</table>
|
||||||
</asp:Panel>
|
</asp:Panel>
|
||||||
|
|
||||||
<wsp:CollapsiblePanel id="threeOrg" runat="server" TargetControlID="OrgPanel" meta:resourcekey="threeOrg" Text="Organization Policy"/>
|
<wsp:CollapsiblePanel id="threeOrg" runat="server" TargetControlID="OrgPanel" meta:resourcekey="threeOrg" Text="Additional Default Security Groups"/>
|
||||||
<asp:Panel ID="OrgPanel" runat="server" Height="0" style="overflow:hidden;">
|
<asp:Panel ID="OrgPanel" runat="server" Height="0" style="overflow:hidden;">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -26,12 +26,17 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
|
using System.Collections.Generic;
|
||||||
using WebsitePanel.EnterpriseServer;
|
using WebsitePanel.EnterpriseServer;
|
||||||
|
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
|
||||||
|
|
||||||
namespace WebsitePanel.Portal
|
namespace WebsitePanel.Portal
|
||||||
{
|
{
|
||||||
public partial class SettingsExchangePolicy : WebsitePanelControlBase, IUserSettingsEditorControl
|
public partial class SettingsExchangePolicy : WebsitePanelControlBase, IUserSettingsEditorControl
|
||||||
{
|
{
|
||||||
|
internal static AdditionalGroup[] additionalGroups;
|
||||||
|
|
||||||
#region IUserSettingsEditorControl Members
|
#region IUserSettingsEditorControl Members
|
||||||
|
|
||||||
public void BindSettings(UserSettings settings)
|
public void BindSettings(UserSettings settings)
|
||||||
|
@ -39,6 +44,10 @@ namespace WebsitePanel.Portal
|
||||||
// mailbox
|
// mailbox
|
||||||
mailboxPasswordPolicy.Value = settings["MailboxPasswordPolicy"];
|
mailboxPasswordPolicy.Value = settings["MailboxPasswordPolicy"];
|
||||||
orgIdPolicy.Value = settings["OrgIdPolicy"];
|
orgIdPolicy.Value = settings["OrgIdPolicy"];
|
||||||
|
|
||||||
|
additionalGroups = ES.Services.Organizations.GetAdditionalGroups(settings.UserId);
|
||||||
|
|
||||||
|
orgPolicy.SetAdditionalGroups(additionalGroups);
|
||||||
orgPolicy.Value = settings["OrgPolicy"];
|
orgPolicy.Value = settings["OrgPolicy"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +56,32 @@ namespace WebsitePanel.Portal
|
||||||
settings["MailboxPasswordPolicy"] = mailboxPasswordPolicy.Value;
|
settings["MailboxPasswordPolicy"] = mailboxPasswordPolicy.Value;
|
||||||
settings["OrgIdPolicy"] = orgIdPolicy.Value;
|
settings["OrgIdPolicy"] = orgIdPolicy.Value;
|
||||||
settings["OrgPolicy"] = orgPolicy.Value;
|
settings["OrgPolicy"] = orgPolicy.Value;
|
||||||
|
|
||||||
|
if (Utils.ParseBool(orgPolicy.Value, false))
|
||||||
|
{
|
||||||
|
List<AdditionalGroup> newAdditionalGroups = orgPolicy.GetGridViewGroups();
|
||||||
|
|
||||||
|
foreach (AdditionalGroup oldGroup in additionalGroups)
|
||||||
|
{
|
||||||
|
AdditionalGroup upGroup = newAdditionalGroups.Where(x => x.GroupId == oldGroup.GroupId).FirstOrDefault();
|
||||||
|
|
||||||
|
if(upGroup != null && upGroup.GroupName != oldGroup.GroupName)
|
||||||
|
{
|
||||||
|
ES.Services.Organizations.UpdateAdditionalGroup(oldGroup.GroupId, upGroup.GroupName);
|
||||||
|
|
||||||
|
newAdditionalGroups.Remove(upGroup);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ES.Services.Organizations.DeleteAdditionalGroup(oldGroup.GroupId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (AdditionalGroup newGroup in newAdditionalGroups)
|
||||||
|
{
|
||||||
|
ES.Services.Organizations.AddAdditionalGroup(settings.UserId, newGroup.GroupName);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -1,31 +1,3 @@
|
||||||
// Copyright (c) 2012, Outercurve Foundation.
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
// are permitted provided that the following conditions are met:
|
|
||||||
//
|
|
||||||
// - Redistributions of source code must retain the above copyright notice, this
|
|
||||||
// list of conditions and the following disclaimer.
|
|
||||||
//
|
|
||||||
// - Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
|
||||||
// and/or other materials provided with the distribution.
|
|
||||||
//
|
|
||||||
// - Neither the name of the Outercurve Foundation nor the names of its
|
|
||||||
// contributors may be used to endorse or promote products derived from this
|
|
||||||
// software without specific prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
||||||
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
||||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// This code was generated by a tool.
|
||||||
|
|
|
@ -117,7 +117,31 @@
|
||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<data name="enablePolicyCheckBox.Text" xml:space="preserve">
|
<data name="btnAddAdditionalGroup.Text" xml:space="preserve">
|
||||||
|
<value>Add New Group</value>
|
||||||
|
</data>
|
||||||
|
<data name="btnUpdateAdditionalGroup.Text" xml:space="preserve">
|
||||||
|
<value>Update Group</value>
|
||||||
|
</data>
|
||||||
|
<data name="chkEnablePolicy.Text" xml:space="preserve">
|
||||||
<value>Enable Policy</value>
|
<value>Enable Policy</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="gvAdditionalGroup.HeaderText" xml:space="preserve">
|
||||||
|
<value>Display Name</value>
|
||||||
|
</data>
|
||||||
|
<data name="gvAdditionalGroupEdit.HeaderText" xml:space="preserve">
|
||||||
|
<value>Select</value>
|
||||||
|
</data>
|
||||||
|
<data name="gvAdditionalGroups.EmptyDataText" xml:space="preserve">
|
||||||
|
<value>No groups have been added yet. To add a new group click "Add New Group" button.</value>
|
||||||
|
</data>
|
||||||
|
<data name="lblAdditionalGroupName.Text" xml:space="preserve">
|
||||||
|
<value>Display Name:</value>
|
||||||
|
</data>
|
||||||
|
<data name="valDuplicateAdditionalGroup" xml:space="preserve">
|
||||||
|
<value>*</value>
|
||||||
|
</data>
|
||||||
|
<data name="valRequireAdditionalGroup.Text" xml:space="preserve">
|
||||||
|
<value>*</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -1,14 +1,59 @@
|
||||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OrgPolicyEditor.ascx.cs" Inherits="WebsitePanel.Portal.UserControls.OrgPolicyEditor" %>
|
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OrgPolicyEditor.ascx.cs" Inherits="WebsitePanel.Portal.UserControls.OrgPolicyEditor" %>
|
||||||
|
|
||||||
<asp:UpdatePanel runat="server" ID="OrgPolicyPanel" UpdateMode="Conditional" ChildrenAsTriggers="true">
|
<asp:UpdatePanel runat="server" ID="OrgPolicyPanel" UpdateMode="Conditional" ChildrenAsTriggers="true">
|
||||||
<ContentTemplate>
|
<ContentTemplate>
|
||||||
<asp:CheckBox id="enablePolicyCheckBox" runat="server" meta:resourcekey="enablePolicyCheckBox" Text="Enable Policy" CssClass="NormalBold" AutoPostBack="true" OnCheckedChanged="EnablePolicy_CheckedChanged"/>
|
<asp:CheckBox id="chkEnablePolicy" runat="server" meta:resourcekey="chkEnablePolicy" Text="Enable Policy"
|
||||||
<table id="PolicyTable" runat="server" cellpadding="2">
|
CssClass="NormalBold" AutoPostBack="true" OnCheckedChanged="chkEnablePolicy_CheckedChanged"/>
|
||||||
|
<table id="PolicyBlock" runat="server" style="width:500px;">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="Normal" style="width:150px;">
|
<td colspan="2" style="padding-top: 10px;">
|
||||||
<asp:Label ID="lblEnableDefaultGroups" runat="server" meta:resourcekey="lblEnableDefaultGroups" Text="Enable Default Groups:"/>
|
<asp:GridView id="gvAdditionalGroups" runat="server" EnableViewState="true" AutoGenerateColumns="false"
|
||||||
|
Width="100%" meta:resourcekey="gvAdditionalGroups" CssSelectorClass="NormalGridView" OnRowCommand="gvAdditionalGroup_RowCommand" DataKeyNames="GroupId">
|
||||||
|
<Columns>
|
||||||
|
<asp:TemplateField meta:resourcekey="gvAdditionalGroupEdit" HeaderText="gvAdditionalGroupEdit">
|
||||||
|
<ItemTemplate>
|
||||||
|
<asp:ImageButton ID="cmdEdit" runat="server" SkinID="EditSmall" CommandName="EditItem" AlternateText="Edit record" CommandArgument='<%# Eval("GroupId") %>' ></asp:ImageButton>
|
||||||
|
</ItemTemplate>
|
||||||
|
</asp:TemplateField>
|
||||||
|
<asp:TemplateField meta:resourcekey="gvAdditionalGroup" HeaderText="gvAdditionalGroup">
|
||||||
|
<ItemStyle Width="100%"></ItemStyle>
|
||||||
|
<ItemTemplate>
|
||||||
|
<asp:Literal id="litDisplayAdditionalGroup" runat="server" Text='<%# Eval("GroupName") %>'></asp:Literal>
|
||||||
|
</ItemTemplate>
|
||||||
|
</asp:TemplateField>
|
||||||
|
<asp:TemplateField>
|
||||||
|
<ItemStyle Width="30px" Wrap="false"></ItemStyle>
|
||||||
|
<ItemTemplate>
|
||||||
|
<asp:ImageButton id="imgDelAdditionalGroup" runat="server" Text="Delete" SkinID="ExchangeDelete"
|
||||||
|
CommandName="DeleteItem" CommandArgument='<%# Eval("GroupId") %>'
|
||||||
|
meta:resourcekey="cmdDelete" OnClientClick="return confirm('Are you sure you want to delete selected group?')"></asp:ImageButton>
|
||||||
|
</ItemTemplate>
|
||||||
|
</asp:TemplateField>
|
||||||
|
</Columns>
|
||||||
|
</asp:GridView>
|
||||||
</td>
|
</td>
|
||||||
<td class="Normal">
|
</tr>
|
||||||
<asp:CheckBox ID="chkEnableDefaultGroups" runat="server" CssClass="NormalTextBox" />
|
<tr>
|
||||||
|
<td class="Normal" style="width:150px; padding-top: 10px;">
|
||||||
|
<asp:Label ID="lblAdditionalGroupName" runat="server" meta:resourcekey="lblAdditionalGroupName" Text="Display Name:"/>
|
||||||
|
</td>
|
||||||
|
<td class="Normal" style="padding-top: 10px;">
|
||||||
|
<asp:TextBox ID="txtAdditionalGroup" runat="server" CssClass="NormalTextBox" Width="200"/>
|
||||||
|
<asp:RequiredFieldValidator ID="valRequireAdditionalGroup" runat="server" meta:resourcekey="valRequireAdditionalGroup" ControlToValidate="txtAdditionalGroup"
|
||||||
|
ErrorMessage="Enter Display Name" Display="Dynamic" Text="*" ValidationGroup="SettingsAdditionalGroupEditor" SetFocusOnError="True"></asp:RequiredFieldValidator>
|
||||||
|
<asp:CustomValidator ID="valDuplicateAdditionalGroup" runat="server" meta:resourcekey="valDuplicateAdditionalGroup" ControlToValidate="txtAdditionalGroup"
|
||||||
|
OnServerValidate="DuplicateName_Validation" ErrorMessage="Duplicate Display Name" ValidateEmptyText="false" Display="Dynamic" Text="*"
|
||||||
|
ValidationGroup="SettingsAdditionalGroupEditor" SetFocusOnError="True"></asp:CustomValidator>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" style="padding-top: 10px;">
|
||||||
|
<div class="FormButtonsBarClean">
|
||||||
|
<asp:Button ID="btnAddAdditionalGroup" runat="server" meta:resourcekey="btnAddAdditionalGroup"
|
||||||
|
Text="Add New Group" CssClass="Button1" OnClick="btnAddAdditionalGroup_Click" ValidationGroup="SettingsAdditionalGroupEditor" />
|
||||||
|
<asp:Button ID="btnUpdateAdditionalGroup" runat="server" meta:resourcekey="btnUpdateAdditionalGroup"
|
||||||
|
Text="Update Group" CssClass="Button1" OnClick="btnUpdateAdditionalGroup_Click" ValidationGroup="SettingsAdditionalGroupEditor" />
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -27,8 +27,12 @@
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Linq;
|
||||||
using System.Web.UI;
|
using System.Web.UI;
|
||||||
|
using System.Web.UI.WebControls;
|
||||||
|
using WebsitePanel.EnterpriseServer.Base.HostedSolution;
|
||||||
|
|
||||||
namespace WebsitePanel.Portal.UserControls
|
namespace WebsitePanel.Portal.UserControls
|
||||||
{
|
{
|
||||||
|
@ -40,30 +44,21 @@ namespace WebsitePanel.Portal.UserControls
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var sb = new StringBuilder();
|
return chkEnablePolicy.Checked.ToString();
|
||||||
sb.Append(enablePolicyCheckBox.Checked.ToString()).Append(";");
|
|
||||||
sb.Append(chkEnableDefaultGroups.Checked.ToString()).Append(";");
|
|
||||||
|
|
||||||
return sb.ToString();
|
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (String.IsNullOrEmpty(value))
|
if (String.IsNullOrEmpty(value))
|
||||||
{
|
{
|
||||||
enablePolicyCheckBox.Checked = true;
|
chkEnablePolicy.Checked = false;
|
||||||
chkEnableDefaultGroups.Checked = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string[] parts = value.Split(';');
|
chkEnablePolicy.Checked = Utils.ParseBool(value, true);
|
||||||
enablePolicyCheckBox.Checked = Utils.ParseBool(parts[0], true);
|
|
||||||
chkEnableDefaultGroups.Checked = Utils.ParseBool(parts[1], true);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
ToggleControls();
|
ToggleControls();
|
||||||
|
@ -74,24 +69,136 @@ namespace WebsitePanel.Portal.UserControls
|
||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
|
|
||||||
protected void Page_Load(object sender, EventArgs e)
|
public void SetAdditionalGroups(AdditionalGroup[] additionalGroups)
|
||||||
{
|
{
|
||||||
|
BindAdditionalGroups(additionalGroups);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ToggleControls()
|
public List<AdditionalGroup> GetGridViewGroups()
|
||||||
{
|
{
|
||||||
PolicyTable.Visible = enablePolicyCheckBox.Checked;
|
List<AdditionalGroup> additionalGroups = new List<AdditionalGroup>();
|
||||||
|
for (int i = 0; i < gvAdditionalGroups.Rows.Count; i++)
|
||||||
|
{
|
||||||
|
GridViewRow row = gvAdditionalGroups.Rows[i];
|
||||||
|
ImageButton cmdEdit = (ImageButton)row.FindControl("cmdEdit");
|
||||||
|
if (cmdEdit == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
AdditionalGroup group = new AdditionalGroup();
|
||||||
|
group.GroupId = (int)gvAdditionalGroups.DataKeys[i][0];
|
||||||
|
group.GroupName = ((Literal)row.FindControl("litDisplayAdditionalGroup")).Text;
|
||||||
|
|
||||||
|
additionalGroups.Add(group);
|
||||||
|
}
|
||||||
|
|
||||||
|
return additionalGroups;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void ToggleControls()
|
||||||
|
{
|
||||||
|
PolicyBlock.Visible = chkEnablePolicy.Checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void BindAdditionalGroups(AdditionalGroup[] additionalGroups)
|
||||||
|
{
|
||||||
|
gvAdditionalGroups.DataSource = additionalGroups;
|
||||||
|
gvAdditionalGroups.DataBind();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int GetRowIndexByDataKey(int dataKey)
|
||||||
|
{
|
||||||
|
int index = 0;
|
||||||
|
foreach (DataKey key in gvAdditionalGroups.DataKeys)
|
||||||
|
{
|
||||||
|
if (Utils.ParseInt(key.Value, 0) == dataKey)
|
||||||
|
break;
|
||||||
|
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return index >= gvAdditionalGroups.DataKeys.Count ? -1 : index;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Event Handlers
|
#region Event Handlers
|
||||||
|
|
||||||
protected void EnablePolicy_CheckedChanged(object sender, EventArgs e)
|
protected void chkEnablePolicy_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
ToggleControls();
|
ToggleControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void btnAddAdditionalGroup_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!Page.IsValid)
|
||||||
|
return;
|
||||||
|
|
||||||
|
List<AdditionalGroup> additionalGroups = GetGridViewGroups();
|
||||||
|
|
||||||
|
AdditionalGroup additionalGroup = new AdditionalGroup();
|
||||||
|
|
||||||
|
additionalGroup.GroupId = additionalGroups.Count != 0
|
||||||
|
? additionalGroups.Select(x => x.GroupId).Max() + 1
|
||||||
|
: 1;
|
||||||
|
|
||||||
|
additionalGroup.GroupName = txtAdditionalGroup.Text;
|
||||||
|
|
||||||
|
additionalGroups.Add(additionalGroup);
|
||||||
|
|
||||||
|
BindAdditionalGroups(additionalGroups.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void btnUpdateAdditionalGroup_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (ViewState["AdditionalGroupID"] == null || !Page.IsValid)
|
||||||
|
return;
|
||||||
|
|
||||||
|
List<AdditionalGroup> additionalGroups = GetGridViewGroups();
|
||||||
|
|
||||||
|
additionalGroups
|
||||||
|
.Where(x => x.GroupId == (int)ViewState["AdditionalGroupID"])
|
||||||
|
.First().GroupName = txtAdditionalGroup.Text;
|
||||||
|
|
||||||
|
BindAdditionalGroups(additionalGroups.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void gvAdditionalGroup_RowCommand(object sender, GridViewCommandEventArgs e)
|
||||||
|
{
|
||||||
|
int additionalGroupId = Utils.ParseInt(e.CommandArgument.ToString(), 0);
|
||||||
|
|
||||||
|
List<AdditionalGroup> additionalGroups = GetGridViewGroups();
|
||||||
|
|
||||||
|
int rowIndex = GetRowIndexByDataKey(additionalGroupId);
|
||||||
|
|
||||||
|
if (rowIndex != -1)
|
||||||
|
{
|
||||||
|
switch (e.CommandName)
|
||||||
|
{
|
||||||
|
case "DeleteItem":
|
||||||
|
BindAdditionalGroups(
|
||||||
|
additionalGroups
|
||||||
|
.Where(x => x.GroupId != additionalGroupId).ToArray());
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "EditItem":
|
||||||
|
ViewState["AdditionalGroupID"] = additionalGroupId;
|
||||||
|
|
||||||
|
txtAdditionalGroup.Text = additionalGroups
|
||||||
|
.Where(x => x.GroupId == additionalGroupId)
|
||||||
|
.Select(y => y.GroupName).First();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void DuplicateName_Validation(object source, ServerValidateEventArgs arguments)
|
||||||
|
{
|
||||||
|
List<AdditionalGroup> additionalGroups = GetGridViewGroups();
|
||||||
|
|
||||||
|
arguments.IsValid = (additionalGroups.Where(x => x.GroupName.Trim() == arguments.Value).Count() == 0);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,32 +1,4 @@
|
||||||
// Copyright (c) 2012, Outercurve Foundation.
|
//------------------------------------------------------------------------------
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without modification,
|
|
||||||
// are permitted provided that the following conditions are met:
|
|
||||||
//
|
|
||||||
// - Redistributions of source code must retain the above copyright notice, this
|
|
||||||
// list of conditions and the following disclaimer.
|
|
||||||
//
|
|
||||||
// - Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
|
||||||
// and/or other materials provided with the distribution.
|
|
||||||
//
|
|
||||||
// - Neither the name of the Outercurve Foundation nor the names of its
|
|
||||||
// contributors may be used to endorse or promote products derived from this
|
|
||||||
// software without specific prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
||||||
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
||||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated by a tool.
|
// This code was generated by a tool.
|
||||||
//
|
//
|
||||||
|
@ -50,39 +22,84 @@ namespace WebsitePanel.Portal.UserControls {
|
||||||
protected global::System.Web.UI.UpdatePanel OrgPolicyPanel;
|
protected global::System.Web.UI.UpdatePanel OrgPolicyPanel;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// enablePolicyCheckBox control.
|
/// chkEnablePolicy control.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Auto-generated field.
|
/// Auto-generated field.
|
||||||
/// To modify move field declaration from designer file to code-behind file.
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
protected global::System.Web.UI.WebControls.CheckBox enablePolicyCheckBox;
|
protected global::System.Web.UI.WebControls.CheckBox chkEnablePolicy;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// PolicyTable control.
|
/// PolicyBlock control.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Auto-generated field.
|
/// Auto-generated field.
|
||||||
/// To modify move field declaration from designer file to code-behind file.
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
protected global::System.Web.UI.HtmlControls.HtmlTable PolicyTable;
|
protected global::System.Web.UI.HtmlControls.HtmlTable PolicyBlock;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// lblEnableDefaultGroups control.
|
/// gvAdditionalGroups control.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Auto-generated field.
|
/// Auto-generated field.
|
||||||
/// To modify move field declaration from designer file to code-behind file.
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
protected global::System.Web.UI.WebControls.Label lblEnableDefaultGroups;
|
protected global::System.Web.UI.WebControls.GridView gvAdditionalGroups;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// chkEnableDefaultGroups control.
|
/// lblAdditionalGroupName control.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Auto-generated field.
|
/// Auto-generated field.
|
||||||
/// To modify move field declaration from designer file to code-behind file.
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
protected global::System.Web.UI.WebControls.CheckBox chkEnableDefaultGroups;
|
protected global::System.Web.UI.WebControls.Label lblAdditionalGroupName;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// txtAdditionalGroup control.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Auto-generated field.
|
||||||
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
|
/// </remarks>
|
||||||
|
protected global::System.Web.UI.WebControls.TextBox txtAdditionalGroup;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// valRequireAdditionalGroup control.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Auto-generated field.
|
||||||
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
|
/// </remarks>
|
||||||
|
protected global::System.Web.UI.WebControls.RequiredFieldValidator valRequireAdditionalGroup;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// valDuplicateAdditionalGroup control.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Auto-generated field.
|
||||||
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
|
/// </remarks>
|
||||||
|
protected global::System.Web.UI.WebControls.CustomValidator valDuplicateAdditionalGroup;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// btnAddAdditionalGroup control.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Auto-generated field.
|
||||||
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
|
/// </remarks>
|
||||||
|
protected global::System.Web.UI.WebControls.Button btnAddAdditionalGroup;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// btnUpdateAdditionalGroup control.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Auto-generated field.
|
||||||
|
/// To modify move field declaration from designer file to code-behind file.
|
||||||
|
/// </remarks>
|
||||||
|
protected global::System.Web.UI.WebControls.Button btnUpdateAdditionalGroup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue