merge commit

This commit is contained in:
robvde 2013-08-24 09:22:00 +04:00
commit e00be20ab0
46 changed files with 5521 additions and 825 deletions

View file

@ -1637,6 +1637,13 @@ IF NOT EXISTS (SELECT * FROM [dbo].[Quotas] WHERE ([QuotaName] = N'Exchange2007.
BEGIN
INSERT [dbo].[Quotas] ([QuotaID], [GroupID], [QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID], [HideQuota]) VALUES (422, 12, 26, N'Exchange2007.DisclaimersAllowed', N'Disclaimers Allowed', 1, 0, NULL, NULL)
END
GO
--add SecurityGroupManagement Quota
IF NOT EXISTS (SELECT * FROM [dbo].[Quotas] WHERE [QuotaName] = 'HostedSolution.SecurityGroupManagement')
BEGIN
INSERT [dbo].[Quotas] ([QuotaID], [GroupID],[QuotaOrder], [QuotaName], [QuotaDescription], [QuotaTypeID], [ServiceQuota], [ItemTypeID], [HideQuota]) VALUES (423, 13, 5, N'HostedSolution.SecurityGroupManagement', N'Allow Security Group Management', 1, 0, NULL, NULL)
END
GO
-- Lync Enterprise Voice

View file

@ -155,6 +155,7 @@ order by rg.groupOrder
public const string ORGANIZATION_USERS = "HostedSolution.Users";
public const string ORGANIZATION_DOMAINS = "HostedSolution.Domains";
public const string ORGANIZATION_ALLOWCHANGEUPN = "HostedSolution.AllowChangeUPN";
public const string ORGANIZATION_SECURITYGROUPMANAGEMENT = "HostedSolution.SecurityGroupManagement";
public const string CRM_USERS = "HostedCRM.Users";
public const string CRM_ORGANIZATION = "HostedCRM.Organization";

View file

@ -371,6 +371,11 @@ namespace WebsitePanel.EnterpriseServer
// register domain
DataProvider.AddExchangeOrganizationDomain(itemId, domainId, true);
//add to exchangeAcounts
AddAccount(itemId, ExchangeAccountType.DefaultSecurityGroup, org.GroupName,
org.GroupName, null, false,
0, org.GroupName, null, 0, null);
// register organization domain service item
OrganizationDomain orgDomain = new OrganizationDomain
{
@ -1717,7 +1722,7 @@ namespace WebsitePanel.EnterpriseServer
return (account);
}
public static int SetUserGeneralSettings(int itemId, int accountId, string displayName,
string password, bool hideAddressBook, bool disabled, bool locked, string firstName, string initials,
string lastName, string address, string city, string state, string zip, string country,
@ -2196,6 +2201,339 @@ namespace WebsitePanel.EnterpriseServer
return ocs;
}
private static int AddAccount(int itemId, ExchangeAccountType accountType,
string accountName, string displayName, string primaryEmailAddress, bool mailEnabledPublicFolder,
MailboxManagerActions mailboxManagerActions, string samAccountName, string accountPassword, int mailboxPlanId, string subscriberNumber)
{
return DataProvider.AddExchangeAccount(itemId, (int)accountType,
accountName, displayName, primaryEmailAddress, mailEnabledPublicFolder,
mailboxManagerActions.ToString(), samAccountName, CryptoUtils.Encrypt(accountPassword), mailboxPlanId, (string.IsNullOrEmpty(subscriberNumber) ? null : subscriberNumber.Trim()));
}
public static int CreateSecurityGroup(int itemId, string displayName, string managedBy)
{
if (string.IsNullOrEmpty(displayName))
throw new ArgumentNullException("displayName");
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
if (accountCheck < 0) return accountCheck;
// place log record
TaskManager.StartTask("ORGANIZATION", "CREATE_SECURITY_GROUP", itemId);
TaskManager.Write("Organization ID :" + itemId);
TaskManager.Write("display name :" + displayName);
int securityGroupId = -1;
try
{
displayName = displayName.Trim();
// load organization
Organization org = GetOrganization(itemId);
if (org == null)
{
return -1;
}
StringDictionary serviceSettings = ServerController.GetServiceSettings(org.ServiceId);
if (serviceSettings == null)
{
return -1;
}
// check package
int packageCheck = SecurityContext.CheckPackage(org.PackageId, DemandPackage.IsActive);
if (packageCheck < 0) return packageCheck;
int errorCode;
if (!CheckUserQuota(org.Id, out errorCode))
return errorCode;
Organizations orgProxy = GetOrganizationProxy(org.ServiceId);
TaskManager.Write("accountName :" + displayName);
if (orgProxy.CreateSecurityGroup(org.OrganizationId, displayName, managedBy) == 0)
{
OrganizationSecurityGroup retSecurityGroup = orgProxy.GetSecurityGroupGeneralSettings(displayName, org.OrganizationId);
TaskManager.Write("sAMAccountName :" + retSecurityGroup.SAMAccountName);
securityGroupId = AddAccount(itemId, ExchangeAccountType.SecurityGroup, displayName,
displayName, null, false,
0, retSecurityGroup.SAMAccountName, null, 0, null);
}
else
{
TaskManager.WriteError("Failed to create securitygroup");
}
}
catch (Exception ex)
{
TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
}
return securityGroupId;
}
private static OrganizationSecurityGroup GetDemoSecurityGroupGeneralSettings()
{
OrganizationSecurityGroup c = new OrganizationSecurityGroup();
c.DisplayName = "Fabrikam Sales";
c.AccountName = "sales_fabrikam";
return c;
}
public static OrganizationSecurityGroup GetSecurityGroupGeneralSettings(int itemId, int accountId)
{
#region Demo Mode
if (IsDemoMode)
{
return GetDemoSecurityGroupGeneralSettings();
}
#endregion
// place log record
TaskManager.StartTask("ORGANIZATION", "GET_SECURITY_GROUP_GENERAL", itemId);
try
{
// load organization
Organization org = GetOrganization(itemId);
if (org == null)
return null;
OrganizationUser account = GetAccount(itemId, accountId);
// get mailbox settings
Organizations orgProxy = GetOrganizationProxy(org.ServiceId);
OrganizationSecurityGroup securityGroup = orgProxy.GetSecurityGroupGeneralSettings(account.AccountName, org.OrganizationId);
securityGroup.DisplayName = account.DisplayName;
securityGroup.IsDefault = account.AccountType == ExchangeAccountType.DefaultSecurityGroup;
foreach (OrganizationUser user in securityGroup.MembersAccounts)
{
OrganizationUser userAccount = GetAccountByAccountName(itemId, user.SamAccountName);
user.AccountId = userAccount.AccountId;
user.AccountName = userAccount.AccountName;
user.PrimaryEmailAddress = userAccount.PrimaryEmailAddress;
user.AccountType = userAccount.AccountType;
}
return securityGroup;
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
}
}
public static int DeleteSecurityGroup(int itemId, int accountId)
{
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
if (accountCheck < 0) return accountCheck;
// place log record
TaskManager.StartTask("ORGANIZATION", "DELETE_SECURITY_GROUP", itemId);
try
{
// load organization
Organization org = GetOrganization(itemId);
if (org == null)
return -1;
// load account
ExchangeAccount account = ExchangeServerController.GetAccount(itemId, accountId);
Organizations orgProxy = GetOrganizationProxy(org.ServiceId);
orgProxy.DeleteSecurityGroup(account.AccountName, org.OrganizationId);
DeleteUserFromMetabase(itemId, accountId);
return 0;
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
}
}
public static int SetSecurityGroupGeneralSettings(int itemId, int accountId, string displayName, string managedBy, string[] memberAccounts, string notes)
{
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
if (accountCheck < 0) return accountCheck;
// place log record
TaskManager.StartTask("ORGANIZATION", "UPDATE_SECURITY_GROUP_GENERAL", itemId);
try
{
displayName = displayName.Trim();
// load organization
Organization org = GetOrganization(itemId);
if (org == null)
return -1;
// check package
int packageCheck = SecurityContext.CheckPackage(org.PackageId, DemandPackage.IsActive);
if (packageCheck < 0) return packageCheck;
// load account
ExchangeAccount account = ExchangeServerController.GetAccount(itemId, accountId);
string accountName = GetAccountName(account.AccountName);
// get mailbox settings
Organizations orgProxy = GetOrganizationProxy(org.ServiceId);
// external email
orgProxy.SetSecurityGroupGeneralSettings(
org.OrganizationId,
accountName,
managedBy,
memberAccounts,
notes);
// update account
account.DisplayName = displayName;
UpdateAccount(account);
return 0;
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
}
}
public static ExchangeAccountsPaged GetOrganizationSecurityGroupsPaged(int itemId, string filterColumn, string filterValue, string sortColumn,
int startRow, int maximumRows)
{
#region Demo Mode
if (IsDemoMode)
{
ExchangeAccountsPaged res = new ExchangeAccountsPaged();
List<ExchangeAccount> demoSecurityGroups = new List<ExchangeAccount>();
ExchangeAccount r1 = new ExchangeAccount();
r1.AccountId = 20;
r1.AccountName = "group1_fabrikam";
r1.AccountType = ExchangeAccountType.SecurityGroup;
r1.DisplayName = "Group 1";
demoSecurityGroups.Add(r1);
ExchangeAccount r2 = new ExchangeAccount();
r1.AccountId = 21;
r1.AccountName = "group2_fabrikam";
r1.AccountType = ExchangeAccountType.SecurityGroup;
r1.DisplayName = "Group 2";
demoSecurityGroups.Add(r2);
res.PageItems = demoSecurityGroups.ToArray();
res.RecordsCount = res.PageItems.Length;
return res;
}
#endregion
string accountTypes = string.Format("{0}, {1}", ((int)ExchangeAccountType.SecurityGroup), ((int)ExchangeAccountType.DefaultSecurityGroup));
DataSet ds =
DataProvider.GetExchangeAccountsPaged(SecurityContext.User.UserId, itemId, accountTypes, filterColumn,
filterValue, sortColumn, startRow, maximumRows);
ExchangeAccountsPaged result = new ExchangeAccountsPaged();
result.RecordsCount = (int)ds.Tables[0].Rows[0][0];
List<ExchangeAccount> Tmpaccounts = new List<ExchangeAccount>();
ObjectUtils.FillCollectionFromDataView(Tmpaccounts, ds.Tables[1].DefaultView);
result.PageItems = Tmpaccounts.ToArray();
List<ExchangeAccount> accounts = new List<ExchangeAccount>();
foreach (ExchangeAccount account in Tmpaccounts.ToArray())
{
OrganizationSecurityGroup tmpSecurityGroup = GetSecurityGroupGeneralSettings(itemId, account.AccountId);
if (tmpSecurityGroup != null)
accounts.Add(account);
}
result.PageItems = accounts.ToArray();
return result;
}
public static int AddUserToSecurityGroup(int itemId, int userAccountId, int groupAccountId)
{
// check account
int accountCheck = SecurityContext.CheckAccount(DemandAccount.NotDemo | DemandAccount.IsActive);
if (accountCheck < 0) return accountCheck;
// place log record
TaskManager.StartTask("ORGANIZATION", "ADD_USER_TO_SECURITY_GROUP", itemId);
try
{
// load organization
Organization org = GetOrganization(itemId);
if (org == null)
return -1;
// load user account
OrganizationUser userAccount = GetAccount(itemId, userAccountId);
//load group account
ExchangeAccount groupAccount = ExchangeServerController.GetAccount(itemId, groupAccountId);
Organizations orgProxy = GetOrganizationProxy(org.ServiceId);
orgProxy.AddUserToSecurityGroup(org.OrganizationId, userAccount.AccountName, groupAccount.AccountName);
return 0;
}
catch (Exception ex)
{
throw TaskManager.WriteError(ex);
}
finally
{
TaskManager.CompleteTask();
}
}
}
}

View file

@ -242,5 +242,46 @@ namespace WebsitePanel.EnterpriseServer
#endregion
#region Security Groups
[WebMethod]
public int CreateSecurityGroup(int itemId, string displayName, string managedBy)
{
return OrganizationController.CreateSecurityGroup(itemId, displayName, managedBy);
}
[WebMethod]
public OrganizationSecurityGroup GetSecurityGroupGeneralSettings(int itemId, int accountId)
{
return OrganizationController.GetSecurityGroupGeneralSettings(itemId, accountId);
}
[WebMethod]
public int DeleteSecurityGroup(int itemId, int accountId)
{
return OrganizationController.DeleteSecurityGroup(itemId, accountId);
}
[WebMethod]
public int SetSecurityGroupGeneralSettings(int itemId, int accountId, string displayName, string managedBy, string[] memberAccounts, string notes)
{
return OrganizationController.SetSecurityGroupGeneralSettings(itemId, accountId, displayName, managedBy, memberAccounts, notes);
}
[WebMethod]
public ExchangeAccountsPaged GetOrganizationSecurityGroupsPaged(int itemId, string filterColumn, string filterValue, string sortColumn,
int startRow, int maximumRows)
{
return OrganizationController.GetOrganizationSecurityGroupsPaged(itemId, filterColumn, filterValue, sortColumn, startRow, maximumRows);
}
[WebMethod]
public int AddUserToSecurityGroup(int itemId, int userAccountId, int groupAccountId)
{
return OrganizationController.AddUserToSecurityGroup(itemId, userAccountId, groupAccountId);
}
#endregion
}
}

View file

@ -61,6 +61,7 @@ namespace WebsitePanel.Providers.HostedSolution
public const string ExternalEmail = "mail";
public const string CustomAttribute2 = "extensionAttribute2";
public const string DistinguishedName = "distinguishedName";
public const string ManagedBy = "ManagedBy";
}
}

View file

@ -44,6 +44,35 @@ namespace WebsitePanel.Providers.HostedSolution
return de;
}
public static string[] GetUsersGroup(string group)
{
List<string> rets = new List<string>();
DirectorySearcher deSearch = new DirectorySearcher
{
Filter =
("(&(objectClass=user))")
};
SearchResultCollection srcUsers = deSearch.FindAll();
foreach (SearchResult srcUser in srcUsers)
{
DirectoryEntry de = srcUser.GetDirectoryEntry();
PropertyValueCollection props = de.Properties["memberOf"];
foreach (string str in props)
{
if (str.IndexOf(group) != -1)
{
rets.Add(de.Path);
}
}
}
return rets.ToArray();
}
public static bool IsUserInGroup(string samAccountName, string group)
{
bool res = false;
@ -328,6 +357,7 @@ namespace WebsitePanel.Providers.HostedSolution
newGroupObject.Properties[ADAttributes.SAMAccountName].Add(group);
newGroupObject.Properties[ADAttributes.GroupType].Add(-2147483640);
newGroupObject.CommitChanges();
}
@ -339,6 +369,14 @@ namespace WebsitePanel.Providers.HostedSolution
group.Invoke("Add", user.Path);
}
public static void RemoveUserFromGroup(string userPath, string groupPath)
{
DirectoryEntry user = new DirectoryEntry(userPath);
DirectoryEntry group = new DirectoryEntry(groupPath);
group.Invoke("Remove", user.Path);
}
public static bool AdObjectExists(string path)
{
return DirectoryEntry.Exists(path);

View file

@ -37,7 +37,9 @@ namespace WebsitePanel.Providers.HostedSolution
PublicFolder = 4,
Room = 5,
Equipment = 6,
User = 7
User = 7,
SecurityGroup = 8,
DefaultSecurityGroup = 9
}
}

View file

@ -42,6 +42,16 @@ namespace WebsitePanel.Providers.HostedSolution
OrganizationUser GetUserGeneralSettings(string loginName, string organizationId);
int CreateSecurityGroup(string organizationId, string groupName, string managedBy);
OrganizationSecurityGroup GetSecurityGroupGeneralSettings(string groupName, string organizationId);
void DeleteSecurityGroup(string groupName, string organizationId);
void SetSecurityGroupGeneralSettings(string organizationId, string groupName, string managedBy, string[] memberAccounts, string notes);
void AddUserToSecurityGroup(string organizationId, string loginName, string groupName);
void SetUserGeneralSettings(string organizationId, string accountName, string displayName, string password,
bool hideFromAddressBook, bool disabled, bool locked, string firstName, string initials,
string lastName,

View file

@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WebsitePanel.Providers.HostedSolution
{
public class OrganizationSecurityGroup
{
public string DisplayName
{
get;
set;
}
public string AccountName
{
get;
set;
}
public OrganizationUser[] MembersAccounts
{
get;
set;
}
public OrganizationUser ManagerAccount
{
get;
set;
}
public string Notes
{
get;
set;
}
public string SAMAccountName
{
get;
set;
}
public bool IsDefault
{
get;
set;
}
}
}

View file

@ -103,6 +103,7 @@
<Compile Include="HostedSolution\LyncUserPlanType.cs" />
<Compile Include="HostedSolution\LyncUsersPaged.cs" />
<Compile Include="HostedSolution\LyncVoicePolicyType.cs" />
<Compile Include="HostedSolution\OrganizationSecurityGroup.cs" />
<Compile Include="HostedSolution\TransactionAction.cs" />
<Compile Include="RemoteDesktopServices\IRemoteDesktopServices.cs" />
<Compile Include="ResultObjects\HeliconApe.cs" />

View file

@ -27,10 +27,10 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections.Generic;
using System.DirectoryServices;
using System.Globalization;
using System.Text;
using WebsitePanel.Providers.Common;
using WebsitePanel.Providers.ResultObjects;
@ -102,6 +102,20 @@ namespace WebsitePanel.Providers.HostedSolution
return sb.ToString();
}
private string GetGroupPath(string organizationId, string groupName)
{
StringBuilder sb = new StringBuilder();
// append provider
AppendProtocol(sb);
AppendDomainController(sb);
AppendCNPath(sb, groupName);
AppendOUPath(sb, organizationId);
AppendOUPath(sb, RootOU);
AppendDomainPath(sb, RootDomain);
return sb.ToString();
}
private string GetRootOU()
{
StringBuilder sb = new StringBuilder();
@ -213,6 +227,7 @@ namespace WebsitePanel.Providers.HostedSolution
org.OrganizationId = organizationId;
org.DistinguishedName = ActiveDirectoryUtils.RemoveADPrefix(orgPath);
org.SecurityGroup = ActiveDirectoryUtils.RemoveADPrefix(GetGroupPath(organizationId));
org.GroupName = organizationId;
}
catch (Exception ex)
{
@ -498,10 +513,19 @@ namespace WebsitePanel.Providers.HostedSolution
throw new ArgumentNullException("loginName");
string path = GetUserPath(organizationId, loginName);
DirectoryEntry entry = ActiveDirectoryUtils.GetADObject(path);
OrganizationUser retUser = GetUser(path);
HostedSolutionLog.LogEnd("GetUserGeneralSettingsInternal");
return retUser;
}
private OrganizationUser GetUser(string path)
{
OrganizationUser retUser = new OrganizationUser();
DirectoryEntry entry = ActiveDirectoryUtils.GetADObject(path);
retUser.FirstName = ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.FirstName);
retUser.LastName = ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.LastName);
retUser.DisplayName = ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.DisplayName);
@ -524,14 +548,13 @@ namespace WebsitePanel.Providers.HostedSolution
retUser.Notes = ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.Notes);
retUser.ExternalEmail = ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.ExternalEmail);
retUser.Disabled = (bool)entry.InvokeGet(ADAttributes.AccountDisabled);
retUser.Manager = GetManager(entry);
retUser.Manager = GetManager(entry, ADAttributes.Manager);
retUser.SamAccountName = ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.SAMAccountName);
retUser.DomainUserName = GetDomainName(ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.SAMAccountName));
retUser.DistinguishedName = ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.DistinguishedName);
retUser.Locked = (bool)entry.InvokeGet(ADAttributes.AccountLocked);
retUser.UserPrincipalName= (string)entry.InvokeGet(ADAttributes.UserPrincipalName);
retUser.UserPrincipalName = (string)entry.InvokeGet(ADAttributes.UserPrincipalName);
HostedSolutionLog.LogEnd("GetUserGeneralSettingsInternal");
return retUser;
}
@ -542,10 +565,10 @@ namespace WebsitePanel.Providers.HostedSolution
return ret;
}
private OrganizationUser GetManager(DirectoryEntry entry)
private OrganizationUser GetManager(DirectoryEntry entry, string adAttribute)
{
OrganizationUser retUser = null;
string path = ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.Manager);
string path = ActiveDirectoryUtils.GetADObjectStringProperty(entry, adAttribute);
if (!string.IsNullOrEmpty(path))
{
path = ActiveDirectoryUtils.AddADPrefix(path, PrimaryDomainController);
@ -800,6 +823,226 @@ namespace WebsitePanel.Providers.HostedSolution
}
#endregion
#region Security Groups
public int CreateSecurityGroup(string organizationId, string groupName, string managedBy)
{
return CreateSecurityGroupInternal(organizationId, groupName, managedBy);
}
internal int CreateSecurityGroupInternal(string organizationId, string groupName, string managedBy)
{
HostedSolutionLog.LogStart("CreateSecurityGroupInternal");
HostedSolutionLog.DebugInfo("organizationId : {0}", organizationId);
HostedSolutionLog.DebugInfo("groupName : {0}", groupName);
if (string.IsNullOrEmpty(organizationId))
throw new ArgumentNullException("organizationId");
if (string.IsNullOrEmpty(groupName))
throw new ArgumentNullException("groupName");
bool groupCreated = false;
string groupPath = null;
try
{
string path = GetOrganizationPath(organizationId);
groupPath = GetGroupPath(organizationId, groupName);
if (!ActiveDirectoryUtils.AdObjectExists(groupPath))
{
ActiveDirectoryUtils.CreateGroup(path, groupName);
DirectoryEntry entry = ActiveDirectoryUtils.GetADObject(groupPath);
string manager = string.Empty;
if (!string.IsNullOrEmpty(managedBy))
{
string managerPath = GetUserPath(organizationId, managedBy);
manager = ActiveDirectoryUtils.AdObjectExists(managerPath) ? managerPath : string.Empty;
}
ActiveDirectoryUtils.SetADObjectProperty(entry, ADAttributes.ManagedBy, ActiveDirectoryUtils.RemoveADPrefix(manager));
entry.CommitChanges();
groupCreated = true;
HostedSolutionLog.DebugInfo("Security Group created: {0}", groupName);
}
else
{
HostedSolutionLog.DebugInfo("AD_OBJECT_ALREADY_EXISTS: {0}", groupPath);
HostedSolutionLog.LogEnd("CreateSecurityGroupInternal");
return Errors.AD_OBJECT_ALREADY_EXISTS;
}
}
catch (Exception e)
{
HostedSolutionLog.LogError(e);
try
{
if (groupCreated)
ActiveDirectoryUtils.DeleteADObject(groupPath);
}
catch (Exception ex)
{
HostedSolutionLog.LogError(ex);
}
return Errors.AD_OBJECT_ALREADY_EXISTS;
}
HostedSolutionLog.LogEnd("CreateSecurityGroupInternal");
return Errors.OK;
}
public OrganizationSecurityGroup GetSecurityGroupGeneralSettings(string groupName, string organizationId)
{
return GetSecurityGroupGeneralSettingsInternal(groupName, organizationId);
}
internal OrganizationSecurityGroup GetSecurityGroupGeneralSettingsInternal(string groupName, string organizationId)
{
HostedSolutionLog.LogStart("GetSecurityGroupGeneralSettingsInternal");
HostedSolutionLog.DebugInfo("groupName : {0}", groupName);
HostedSolutionLog.DebugInfo("organizationId : {0}", organizationId);
if (string.IsNullOrEmpty(organizationId))
throw new ArgumentNullException("organizationId");
if (string.IsNullOrEmpty(groupName))
throw new ArgumentNullException("groupName");
string path = GetGroupPath(organizationId, groupName);
DirectoryEntry entry = ActiveDirectoryUtils.GetADObject(path);
OrganizationSecurityGroup securityGroup = new OrganizationSecurityGroup();
securityGroup.ManagerAccount = GetManager(entry, ADAttributes.ManagedBy);
securityGroup.Notes = ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.Notes);
securityGroup.AccountName = ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.SAMAccountName);
securityGroup.SAMAccountName = ActiveDirectoryUtils.GetADObjectStringProperty(entry, ADAttributes.SAMAccountName);
List<OrganizationUser> members = new List<OrganizationUser>();
foreach (string userPath in ActiveDirectoryUtils.GetUsersGroup(groupName))
{
members.Add(GetUser(userPath));
}
securityGroup.MembersAccounts = members.ToArray();
HostedSolutionLog.LogEnd("GetSecurityGroupGeneralSettingsInternal");
return securityGroup;
}
public void DeleteSecurityGroup(string groupName, string organizationId)
{
DeleteSecurityGroupInternal(groupName, organizationId);
}
internal void DeleteSecurityGroupInternal(string groupName, string organizationId)
{
HostedSolutionLog.LogStart("DeleteSecurityGroupInternal");
HostedSolutionLog.DebugInfo("groupName : {0}", groupName);
HostedSolutionLog.DebugInfo("organizationId : {0}", organizationId);
if (string.IsNullOrEmpty(organizationId))
throw new ArgumentNullException("organizationId");
if (string.IsNullOrEmpty(groupName))
throw new ArgumentNullException("groupName");
string path = GetGroupPath(organizationId, groupName);
if (ActiveDirectoryUtils.AdObjectExists(path))
ActiveDirectoryUtils.DeleteADObject(path, true);
HostedSolutionLog.LogEnd("DeleteSecurityGroupInternal");
}
public void SetSecurityGroupGeneralSettings(string organizationId, string groupName, string managedBy, string[] memberAccounts, string notes)
{
SetSecurityGroupGeneralSettingsInternal(organizationId, groupName, managedBy, memberAccounts, notes);
}
internal void SetSecurityGroupGeneralSettingsInternal(string organizationId, string groupName, string managedBy, string[] memberAccounts, string notes)
{
HostedSolutionLog.LogStart("SetSecurityGroupGeneralSettingsInternal");
HostedSolutionLog.DebugInfo("organizationId : {0}", organizationId);
HostedSolutionLog.DebugInfo("groupName : {0}", groupName);
if (string.IsNullOrEmpty(organizationId))
throw new ArgumentNullException("organizationId");
if (string.IsNullOrEmpty(groupName))
throw new ArgumentNullException("groupName");
string path = GetGroupPath(organizationId, groupName);
DirectoryEntry entry = ActiveDirectoryUtils.GetADObject(path);
string manager = string.Empty;
if (!string.IsNullOrEmpty(managedBy))
{
string managerPath = GetUserPath(organizationId, managedBy);
manager = ActiveDirectoryUtils.AdObjectExists(managerPath) ? managerPath : string.Empty;
}
ActiveDirectoryUtils.SetADObjectProperty(entry, ADAttributes.ManagedBy, ActiveDirectoryUtils.RemoveADPrefix(manager));
ActiveDirectoryUtils.SetADObjectProperty(entry, ADAttributes.Notes, notes);
foreach(string userPath in ActiveDirectoryUtils.GetUsersGroup(groupName)) {
ActiveDirectoryUtils.RemoveUserFromGroup(userPath, path);
}
foreach(string user in memberAccounts) {
string userPath = GetUserPath(organizationId, user);
ActiveDirectoryUtils.AddUserToGroup(userPath, path);
}
entry.CommitChanges();
}
public void AddUserToSecurityGroup(string organizationId, string loginName, string groupName)
{
AddUserToSecurityGroupInternal(organizationId, loginName, groupName);
}
internal void AddUserToSecurityGroupInternal(string organizationId, string loginName, string groupName)
{
HostedSolutionLog.LogStart("AddUserToSecurityGroupInternal");
HostedSolutionLog.DebugInfo("organizationId : {0}", organizationId);
HostedSolutionLog.DebugInfo("loginName : {0}", loginName);
HostedSolutionLog.DebugInfo("groupName : {0}", groupName);
if (string.IsNullOrEmpty(organizationId))
throw new ArgumentNullException("organizationId");
if (string.IsNullOrEmpty(loginName))
throw new ArgumentNullException("loginName");
if (string.IsNullOrEmpty(groupName))
throw new ArgumentNullException("groupName");
string userPath = GetUserPath(organizationId, loginName);
string groupPath = GetGroupPath(organizationId, groupName);
ActiveDirectoryUtils.AddUserToGroup(userPath, groupPath);
}
#endregion
public override bool IsInstalled()
{
return Environment.UserDomainName != Environment.MachineName;

View file

@ -77,6 +77,16 @@ namespace WebsitePanel.Providers.HostedSolution
private System.Threading.SendOrPostCallback GetUserGeneralSettingsOperationCompleted;
private System.Threading.SendOrPostCallback CreateSecurityGroupOperationCompleted;
private System.Threading.SendOrPostCallback GetSecurityGroupGeneralSettingsOperationCompleted;
private System.Threading.SendOrPostCallback DeleteSecurityGroupOperationCompleted;
private System.Threading.SendOrPostCallback SetSecurityGroupGeneralSettingsOperationCompleted;
private System.Threading.SendOrPostCallback AddUserToSecurityGroupOperationCompleted;
private System.Threading.SendOrPostCallback SetUserGeneralSettingsOperationCompleted;
private System.Threading.SendOrPostCallback SetUserPasswordOperationCompleted;
@ -117,6 +127,21 @@ namespace WebsitePanel.Providers.HostedSolution
/// <remarks/>
public event GetUserGeneralSettingsCompletedEventHandler GetUserGeneralSettingsCompleted;
/// <remarks/>
public event CreateSecurityGroupCompletedEventHandler CreateSecurityGroupCompleted;
/// <remarks/>
public event GetSecurityGroupGeneralSettingsCompletedEventHandler GetSecurityGroupGeneralSettingsCompleted;
/// <remarks/>
public event DeleteSecurityGroupCompletedEventHandler DeleteSecurityGroupCompleted;
/// <remarks/>
public event SetSecurityGroupGeneralSettingsCompletedEventHandler SetSecurityGroupGeneralSettingsCompleted;
/// <remarks/>
public event AddUserToSecurityGroupCompletedEventHandler AddUserToSecurityGroupCompleted;
/// <remarks/>
public event SetUserGeneralSettingsCompletedEventHandler SetUserGeneralSettingsCompleted;
@ -458,6 +483,280 @@ namespace WebsitePanel.Providers.HostedSolution
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/CreateSecurityGroup", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int CreateSecurityGroup(string organizationId, string groupName, string managedBy)
{
object[] results = this.Invoke("CreateSecurityGroup", new object[] {
organizationId,
groupName,
managedBy});
return ((int)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginCreateSecurityGroup(string organizationId, string groupName, string managedBy, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("CreateSecurityGroup", new object[] {
organizationId,
groupName,
managedBy}, callback, asyncState);
}
/// <remarks/>
public int EndCreateSecurityGroup(System.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
}
/// <remarks/>
public void CreateSecurityGroupAsync(string organizationId, string groupName, string managedBy)
{
this.CreateSecurityGroupAsync(organizationId, groupName, managedBy, null);
}
/// <remarks/>
public void CreateSecurityGroupAsync(string organizationId, string groupName, string managedBy, object userState)
{
if ((this.CreateSecurityGroupOperationCompleted == null))
{
this.CreateSecurityGroupOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateSecurityGroupOperationCompleted);
}
this.InvokeAsync("CreateSecurityGroup", new object[] {
organizationId,
groupName,
managedBy}, this.CreateSecurityGroupOperationCompleted, userState);
}
private void OnCreateSecurityGroupOperationCompleted(object arg)
{
if ((this.CreateSecurityGroupCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.CreateSecurityGroupCompleted(this, new CreateSecurityGroupCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/GetSecurityGroupGeneralSettings", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public OrganizationSecurityGroup GetSecurityGroupGeneralSettings(string groupName, string organizationId)
{
object[] results = this.Invoke("GetSecurityGroupGeneralSettings", new object[] {
groupName,
organizationId});
return ((OrganizationSecurityGroup)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BeginGetSecurityGroupGeneralSettings(string groupName, string organizationId, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("GetSecurityGroupGeneralSettings", new object[] {
groupName,
organizationId}, callback, asyncState);
}
/// <remarks/>
public OrganizationSecurityGroup EndGetSecurityGroupGeneralSettings(System.IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((OrganizationSecurityGroup)(results[0]));
}
/// <remarks/>
public void GetSecurityGroupGeneralSettingsAsync(string groupName, string organizationId)
{
this.GetSecurityGroupGeneralSettingsAsync(groupName, organizationId, null);
}
/// <remarks/>
public void GetSecurityGroupGeneralSettingsAsync(string groupName, string organizationId, object userState)
{
if ((this.GetSecurityGroupGeneralSettingsOperationCompleted == null))
{
this.GetSecurityGroupGeneralSettingsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetSecurityGroupGeneralSettingsOperationCompleted);
}
this.InvokeAsync("GetSecurityGroupGeneralSettings", new object[] {
groupName,
organizationId}, this.GetSecurityGroupGeneralSettingsOperationCompleted, userState);
}
private void OnGetSecurityGroupGeneralSettingsOperationCompleted(object arg)
{
if ((this.GetSecurityGroupGeneralSettingsCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.GetSecurityGroupGeneralSettingsCompleted(this, new GetSecurityGroupGeneralSettingsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/DeleteSecurityGroup", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void DeleteSecurityGroup(string groupName, string organizationId)
{
this.Invoke("DeleteSecurityGroup", new object[] {
groupName,
organizationId});
}
/// <remarks/>
public System.IAsyncResult BeginDeleteSecurityGroup(string groupName, string organizationId, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("DeleteSecurityGroup", new object[] {
groupName,
organizationId}, callback, asyncState);
}
/// <remarks/>
public void EndDeleteSecurityGroup(System.IAsyncResult asyncResult)
{
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void DeleteSecurityGroupAsync(string groupName, string organizationId)
{
this.DeleteSecurityGroupAsync(groupName, organizationId, null);
}
/// <remarks/>
public void DeleteSecurityGroupAsync(string groupName, string organizationId, object userState)
{
if ((this.DeleteSecurityGroupOperationCompleted == null))
{
this.DeleteSecurityGroupOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDeleteSecurityGroupOperationCompleted);
}
this.InvokeAsync("DeleteSecurityGroup", new object[] {
groupName,
organizationId}, this.DeleteSecurityGroupOperationCompleted, userState);
}
private void OnDeleteSecurityGroupOperationCompleted(object arg)
{
if ((this.DeleteSecurityGroupCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.DeleteSecurityGroupCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/SetSecurityGroupGeneralSettings", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void SetSecurityGroupGeneralSettings(string organizationId, string groupName, string managedBy, string[] memberAccounts, string notes)
{
this.Invoke("SetSecurityGroupGeneralSettings", new object[] {
organizationId,
groupName,
managedBy,
memberAccounts,
notes});
}
/// <remarks/>
public System.IAsyncResult BeginSetSecurityGroupGeneralSettings(string organizationId, string groupName, string managedBy, string[] memberAccounts, string notes, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("SetSecurityGroupGeneralSettings", new object[] {
organizationId,
groupName,
managedBy,
memberAccounts,
notes}, callback, asyncState);
}
/// <remarks/>
public void EndSetSecurityGroupGeneralSettings(System.IAsyncResult asyncResult)
{
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void SetSecurityGroupGeneralSettingsAsync(string organizationId, string groupName, string managedBy, string[] memberAccounts, string notes)
{
this.SetSecurityGroupGeneralSettingsAsync(organizationId, groupName, managedBy, memberAccounts, notes, null);
}
/// <remarks/>
public void SetSecurityGroupGeneralSettingsAsync(string organizationId, string groupName, string managedBy, string[] memberAccounts, string notes, object userState)
{
if ((this.SetSecurityGroupGeneralSettingsOperationCompleted == null))
{
this.SetSecurityGroupGeneralSettingsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetSecurityGroupGeneralSettingsOperationCompleted);
}
this.InvokeAsync("SetSecurityGroupGeneralSettings", new object[] {
organizationId,
groupName,
managedBy,
memberAccounts,
notes}, this.SetSecurityGroupGeneralSettingsOperationCompleted, userState);
}
private void OnSetSecurityGroupGeneralSettingsOperationCompleted(object arg)
{
if ((this.SetSecurityGroupGeneralSettingsCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.SetSecurityGroupGeneralSettingsCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/AddUserToSecurityGroup", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void AddUserToSecurityGroup(string organizationId, string loginName, string groupName)
{
this.Invoke("AddUserToSecurityGroup", new object[] {
organizationId,
loginName,
groupName});
}
/// <remarks/>
public System.IAsyncResult BeginAddUserToSecurityGroup(string organizationId, string loginName, string groupName, System.AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("AddUserToSecurityGroup", new object[] {
organizationId,
loginName,
groupName}, callback, asyncState);
}
/// <remarks/>
public void EndAddUserToSecurityGroup(System.IAsyncResult asyncResult)
{
this.EndInvoke(asyncResult);
}
/// <remarks/>
public void AddUserToSecurityGroupAsync(string organizationId, string loginName, string groupName)
{
this.AddUserToSecurityGroupAsync(organizationId, loginName, groupName, null);
}
/// <remarks/>
public void AddUserToSecurityGroupAsync(string organizationId, string loginName, string groupName, object userState)
{
if ((this.AddUserToSecurityGroupOperationCompleted == null))
{
this.AddUserToSecurityGroupOperationCompleted = new System.Threading.SendOrPostCallback(this.OnAddUserToSecurityGroupOperationCompleted);
}
this.InvokeAsync("AddUserToSecurityGroup", new object[] {
organizationId,
loginName,
groupName}, this.AddUserToSecurityGroupOperationCompleted, userState);
}
private void OnAddUserToSecurityGroupOperationCompleted(object arg)
{
if ((this.AddUserToSecurityGroupCompleted != null))
{
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.AddUserToSecurityGroupCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapHeaderAttribute("ServiceProviderSettingsSoapHeaderValue")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/SetUserGeneralSettings", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
@ -1197,6 +1496,78 @@ namespace WebsitePanel.Providers.HostedSolution
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void CreateSecurityGroupCompletedEventHandler(object sender, CreateSecurityGroupCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class CreateSecurityGroupCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
internal CreateSecurityGroupCompletedEventArgs(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 GetSecurityGroupGeneralSettingsCompletedEventHandler(object sender, GetSecurityGroupGeneralSettingsCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class GetSecurityGroupGeneralSettingsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
internal GetSecurityGroupGeneralSettingsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public OrganizationSecurityGroup Result
{
get
{
this.RaiseExceptionIfNecessary();
return ((OrganizationSecurityGroup)(this.results[0]));
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void DeleteSecurityGroupCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void SetSecurityGroupGeneralSettingsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void AddUserToSecurityGroupCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
public delegate void SetUserGeneralSettingsCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);

View file

@ -110,6 +110,36 @@ namespace WebsitePanel.Server
return Organization.GetUserGeneralSettings(loginName, organizationId);
}
[WebMethod, SoapHeader("settings")]
public int CreateSecurityGroup(string organizationId, string groupName, string managedBy)
{
return Organization.CreateSecurityGroup(organizationId, groupName, managedBy);
}
[WebMethod, SoapHeader("settings")]
public OrganizationSecurityGroup GetSecurityGroupGeneralSettings(string groupName, string organizationId)
{
return Organization.GetSecurityGroupGeneralSettings(groupName, organizationId);
}
[WebMethod, SoapHeader("settings")]
public void DeleteSecurityGroup(string groupName, string organizationId)
{
Organization.DeleteSecurityGroup(groupName, organizationId);
}
[WebMethod, SoapHeader("settings")]
public void SetSecurityGroupGeneralSettings(string organizationId, string groupName, string managedBy, string[] memberAccounts, string notes)
{
Organization.SetSecurityGroupGeneralSettings(organizationId, groupName, managedBy, memberAccounts, notes);
}
[WebMethod, SoapHeader("settings")]
public void AddUserToSecurityGroup(string organizationId, string loginName, string groupName)
{
Organization.AddUserToSecurityGroup(organizationId, loginName, groupName);
}
[WebMethod, SoapHeader("settings")]
public void SetUserGeneralSettings(string organizationId, string accountName, string displayName, string password,
bool hideFromAddressBook, bool disabled, bool locked, string firstName, string initials, string lastName,

View file

@ -545,6 +545,10 @@
<Control key="add_lyncuserplan" src="WebsitePanel/Lync/LyncAddLyncUserPlan.ascx" title="LyncAddLyncUserPlan" type="View" />
<Control key="edit_lync_user" src="WebsitePanel/Lync/LyncEditUser.ascx" title="Edit Lync User" type="View" />
<Control key="secur_groups" src="WebsitePanel/ExchangeServer/OrganizationSecurityGroups.ascx" title="OrganizationSecurityGroups" type="View" />
<Control key="create_secur_group" src="WebsitePanel/ExchangeServer/OrganizationCreateSecurityGroup.ascx" title="OrganizationSecurityGroup" type="View" />
<Control key="secur_group_settings" src="WebsitePanel/ExchangeServer/OrganizationSecurityGroupGeneralSettings.ascx" title="OrganizationSecurityGroup" type="View" />
</Controls>
</ModuleDefinition>

View file

@ -3307,6 +3307,9 @@
<data name="Quota.HostedSolution.Domains" xml:space="preserve">
<value>Domains per Organization</value>
</data>
<data name="Quota.HostedSolution.SecurityGroupManagement" xml:space="preserve">
<value>Allow Security Group Management</value>
</data>
<data name="ResourceGroup.Hosted SharePoint" xml:space="preserve">
<value>Hosted SharePoint</value>
</data>

View file

@ -83,5 +83,30 @@ namespace WebsitePanel.Portal
}
#endregion
#region Security Groups
ExchangeAccountsPaged accounts;
public int GetOrganizationSecurityGroupsPagedCount(int itemId, string accountTypes,
string filterColumn, string filterValue)
{
return accounts.RecordsCount;
}
public ExchangeAccount[] GetOrganizationSecurityGroupsPaged(int itemId, string accountTypes,
string filterColumn, string filterValue,
int maximumRows, int startRowIndex, string sortColumn)
{
if (!String.IsNullOrEmpty(filterValue))
filterValue = filterValue + "%";
accounts = ES.Services.Organizations.GetOrganizationSecurityGroupsPaged(itemId,
filterColumn, filterValue, sortColumn, startRowIndex, maximumRows);
return accounts.PageItems;
}
#endregion
}
}

View file

@ -0,0 +1,153 @@
<?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="btnCreate.OnClientClick" xml:space="preserve">
<value>ShowProgressDialog('Creating group ...');</value>
</data>
<data name="btnCreate.Text" xml:space="preserve">
<value>Create Group</value>
</data>
<data name="FormComments.Text" xml:space="preserve">
<value />
</data>
<data name="locAccount.Text" xml:space="preserve">
<value>E-mail Address: *</value>
</data>
<data name="locDisplayName.Text" xml:space="preserve">
<value>Display Name: *</value>
</data>
<data name="locManagedBy.Text" xml:space="preserve">
<value>Managed by: *</value>
</data>
<data name="locTitle.Text" xml:space="preserve">
<value>Create New Group</value>
</data>
<data name="Text.PageName" xml:space="preserve">
<value>Groups</value>
</data>
<data name="valManager.ErrorMessage" xml:space="preserve">
<value>Please specify a manager</value>
</data>
<data name="valRequireDisplayName.ErrorMessage" xml:space="preserve">
<value>Enter Display Name</value>
</data>
<data name="valRequireDisplayName.Text" xml:space="preserve">
<value>*</value>
</data>
</root>

View file

@ -0,0 +1,156 @@
<?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="btnSave.OnClientClick" xml:space="preserve">
<value>ShowProgressDialog('Updating group settings...');</value>
</data>
<data name="btnSave.Text" xml:space="preserve">
<value>Save Changes</value>
</data>
<data name="chkHideAddressBook.Text" xml:space="preserve">
<value>Hide from Address Book</value>
</data>
<data name="FormComments.Text" xml:space="preserve">
<value />
</data>
<data name="locManager.Text" xml:space="preserve">
<value>Managed By: *</value>
</data>
<data name="locMembers.Text" xml:space="preserve">
<value>Members:</value>
</data>
<data name="locNotes.Text" xml:space="preserve">
<value>Notes:</value>
</data>
<data name="locTitle.Text" xml:space="preserve">
<value>Edit Group</value>
</data>
<data name="Text.PageName" xml:space="preserve">
<value>Groups</value>
</data>
<data name="valManager.ErrorMessage" xml:space="preserve">
<value>Please specify a manager</value>
</data>
<data name="valRequireDisplayName.ErrorMessage" xml:space="preserve">
<value>Enter Display Name</value>
</data>
<data name="valRequireDisplayName.Text" xml:space="preserve">
<value>*</value>
</data>
</root>

View file

@ -0,0 +1,153 @@
<?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="btnCreateGroup.Text" xml:space="preserve">
<value>Create New Group</value>
</data>
<data name="cmdDelete.OnClientClick" xml:space="preserve">
<value>if(!confirm('Are you sure you want to delete this group?')) return false; else ShowProgressDialog('Deleting group...');</value>
</data>
<data name="cmdDelete.Text" xml:space="preserve">
<value>Delete</value>
</data>
<data name="cmdDelete.ToolTip" xml:space="preserve">
<value>Delete Group</value>
</data>
<data name="cmdSearch.AlternateText" xml:space="preserve">
<value>Search</value>
</data>
<data name="ddlSearchColumnDisplayName.Text" xml:space="preserve">
<value>Display Name</value>
</data>
<data name="FormComments.Text" xml:space="preserve">
<value />
</data>
<data name="gvGroups.Empty" xml:space="preserve">
<value>No groups have been created. To create a new group click "Create New Group" button.</value>
</data>
<data name="gvGroupsDisplayName.Header" xml:space="preserve">
<value>Display Name</value>
</data>
<data name="locTitle.Text" xml:space="preserve">
<value>Groups</value>
</data>
<data name="Text.PageName" xml:space="preserve">
<value>Groups</value>
</data>
</root>

View file

@ -0,0 +1,55 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OrganizationCreateSecurityGroup.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.OrganizationCreateSecurityGroup" %>
<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %>
<%@ Register Src="UserControls/EmailAddress.ascx" TagName="EmailAddress" TagPrefix="wsp" %>
<%@ Register Src="UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %>
<%@ Register Src="UserControls/Breadcrumb.ascx" TagName="Breadcrumb" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
<%@ Register src="UserControls/UserSelector.ascx" tagname="UserSelector" tagprefix="wsp" %>
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/>
<div id="ExchangeContainer">
<div class="Module">
<div class="Header">
<wsp:Breadcrumb id="breadcrumb" runat="server" PageName="Text.PageName" />
</div>
<div class="Left">
<wsp:Menu id="menu" runat="server" SelectedItem="dlists" />
</div>
<div class="Content">
<div class="Center">
<div class="Title">
<asp:Image ID="Image1" SkinID="ExchangeListAdd48" runat="server" />
<asp:Localize ID="locTitle" runat="server" meta:resourcekey="locTitle" Text="Create Group"></asp:Localize>
</div>
<div class="FormBody">
<wsp:SimpleMessageBox id="messageBox" runat="server" />
<table>
<tr>
<td class="FormLabel150"><asp:Localize ID="locDisplayName" runat="server" meta:resourcekey="locDisplayName" Text="Display Name: *"></asp:Localize></td>
<td>
<asp:TextBox ID="txtDisplayName" runat="server" CssClass="HugeTextBox200"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireDisplayName" runat="server" meta:resourcekey="valRequireDisplayName" ControlToValidate="txtDisplayName"
ErrorMessage="Enter Display Name" ValidationGroup="CreateGroup" Display="Dynamic" Text="*" SetFocusOnError="True"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="FormLabel150"><asp:Localize ID="Localize1" runat="server" meta:resourcekey="locManagedBy" ></asp:Localize></td>
<td>
<wsp:userselector id="manager" IncludeMailboxes="true" runat="server" />
<asp:CustomValidator runat="server"
ValidationGroup="CreateGroup" meta:resourcekey="valManager" ID="valManager"
onservervalidate="valManager_ServerValidate" />
</td>
</tr>
</table>
<div class="FormFooterClean">
<asp:Button id="btnCreate" runat="server" Text="Create Group" CssClass="Button1" meta:resourcekey="btnCreate" ValidationGroup="CreateGroup" OnClick="btnCreate_Click"></asp:Button>
<asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True" ShowSummary="False" ValidationGroup="CreateGroup" />
</div>
</div>
</div>
</div>
</div>
</div>

View file

@ -0,0 +1,83 @@
// 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.
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using WebsitePanel.EnterpriseServer;
namespace WebsitePanel.Portal.ExchangeServer
{
public partial class OrganizationCreateSecurityGroup : WebsitePanelModuleBase
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnCreate_Click(object sender, EventArgs e)
{
CreateSecurityGroup();
}
private void CreateSecurityGroup()
{
if (!Page.IsValid)
return;
try
{
int accountId = ES.Services.Organizations.CreateSecurityGroup(PanelRequest.ItemID, txtDisplayName.Text, manager.GetAccount());
if (accountId < 0)
{
messageBox.ShowResultMessage(accountId);
return;
}
Response.Redirect(EditUrl("AccountID", accountId.ToString(), "secur_group_settings",
"SpaceID=" + PanelSecurity.PackageId.ToString(),
"ItemID=" + PanelRequest.ItemID.ToString()));
}
catch (Exception ex)
{
messageBox.ShowErrorMessage("ORGANIZATION_CREATE_SECURITY_GROUP", ex);
}
}
protected void valManager_ServerValidate(object source, ServerValidateEventArgs args)
{
args.IsValid = manager.GetAccountId() != 0;
}
}
}

View file

@ -0,0 +1,141 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal.ExchangeServer {
public partial class OrganizationCreateSecurityGroup {
/// <summary>
/// asyncTasks control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks;
/// <summary>
/// breadcrumb control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Breadcrumb breadcrumb;
/// <summary>
/// menu control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Menu menu;
/// <summary>
/// Image1 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.Image Image1;
/// <summary>
/// locTitle 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.Localize locTitle;
/// <summary>
/// messageBox control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox;
/// <summary>
/// locDisplayName 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.Localize locDisplayName;
/// <summary>
/// txtDisplayName 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 txtDisplayName;
/// <summary>
/// valRequireDisplayName 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 valRequireDisplayName;
/// <summary>
/// Localize1 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.Localize Localize1;
/// <summary>
/// manager control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.UserSelector manager;
/// <summary>
/// valManager 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 valManager;
/// <summary>
/// btnCreate 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 btnCreate;
/// <summary>
/// ValidationSummary1 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.ValidationSummary ValidationSummary1;
}
}

View file

@ -0,0 +1,82 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OrganizationSecurityGroupGeneralSettings.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.OrganizationSecurityGroupGeneralSettings" %>
<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %>
<%@ Register Src="UserControls/UsersList.ascx" TagName="UsersList" TagPrefix="wsp"%>
<%@ Register Src="UserControls/UserSelector.ascx" TagName="UserSelector" TagPrefix="wsp" %>
<%@ Register Src="UserControls/SecurityGroupTabs.ascx" TagName="SecurityGroupTabs" TagPrefix="wsp"%>
<%@ Register Src="UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %>
<%@ Register Src="UserControls/Breadcrumb.ascx" TagName="Breadcrumb" TagPrefix="wsp" %>
<%@ Register TagPrefix="wsp" TagName="CollapsiblePanel" Src="../UserControls/CollapsiblePanel.ascx" %>
<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/>
<div id="ExchangeContainer">
<div class="Module">
<div class="Header">
<wsp:Breadcrumb id="breadcrumb" runat="server" PageName="Text.PageName" />
</div>
<div class="Left">
<wsp:Menu id="menu" runat="server" SelectedItem="secur_groups" />
</div>
<div class="Content">
<div class="Center">
<div class="Title">
<asp:Image ID="Image1" SkinID="ExchangeList48" runat="server" />
<asp:Localize ID="locTitle" runat="server" meta:resourcekey="locTitle" Text="Edit Security Group"></asp:Localize>
<asp:Literal ID="litDisplayName" runat="server" Text="John Smith" />
</div>
<div class="FormBody">
<wsp:SecurityGroupTabs id="tabs" runat="server" SelectedTab="secur_group_settings" />
<wsp:SimpleMessageBox id="messageBox" runat="server" />
<table>
<tr>
<td class="FormLabel150"><asp:Localize ID="locDisplayName" runat="server" meta:resourcekey="locDisplayName" Text="Display Name: *"></asp:Localize></td>
<td>
<asp:TextBox ID="txtDisplayName" runat="server" CssClass="HugeTextBox200" ValidationGroup="CreateMailbox"></asp:TextBox>
<asp:RequiredFieldValidator ID="valRequireDisplayName" runat="server" meta:resourcekey="valRequireDisplayName" ControlToValidate="txtDisplayName"
ErrorMessage="Enter Display Name" ValidationGroup="EditList" Display="Dynamic" Text="*" SetFocusOnError="True"></asp:RequiredFieldValidator>
<br />
<br />
</td>
</tr>
<tr>
<td class="FormLabel150"><asp:Localize ID="locManager" runat="server" meta:resourcekey="locManager" Text="Manager:"></asp:Localize></td>
<td>
<wsp:UserSelector id="manager" runat="server" />
<asp:CustomValidator runat="server"
ValidationGroup="EditList" meta:resourcekey="valManager" ID="valManager"
onservervalidate="valManager_ServerValidate" />
</td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td colspan="2"><asp:Localize ID="locMembers" runat="server" meta:resourcekey="locMembers" Text="Members:"></asp:Localize></td>
</tr>
<tr>
<td colspan="2">
<wsp:UsersList id="members" runat="server" />
</td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td class="FormLabel150" colspan="2"><asp:Localize ID="locNotes" runat="server" meta:resourcekey="locNotes" Text="Notes:"></asp:Localize></td>
</tr>
<tr>
<td colspan="2">
<asp:TextBox ID="txtNotes" runat="server" CssClass="TextBox200" Rows="4" TextMode="MultiLine"></asp:TextBox>
</td>
</tr>
</table>
<div class="FormFooterClean">
<asp:Button id="btnSave" runat="server" Text="Save Changes" CssClass="Button1" meta:resourcekey="btnSave" ValidationGroup="EditList" OnClick="btnSave_Click"></asp:Button>
<asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True" ShowSummary="False" ValidationGroup="EditList" />
</div>
</div>
</div>
</div>
</div>
</div>

View file

@ -0,0 +1,130 @@
// 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.
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.EnterpriseServer;
namespace WebsitePanel.Portal.ExchangeServer
{
public partial class OrganizationSecurityGroupGeneralSettings : WebsitePanelModuleBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindSettings();
}
}
private void BindSettings()
{
try
{
// get settings
OrganizationSecurityGroup securityGroup = ES.Services.Organizations.GetSecurityGroupGeneralSettings(
PanelRequest.ItemID, PanelRequest.AccountID);
litDisplayName.Text = PortalAntiXSS.Encode(securityGroup.DisplayName);
// bind form
txtDisplayName.Text = securityGroup.DisplayName;
manager.SetAccount(securityGroup.ManagerAccount);
members.SetAccounts(securityGroup.MembersAccounts);
txtNotes.Text = securityGroup.Notes;
if (securityGroup.IsDefault)
{
txtDisplayName.ReadOnly = true;
txtNotes.ReadOnly = true;
manager.Enabled = false;
members.Enabled = false;
}
}
catch (Exception ex)
{
messageBox.ShowErrorMessage("ORGANIZATION_GET_SECURITY_GROUP_SETTINGS", ex);
}
}
private void SaveSettings()
{
if (!Page.IsValid)
return;
try
{
int result = ES.Services.Organizations.SetSecurityGroupGeneralSettings(
PanelRequest.ItemID,
PanelRequest.AccountID,
txtDisplayName.Text,
manager.GetAccount(),
members.GetAccounts(),
txtNotes.Text);
if (result < 0)
{
messageBox.ShowResultMessage(result);
return;
}
litDisplayName.Text = PortalAntiXSS.Encode(txtDisplayName.Text);
messageBox.ShowSuccessMessage("ORGANIZATION_UPDATE_SECURITY_GROUP_SETTINGS");
}
catch (Exception ex)
{
messageBox.ShowErrorMessage("ORGANIZATION_UPDATE_SECURITY_GROUP_SETTINGS", ex);
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
SaveSettings();
}
protected void valManager_ServerValidate(object source, ServerValidateEventArgs args)
{
args.IsValid = manager.GetAccount() != null;
}
}
}

View file

@ -0,0 +1,195 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal.ExchangeServer {
public partial class OrganizationSecurityGroupGeneralSettings {
/// <summary>
/// asyncTasks control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks;
/// <summary>
/// breadcrumb control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Breadcrumb breadcrumb;
/// <summary>
/// menu control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Menu menu;
/// <summary>
/// Image1 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.Image Image1;
/// <summary>
/// locTitle 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.Localize locTitle;
/// <summary>
/// litDisplayName 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.Literal litDisplayName;
/// <summary>
/// tabs control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.SecurityGroupTabs tabs;
/// <summary>
/// messageBox control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox;
/// <summary>
/// locDisplayName 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.Localize locDisplayName;
/// <summary>
/// txtDisplayName 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 txtDisplayName;
/// <summary>
/// valRequireDisplayName 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 valRequireDisplayName;
/// <summary>
/// locManager 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.Localize locManager;
/// <summary>
/// manager control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.UserSelector manager;
/// <summary>
/// valManager 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 valManager;
/// <summary>
/// locMembers 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.Localize locMembers;
/// <summary>
/// members control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.UsersList members;
/// <summary>
/// locNotes 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.Localize locNotes;
/// <summary>
/// txtNotes 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 txtNotes;
/// <summary>
/// btnSave 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 btnSave;
/// <summary>
/// ValidationSummary1 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.ValidationSummary ValidationSummary1;
}
}

View file

@ -0,0 +1,90 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OrganizationSecurityGroups.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.OrganizationSecurityGroups" %>
<%@ Register Src="../UserControls/SimpleMessageBox.ascx" TagName="SimpleMessageBox" TagPrefix="wsp" %>
<%@ Register Src="UserControls/Menu.ascx" TagName="Menu" TagPrefix="wsp" %>
<%@ Register Src="UserControls/Breadcrumb.ascx" TagName="Breadcrumb" TagPrefix="wsp" %>
<%@ Register Src="../UserControls/EnableAsyncTasksSupport.ascx" TagName="EnableAsyncTasksSupport" TagPrefix="wsp" %>
<wsp:EnableAsyncTasksSupport id="asyncTasks" runat="server"/>
<div id="ExchangeContainer">
<div class="Module">
<div class="Header">
<wsp:Breadcrumb id="breadcrumb" runat="server" PageName="Text.PageName" />
</div>
<div class="Left">
<wsp:Menu id="menu" runat="server" SelectedItem="secur_groups" />
</div>
<div class="Content">
<div class="Center">
<div class="Title">
<asp:Image ID="Image1" SkinID="ExchangeList48" runat="server" />
<asp:Localize ID="locTitle" runat="server" meta:resourcekey="locTitle" Text="Groups"></asp:Localize>
</div>
<div class="FormBody">
<wsp:SimpleMessageBox id="messageBox" runat="server" />
<div class="FormButtonsBarClean">
<div class="FormButtonsBarCleanLeft">
<asp:Button ID="btnCreateGroup" runat="server" meta:resourcekey="btnCreateGroup"
Text="Create New Group" CssClass="Button1" OnClick="btnCreateGroup_Click" />
</div>
<div class="FormButtonsBarCleanRight">
<asp:Panel ID="SearchPanel" runat="server" DefaultButton="cmdSearch">
<asp:Localize ID="locSearch" runat="server" meta:resourcekey="locSearch" Visible="false"></asp:Localize>
<asp:DropDownList ID="ddlPageSize" runat="server" AutoPostBack="True"
onselectedindexchanged="ddlPageSize_SelectedIndexChanged">
<asp:ListItem>10</asp:ListItem>
<asp:ListItem Selected="True">20</asp:ListItem>
<asp:ListItem>50</asp:ListItem>
<asp:ListItem>100</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="ddlSearchColumn" runat="server" CssClass="NormalTextBox">
<asp:ListItem Value="DisplayName" meta:resourcekey="ddlSearchColumnDisplayName">DisplayName</asp:ListItem>
</asp:DropDownList><asp:TextBox ID="txtSearchValue" runat="server" CssClass="NormalTextBox" Width="100"></asp:TextBox><asp:ImageButton ID="cmdSearch" Runat="server" meta:resourcekey="cmdSearch" SkinID="SearchButton"
CausesValidation="false"/>
</asp:Panel>
</div>
</div>
<asp:GridView ID="gvGroups" runat="server" AutoGenerateColumns="False" EnableViewState="true"
Width="100%" EmptyDataText="gvGroups" CssSelectorClass="NormalGridView"
OnRowCommand="gvSecurityGroups_RowCommand" AllowPaging="True" AllowSorting="True"
DataSourceID="odsSecurityGroupsPaged" PageSize="20">
<Columns>
<asp:TemplateField HeaderText="gvGroupsDisplayName" SortExpression="DisplayName">
<ItemStyle Width="50%"></ItemStyle>
<ItemTemplate>
<asp:hyperlink id="lnk1" runat="server"
NavigateUrl='<%# GetListEditUrl(Eval("AccountId").ToString()) %>'>
<%# Eval("DisplayName") %>
</asp:hyperlink>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="cmdDelete" runat="server" Text="Delete" SkinID="ExchangeDelete"
CommandName="DeleteItem" CommandArgument='<%# Eval("AccountId") %>' Visible='<%# IsNotDefault(Eval("AccountType").ToString()) %>'
meta:resourcekey="cmdDelete" OnClientClick="return confirm('Remove this item?');"></asp:ImageButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="odsSecurityGroupsPaged" runat="server" EnablePaging="True"
SelectCountMethod="GetOrganizationSecurityGroupsPagedCount"
SelectMethod="GetOrganizationSecurityGroupsPaged"
SortParameterName="sortColumn"
TypeName="WebsitePanel.Portal.OrganizationsHelper"
OnSelected="odsSecurityGroupsPaged_Selected">
<SelectParameters>
<asp:QueryStringParameter Name="itemId" QueryStringField="ItemID" DefaultValue="0" />
<asp:Parameter Name="accountTypes" DefaultValue="8" />
<asp:ControlParameter Name="filterColumn" ControlID="ddlSearchColumn" PropertyName="SelectedValue" />
<asp:ControlParameter Name="filterValue" ControlID="txtSearchValue" PropertyName="Text" />
</SelectParameters>
</asp:ObjectDataSource>
</div>
</div>
</div>
</div>
</div>

View file

@ -0,0 +1,114 @@
// 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.
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using WebsitePanel.Providers.HostedSolution;
using WebsitePanel.EnterpriseServer;
namespace WebsitePanel.Portal.ExchangeServer
{
public partial class OrganizationSecurityGroups : WebsitePanelModuleBase
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnCreateGroup_Click(object sender, EventArgs e)
{
Response.Redirect(EditUrl("ItemID", PanelRequest.ItemID.ToString(), "create_secur_group",
"SpaceID=" + PanelSecurity.PackageId.ToString()));
}
public string GetListEditUrl(string accountId)
{
return EditUrl("SpaceID", PanelSecurity.PackageId.ToString(), "secur_group_settings",
"AccountID=" + accountId,
"ItemID=" + PanelRequest.ItemID.ToString());
}
public bool IsNotDefault(string accountType)
{
return (ExchangeAccountType)Enum.Parse(typeof(ExchangeAccountType), accountType) != ExchangeAccountType.DefaultSecurityGroup;
}
protected void odsSecurityGroupsPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e)
{
if (e.Exception != null)
{
messageBox.ShowErrorMessage("ORGANIZATION_GET_SECURITY_GROUP", e.Exception);
e.ExceptionHandled = true;
}
}
protected void gvSecurityGroups_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "DeleteItem")
{
// delete security group
int accountId = Utils.ParseInt(e.CommandArgument.ToString(), 0);
try
{
int result = ES.Services.Organizations.DeleteSecurityGroup(PanelRequest.ItemID, accountId);
if (result < 0)
{
messageBox.ShowResultMessage(result);
return;
}
// rebind grid
gvGroups.DataBind();
}
catch (Exception ex)
{
messageBox.ShowErrorMessage("ORGANIZATION_DELETE_SECURITY_GROUP", ex);
}
}
}
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
{
gvGroups.PageSize = Convert.ToInt16(ddlPageSize.SelectedValue);
// rebind grid
gvGroups.DataBind();
}
}
}

View file

@ -0,0 +1,150 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal.ExchangeServer {
public partial class OrganizationSecurityGroups {
/// <summary>
/// asyncTasks control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.EnableAsyncTasksSupport asyncTasks;
/// <summary>
/// breadcrumb control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Breadcrumb breadcrumb;
/// <summary>
/// menu control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.Menu menu;
/// <summary>
/// Image1 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.Image Image1;
/// <summary>
/// locTitle 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.Localize locTitle;
/// <summary>
/// messageBox control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.UserControls.SimpleMessageBox messageBox;
/// <summary>
/// btnCreateGroup 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 btnCreateGroup;
/// <summary>
/// SearchPanel 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.Panel SearchPanel;
/// <summary>
/// locSearch 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.Localize locSearch;
/// <summary>
/// ddlPageSize 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.DropDownList ddlPageSize;
/// <summary>
/// ddlSearchColumn 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.DropDownList ddlSearchColumn;
/// <summary>
/// txtSearchValue 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 txtSearchValue;
/// <summary>
/// cmdSearch 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.ImageButton cmdSearch;
/// <summary>
/// gvGroups 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.GridView gvGroups;
/// <summary>
/// odsSecurityGroupsPaged 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.ObjectDataSource odsSecurityGroupsPaged;
}
}

View file

@ -10,6 +10,7 @@
<%@ Register Src="UserControls/Breadcrumb.ascx" TagName="Breadcrumb" TagPrefix="wsp" %>
<%@ Register Src="UserControls/EmailAddress.ascx" TagName="EmailAddress" TagPrefix="wsp" %>
<%@ Register Src="UserControls/AccountsList.ascx" TagName="AccountsList" TagPrefix="wsp" %>
<%@ Register Src="UserControls/UsersList.ascx" TagName="UsersList" TagPrefix="wsp" %>
@ -42,9 +43,9 @@
<uc1:MailboxTabs ID="MailboxTabsId" runat="server" SelectedTab="user_memberof" />
<wsp:SimpleMessageBox id="messageBox" runat="server" />
<wsp:CollapsiblePanel id="secDistributionLists" runat="server" TargetControlID="DistributionLists" meta:resourcekey="secDistributionLists" Text="Distribution Lists"></wsp:CollapsiblePanel>
<asp:Panel ID="DistributionLists" runat="server" Height="0" style="overflow:hidden;">
<asp:UpdatePanel ID="GeneralUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<wsp:CollapsiblePanel id="secDistributionLists" runat="server" TargetControlID="DistributionListsPanel" meta:resourcekey="secDistributionLists" Text="Distribution Lists"></wsp:CollapsiblePanel>
<asp:Panel ID="DistributionListsPanel" runat="server" Height="0" style="overflow:hidden;">
<asp:UpdatePanel ID="DLGeneralUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<wsp:AccountsList id="distrlists" runat="server"
@ -57,6 +58,20 @@
</asp:UpdatePanel>
</asp:Panel>
<wsp:CollapsiblePanel id="secSecurityGroups" runat="server" TargetControlID="SecurityGroupsPanel" meta:resourcekey="secSecurityGroups" Text="Groups"></wsp:CollapsiblePanel>
<asp:Panel ID="SecurityGroupsPanel" runat="server" Height="0" style="overflow:hidden;">
<asp:UpdatePanel ID="SCGeneralUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<wsp:AccountsList id="securegroups" runat="server"
MailboxesEnabled="false"
EnableMailboxOnly="false"
ContactsEnabled="false"
DistributionListsEnabled="false" />
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
<div class="FormFooterClean">
<asp:Button id="btnSave" runat="server" Text="Save Changes" CssClass="Button1"

View file

@ -62,7 +62,6 @@ namespace WebsitePanel.Portal.HostedSolution
ExchangeAccount[] dLists = ES.Services.ExchangeServer.GetDistributionListsByMember(PanelRequest.ItemID, PanelRequest.AccountID);
distrlists.SetAccounts(dLists);
}
catch (Exception ex)
{

View file

@ -103,22 +103,22 @@ namespace WebsitePanel.Portal.HostedSolution {
protected global::WebsitePanel.Portal.CollapsiblePanel secDistributionLists;
/// <summary>
/// DistributionLists control.
/// DistributionListsPanel 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.Panel DistributionLists;
protected global::System.Web.UI.WebControls.Panel DistributionListsPanel;
/// <summary>
/// GeneralUpdatePanel control.
/// DLGeneralUpdatePanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel GeneralUpdatePanel;
protected global::System.Web.UI.UpdatePanel DLGeneralUpdatePanel;
/// <summary>
/// distrlists control.
@ -129,6 +129,42 @@ namespace WebsitePanel.Portal.HostedSolution {
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.AccountsList distrlists;
/// <summary>
/// secSecurityGroups control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.CollapsiblePanel secSecurityGroups;
/// <summary>
/// SecurityGroupsPanel 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.Panel SecurityGroupsPanel;
/// <summary>
/// SCGeneralUpdatePanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel SCGeneralUpdatePanel;
/// <summary>
/// securegroups control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::WebsitePanel.Portal.ExchangeServer.UserControls.AccountsList securegroups;
/// <summary>
/// btnSave control.
/// </summary>

View file

@ -201,4 +201,7 @@
<data name="Text.LyncFederationDomains" xml:space="preserve">
<value>Lync Federation Domains</value>
</data>
<data name="Text.SecurityGroups" xml:space="preserve">
<value>Groups</value>
</data>
</root>

View file

@ -0,0 +1,135 @@
<?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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Tab.Addresses" xml:space="preserve">
<value>E-mail Addresses</value>
</data>
<data name="Tab.Mailflow" xml:space="preserve">
<value>Mail Flow Settings</value>
</data>
<data name="Tab.Settings" xml:space="preserve">
<value>General</value>
</data>
<data name="Tab.Permissions" xml:space="preserve">
<value>Permissions</value>
</data>
<data name="Tab.MemberOf" xml:space="preserve">
<value>Member Of</value>
</data>
</root>

View file

@ -0,0 +1,171 @@
<?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="btnAdd.Text" xml:space="preserve">
<value>Add...</value>
</data>
<data name="btnAddSelected.Text" xml:space="preserve">
<value>Add Accounts</value>
</data>
<data name="btnCancel.Text" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="btnDelete.Text" xml:space="preserve">
<value>Delete</value>
</data>
<data name="chkIncludeContacts.Text" xml:space="preserve">
<value>Contacts</value>
</data>
<data name="chkIncludeEquipment.Text" xml:space="preserve">
<value>Equipment</value>
</data>
<data name="chkIncludeLists.Text" xml:space="preserve">
<value>Distribution Lists</value>
</data>
<data name="chkIncludeMailboxes.Text" xml:space="preserve">
<value>Mailboxes</value>
</data>
<data name="chkIncludeRooms.Text" xml:space="preserve">
<value>Rooms</value>
</data>
<data name="ddlSearchColumnDisplayName.Text" xml:space="preserve">
<value>Display Name</value>
</data>
<data name="ddlSearchColumnEmail.Text" xml:space="preserve">
<value>E-mail Address</value>
</data>
<data name="gvAccounts.EmptyDataText" xml:space="preserve">
<value>The list of accounts is empty. Click "Add..." button to add accounts.</value>
</data>
<data name="gvAccountsDisplayName.HeaderText" xml:space="preserve">
<value>Display Name</value>
</data>
<data name="gvAccountsEmail.HeaderText" xml:space="preserve">
<value>E-mail Address</value>
</data>
<data name="gvPopupAccounts.EmptyDataText" xml:space="preserve">
<value>No accounts found.</value>
</data>
<data name="headerAddAccounts.Text" xml:space="preserve">
<value>Organization Users</value>
</data>
<data name="locIncludeSearch.Text" xml:space="preserve">
<value>Include in search:</value>
</data>
</root>

View file

@ -178,6 +178,9 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
if (Utils.CheckQouta(Quotas.ORGANIZATION_USERS, cntx))
organizationGroup.MenuItems.Add(CreateMenuItem("Users", "users"));
if (Utils.CheckQouta(Quotas.ORGANIZATION_SECURITYGROUPMANAGEMENT, cntx))
organizationGroup.MenuItems.Add(CreateMenuItem("SecurityGroups", "secur_groups"));
if (organizationGroup.MenuItems.Count > 0)
groups.Add(organizationGroup);
}

View file

@ -0,0 +1,24 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SecurityGroupTabs.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.UserControls.SecurityGroupTabs" %>
<table width="100%" cellpadding="0" cellspacing="1">
<tr>
<td class="Tabs">
&nbsp;&nbsp;
<asp:DataList ID="dlTabs" runat="server" RepeatDirection="Horizontal"
RepeatLayout="Flow" EnableViewState="false">
<ItemStyle Wrap="False" />
<ItemTemplate>
<asp:HyperLink ID="lnkTab" runat="server" CssClass="Tab" NavigateUrl='<%# Eval("Url") %>'>
<%# Eval("Name") %>
</asp:HyperLink>
</ItemTemplate>
<SelectedItemStyle Wrap="False" />
<SelectedItemTemplate>
<asp:HyperLink ID="lnkSelTab" runat="server" CssClass="ActiveTab" NavigateUrl='<%# Eval("Url") %>'>
<%# Eval("Name") %>
</asp:HyperLink>
</SelectedItemTemplate>
</asp:DataList>
</td>
</tr>
</table>
<br />

View file

@ -0,0 +1,81 @@
// 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.
using System;
using System.Collections.Generic;
using WebsitePanel.Portal.Code.UserControls;
using WebsitePanel.WebPortal;
using WebsitePanel.EnterpriseServer;
namespace WebsitePanel.Portal.ExchangeServer.UserControls
{
public partial class SecurityGroupTabs : WebsitePanelControlBase
{
private string selectedTab;
public string SelectedTab
{
get { return selectedTab; }
set { selectedTab = value; }
}
protected void Page_Load(object sender, EventArgs e)
{
BindTabs();
}
private void BindTabs()
{
List<Tab> tabsList = new List<Tab>();
tabsList.Add(CreateTab("secur_group_settings", "Tab.Settings"));
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
// find selected menu item
int idx = 0;
foreach (Tab tab in tabsList)
{
if (String.Compare(tab.Id, SelectedTab, true) == 0)
break;
idx++;
}
dlTabs.SelectedIndex = idx;
dlTabs.DataSource = tabsList;
dlTabs.DataBind();
}
private Tab CreateTab(string id, string text)
{
return new Tab(id, GetLocalizedString(text),
HostModule.EditUrl("AccountID", PanelRequest.AccountID.ToString(), id,
"SpaceID=" + PanelSecurity.PackageId.ToString(),
"ItemID=" + PanelRequest.ItemID.ToString()));
}
}
}

View file

@ -0,0 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal.ExchangeServer.UserControls {
public partial class SecurityGroupTabs {
/// <summary>
/// dlTabs 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.DataList dlTabs;
}
}

View file

@ -4,8 +4,10 @@
<ContentTemplate>
<asp:TextBox ID="txtDisplayName" runat="server" CssClass="TextBox200" ReadOnly="true"></asp:TextBox>
<% if (Enabled) { %>
<asp:ImageButton ID="ImageButton1" SkinID="ExchangeAddressBook16" runat="server" CausesValidation="false" OnClick="ImageButton1_Click" />
<asp:LinkButton ID="cmdClear" runat="server" meta:resourcekey="cmdClear" OnClick="cmdClear_Click" CausesValidation="False"></asp:LinkButton>
<% } %>
<asp:Panel ID="AddAccountsPanel" runat="server" CssClass="Popup" style="display:none">
<table class="Popup-Header" cellpadding="0" cellspacing="0">

View file

@ -38,6 +38,14 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
{
public const string DirectionString = "DirectionString";
private bool _enabled = true;
public bool Enabled
{
get { return _enabled; }
set { _enabled = value; }
}
public bool IncludeMailboxes
{
get

View file

@ -59,7 +59,7 @@ namespace WebsitePanel.Portal.ExchangeServer.UserControls
PackageContext cntx = PackagesHelper.GetCachedPackageContext(PanelSecurity.PackageId);
if (Utils.CheckQouta(Quotas.EXCHANGE2007_DISTRIBUTIONLISTS, cntx))
if (Utils.CheckQouta(Quotas.ORGANIZATION_SECURITYGROUPMANAGEMENT, cntx) || Utils.CheckQouta(Quotas.EXCHANGE2007_DISTRIBUTIONLISTS, cntx))
tabsList.Add(CreateTab("user_memberof", "Tab.MemberOf"));
// find selected menu item

View file

@ -0,0 +1,119 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UsersList.ascx.cs" Inherits="WebsitePanel.Portal.ExchangeServer.UserControls.UsersList" %>
<%@ Register Src="../../UserControls/PopupHeader.ascx" TagName="PopupHeader" TagPrefix="wsp" %>
<asp:UpdatePanel ID="AccountsUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<div class="FormButtonsBarClean">
<asp:Button ID="btnAdd" runat="server" Text="Add..." CssClass="Button1" OnClick="btnAdd_Click" meta:resourcekey="btnAdd" />
<asp:Button ID="btnDelete" runat="server" Text="Delete" CssClass="Button1" OnClick="btnDelete_Click" meta:resourcekey="btnDelete"/>
</div>
<asp:GridView ID="gvAccounts" runat="server" meta:resourcekey="gvAccounts" AutoGenerateColumns="False"
Width="600px" CssSelectorClass="NormalGridView"
DataKeyNames="AccountName">
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="chkSelectAll" runat="server" onclick="javascript:SelectAllCheckboxes(this);" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" />
<asp:Literal ID="litAccountType" runat="server" Visible="false" Text='<%# Eval("AccountType") %>'></asp:Literal>
</ItemTemplate>
<ItemStyle Width="10px" />
</asp:TemplateField>
<asp:TemplateField meta:resourcekey="gvAccountsDisplayName" HeaderText="gvAccountsDisplayName">
<HeaderStyle Wrap="false" />
<ItemStyle Width="50%" Wrap="false"></ItemStyle>
<ItemTemplate>
<asp:Image ID="img1" runat="server" ImageUrl='<%# GetAccountImage((int)Eval("AccountType")) %>' ImageAlign="AbsMiddle" />
<asp:Literal ID="litDisplayName" runat="server" Text='<%# Eval("DisplayName") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField meta:resourcekey="gvAccountsEmail" HeaderText="gvAccountsEmail">
<HeaderStyle Wrap="false" />
<ItemStyle Width="50%" Wrap="false"></ItemStyle>
<ItemTemplate>
<asp:Literal ID="litPrimaryEmailAddress" runat="server" Text='<%# Eval("PrimaryEmailAddress") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Panel ID="AddAccountsPanel" runat="server" CssClass="Popup" style="display:none">
<table class="Popup-Header" cellpadding="0" cellspacing="0">
<tr>
<td class="Popup-HeaderLeft"></td>
<td class="Popup-HeaderTitle">
<asp:Localize ID="headerAddAccounts" runat="server" meta:resourcekey="headerAddAccounts"></asp:Localize>
</td>
<td class="Popup-HeaderRight"></td>
</tr>
</table>
<div class="Popup-Content">
<div class="Popup-Body">
<br />
<asp:UpdatePanel ID="AddAccountsUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<div class="FormButtonsBarClean">
<div class="FormButtonsBarCleanRight">
<asp:Panel ID="SearchPanel" runat="server" DefaultButton="cmdSearch">
<asp:DropDownList ID="ddlSearchColumn" runat="server" CssClass="NormalTextBox">
<asp:ListItem Value="DisplayName" meta:resourcekey="ddlSearchColumnDisplayName">DisplayName</asp:ListItem>
<asp:ListItem Value="PrimaryEmailAddress" meta:resourcekey="ddlSearchColumnEmail">Email</asp:ListItem>
</asp:DropDownList><asp:TextBox ID="txtSearchValue" runat="server" CssClass="NormalTextBox" Width="100"></asp:TextBox><asp:ImageButton ID="cmdSearch" Runat="server" meta:resourcekey="cmdSearch" SkinID="SearchButton"
CausesValidation="false" OnClick="cmdSearch_Click"/>
</asp:Panel>
</div>
</div>
<div class="Popup-Scroll">
<asp:GridView ID="gvPopupAccounts" runat="server" meta:resourcekey="gvPopupAccounts" AutoGenerateColumns="False"
Width="100%" CssSelectorClass="NormalGridView"
DataKeyNames="AccountName">
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="chkSelectAll" runat="server" onclick="javascript:SelectAllCheckboxes(this);" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" />
<asp:Literal ID="litAccountType" runat="server" Visible="false" Text='<%# Eval("AccountType") %>'></asp:Literal>
</ItemTemplate>
<ItemStyle Width="10px" />
</asp:TemplateField>
<asp:TemplateField meta:resourcekey="gvAccountsDisplayName">
<ItemStyle Width="50%"></ItemStyle>
<ItemTemplate>
<asp:Image ID="img1" runat="server" ImageUrl='<%# GetAccountImage((int)Eval("AccountType")) %>' ImageAlign="AbsMiddle" />
<asp:Literal ID="litDisplayName" runat="server" Text='<%# Eval("DisplayName") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField meta:resourcekey="gvAccountsEmail">
<ItemStyle Width="50%"></ItemStyle>
<ItemTemplate>
<asp:Literal ID="litPrimaryEmailAddress" runat="server" Text='<%# Eval("PrimaryEmailAddress") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<br />
</div>
<div class="FormFooter">
<asp:Button ID="btnAddSelected" runat="server" CssClass="Button1" meta:resourcekey="btnAddSelected" Text="Add Accounts" OnClick="btnAddSelected_Click" />
<asp:Button ID="btnCancelAdd" runat="server" CssClass="Button1" meta:resourcekey="btnCancel" Text="Cancel" CausesValidation="false" />
</div>
</div>
</asp:Panel>
<asp:Button ID="btnAddAccountsFake" runat="server" style="display:none;" />
<ajaxToolkit:ModalPopupExtender ID="AddAccountsModal" runat="server"
TargetControlID="btnAddAccountsFake" PopupControlID="AddAccountsPanel"
BackgroundCssClass="modalBackground" DropShadow="false" CancelControlID="btnCancelAdd" />
</ContentTemplate>
</asp:UpdatePanel>

View file

@ -0,0 +1,355 @@
// 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.
using System;
using System.Collections.Generic;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebsitePanel.Providers.HostedSolution;
namespace WebsitePanel.Portal.ExchangeServer.UserControls
{
public partial class UsersList : WebsitePanelControlBase
{
public const string DirectionString = "DirectionString";
private bool _enabled = true;
public bool Enabled
{
get { return _enabled; }
set { _enabled = value; }
}
private enum SelectedState
{
All,
Selected,
Unselected
}
public bool IncludeMailboxes
{
get
{
object ret = ViewState["IncludeMailboxes"];
return (ret != null) ? (bool)ret : false;
}
set
{
ViewState["IncludeMailboxes"] = value;
}
}
public bool IncludeMailboxesOnly
{
get
{
object ret = ViewState["IncludeMailboxesOnly"];
return (ret != null) ? (bool)ret : false;
}
set
{
ViewState["IncludeMailboxesOnly"] = value;
}
}
public bool ExcludeOCSUsers
{
get
{
object ret = ViewState["ExcludeOCSUsers"];
return (ret != null) ? (bool)ret : false;
}
set
{
ViewState["ExcludeOCSUsers"] = value;
}
}
public bool ExcludeLyncUsers
{
get
{
object ret = ViewState["ExcludeLyncUsers"];
return (ret != null) ? (bool)ret : false;
}
set
{
ViewState["ExcludeLyncUsers"] = value;
}
}
public bool ExcludeBESUsers
{
get
{
object ret = ViewState["ExcludeBESUsers"];
return (ret != null) ? (bool)ret : false;
}
set
{
ViewState["ExcludeBESUsers"] = value;
}
}
public int ExcludeAccountId
{
get { return PanelRequest.AccountID; }
}
public void SetAccounts(OrganizationUser[] accounts)
{
BindAccounts(accounts, false);
}
public string[] GetAccounts()
{
// get selected accounts
List<OrganizationUser> selectedAccounts = GetGridViewAccounts(gvAccounts, SelectedState.All);
List<string> accountNames = new List<string>();
foreach (OrganizationUser account in selectedAccounts)
accountNames.Add(account.AccountName);
return accountNames.ToArray();
}
protected void Page_Load(object sender, EventArgs e)
{
// register javascript
if (!Page.ClientScript.IsClientScriptBlockRegistered("SelectAllCheckboxes"))
{
string script = @" function SelectAllCheckboxes(box)
{
var state = box.checked;
var elm = box.parentElement.parentElement.parentElement.parentElement.getElementsByTagName(""INPUT"");
for(i = 0; i < elm.length; i++)
if(elm[i].type == ""checkbox"" && elm[i].id != box.id && elm[i].checked != state && !elm[i].disabled)
elm[i].checked = state;
}";
Page.ClientScript.RegisterClientScriptBlock(typeof(AccountsList), "SelectAllCheckboxes",
script, true);
}
btnAdd.Visible = Enabled;
btnDelete.Visible = Enabled;
gvAccounts.Columns[0].Visible = Enabled;
}
protected void btnAdd_Click(object sender, EventArgs e)
{
// bind all accounts
BindPopupAccounts();
// show modal
AddAccountsModal.Show();
}
protected void btnDelete_Click(object sender, EventArgs e)
{
// get selected accounts
List<OrganizationUser> selectedAccounts = GetGridViewAccounts(gvAccounts, SelectedState.Unselected);
// add to the main list
BindAccounts(selectedAccounts.ToArray(), false);
}
protected void btnAddSelected_Click(object sender, EventArgs e)
{
// get selected accounts
List<OrganizationUser> selectedAccounts = GetGridViewAccounts(gvPopupAccounts, SelectedState.Selected);
// add to the main list
BindAccounts(selectedAccounts.ToArray(), true);
}
public string GetAccountImage(int accountTypeId)
{
string imgName = string.Empty;
ExchangeAccountType accountType = (ExchangeAccountType)accountTypeId;
switch (accountType)
{
case ExchangeAccountType.Room:
imgName = "room_16.gif";
break;
case ExchangeAccountType.Equipment:
imgName = "equipment_16.gif";
break;
default:
imgName = "admin_16.png";
break;
}
return GetThemedImage("Exchange/" + imgName);
}
private void BindPopupAccounts()
{
OrganizationUser[] accounts = ES.Services.Organizations.SearchAccounts(PanelRequest.ItemID,
ddlSearchColumn.SelectedValue, txtSearchValue.Text + "%", "", IncludeMailboxes);
if (ExcludeAccountId > 0)
{
List<OrganizationUser> updatedAccounts = new List<OrganizationUser>();
foreach (OrganizationUser account in accounts)
if (account.AccountId != ExcludeAccountId)
updatedAccounts.Add(account);
accounts = updatedAccounts.ToArray();
}
if (IncludeMailboxesOnly)
{
List<OrganizationUser> updatedAccounts = new List<OrganizationUser>();
foreach (OrganizationUser account in accounts)
{
bool addUser = false;
if (account.ExternalEmail != string.Empty) addUser = true;
if ((account.IsBlackBerryUser) & (ExcludeBESUsers)) addUser = false;
if ((account.IsLyncUser) & (ExcludeLyncUsers)) addUser = false;
if (addUser) updatedAccounts.Add(account);
}
accounts = updatedAccounts.ToArray();
}
else
if ((ExcludeOCSUsers) | (ExcludeBESUsers) | (ExcludeLyncUsers))
{
List<OrganizationUser> updatedAccounts = new List<OrganizationUser>();
foreach (OrganizationUser account in accounts)
{
bool addUser = true;
if ((account.IsOCSUser) & (ExcludeOCSUsers)) addUser = false;
if ((account.IsLyncUser) & (ExcludeLyncUsers)) addUser = false;
if ((account.IsBlackBerryUser) & (ExcludeBESUsers)) addUser = false;
if (addUser) updatedAccounts.Add(account);
}
accounts = updatedAccounts.ToArray();
}
Array.Sort(accounts, CompareAccount);
if (Direction == SortDirection.Ascending)
{
Array.Reverse(accounts);
Direction = SortDirection.Descending;
}
else
Direction = SortDirection.Ascending;
gvPopupAccounts.DataSource = accounts;
gvPopupAccounts.DataBind();
}
private void BindAccounts(OrganizationUser[] newAccounts, bool preserveExisting)
{
// get binded addresses
List<OrganizationUser> accounts = new List<OrganizationUser>();
if(preserveExisting)
accounts.AddRange(GetGridViewAccounts(gvAccounts, SelectedState.All));
// add new accounts
if (newAccounts != null)
{
foreach (OrganizationUser newAccount in newAccounts)
{
// check if exists
bool exists = false;
foreach (OrganizationUser account in accounts)
{
if (String.Compare(newAccount.AccountName, account.AccountName, true) == 0)
{
exists = true;
break;
}
}
if (exists)
continue;
accounts.Add(newAccount);
}
}
gvAccounts.DataSource = accounts;
gvAccounts.DataBind();
btnDelete.Visible = gvAccounts.Rows.Count > 0;
}
private List<OrganizationUser> GetGridViewAccounts(GridView gv, SelectedState state)
{
List<OrganizationUser> accounts = new List<OrganizationUser>();
for (int i = 0; i < gv.Rows.Count; i++)
{
GridViewRow row = gv.Rows[i];
CheckBox chkSelect = (CheckBox)row.FindControl("chkSelect");
if (chkSelect == null)
continue;
OrganizationUser account = new OrganizationUser();
account.AccountType = (ExchangeAccountType)Enum.Parse(typeof(ExchangeAccountType), ((Literal)row.FindControl("litAccountType")).Text);
account.AccountName = (string)gv.DataKeys[i][0];
account.DisplayName = ((Literal)row.FindControl("litDisplayName")).Text;
account.PrimaryEmailAddress = ((Literal)row.FindControl("litPrimaryEmailAddress")).Text;
if(state == SelectedState.All ||
(state == SelectedState.Selected && chkSelect.Checked) ||
(state == SelectedState.Unselected && !chkSelect.Checked))
accounts.Add(account);
}
return accounts;
}
protected void cmdSearch_Click(object sender, ImageClickEventArgs e)
{
BindPopupAccounts();
}
private SortDirection Direction
{
get { return ViewState[DirectionString] == null ? SortDirection.Descending : (SortDirection)ViewState[DirectionString]; }
set { ViewState[DirectionString] = value; }
}
private static int CompareAccount(OrganizationUser user1, OrganizationUser user2)
{
return string.Compare(user1.DisplayName, user2.DisplayName);
}
}
}

View file

@ -0,0 +1,159 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.Portal.ExchangeServer.UserControls {
public partial class UsersList {
/// <summary>
/// AccountsUpdatePanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel AccountsUpdatePanel;
/// <summary>
/// btnAdd 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 btnAdd;
/// <summary>
/// btnDelete 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 btnDelete;
/// <summary>
/// gvAccounts 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.GridView gvAccounts;
/// <summary>
/// AddAccountsPanel 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.Panel AddAccountsPanel;
/// <summary>
/// headerAddAccounts 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.Localize headerAddAccounts;
/// <summary>
/// AddAccountsUpdatePanel control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel AddAccountsUpdatePanel;
/// <summary>
/// SearchPanel 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.Panel SearchPanel;
/// <summary>
/// ddlSearchColumn 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.DropDownList ddlSearchColumn;
/// <summary>
/// txtSearchValue 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 txtSearchValue;
/// <summary>
/// cmdSearch 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.ImageButton cmdSearch;
/// <summary>
/// gvPopupAccounts 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.GridView gvPopupAccounts;
/// <summary>
/// btnAddSelected 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 btnAddSelected;
/// <summary>
/// btnCancelAdd 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 btnCancelAdd;
/// <summary>
/// btnAddAccountsFake 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 btnAddAccountsFake;
/// <summary>
/// AddAccountsModal control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::AjaxControlToolkit.ModalPopupExtender AddAccountsModal;
}
}

View file

@ -230,6 +230,13 @@
<Compile Include="ExchangeServer\OrganizationAddDomainName.ascx.designer.cs">
<DependentUpon>OrganizationAddDomainName.ascx</DependentUpon>
</Compile>
<Compile Include="ExchangeServer\OrganizationCreateSecurityGroup.ascx.cs">
<SubType>ASPXCodeBehind</SubType>
<DependentUpon>OrganizationCreateSecurityGroup.ascx</DependentUpon>
</Compile>
<Compile Include="ExchangeServer\OrganizationCreateSecurityGroup.ascx.designer.cs">
<DependentUpon>OrganizationCreateSecurityGroup.ascx</DependentUpon>
</Compile>
<Compile Include="ExchangeServer\OrganizationDomainNames.ascx.cs">
<DependentUpon>OrganizationDomainNames.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@ -251,6 +258,20 @@
<Compile Include="ExchangeServer\ExchangeMailboxPlans.ascx.designer.cs">
<DependentUpon>ExchangeMailboxPlans.ascx</DependentUpon>
</Compile>
<Compile Include="ExchangeServer\OrganizationSecurityGroupGeneralSettings.ascx.cs">
<SubType>ASPXCodeBehind</SubType>
<DependentUpon>OrganizationSecurityGroupGeneralSettings.ascx</DependentUpon>
</Compile>
<Compile Include="ExchangeServer\OrganizationSecurityGroupGeneralSettings.ascx.designer.cs">
<DependentUpon>OrganizationSecurityGroupGeneralSettings.ascx</DependentUpon>
</Compile>
<Compile Include="ExchangeServer\OrganizationSecurityGroups.ascx.cs">
<SubType>ASPXCodeBehind</SubType>
<DependentUpon>OrganizationSecurityGroups.ascx</DependentUpon>
</Compile>
<Compile Include="ExchangeServer\OrganizationSecurityGroups.ascx.designer.cs">
<DependentUpon>OrganizationSecurityGroups.ascx</DependentUpon>
</Compile>
<Compile Include="ExchangeServer\OrganizationUserMemberOf.ascx.cs">
<DependentUpon>OrganizationUserMemberOf.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@ -269,6 +290,20 @@
<Compile Include="ExchangeServer\UserControls\MailboxPlanSelector.ascx.designer.cs">
<DependentUpon>MailboxPlanSelector.ascx</DependentUpon>
</Compile>
<Compile Include="ExchangeServer\UserControls\SecurityGroupTabs.ascx.cs">
<DependentUpon>SecurityGroupTabs.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="ExchangeServer\UserControls\SecurityGroupTabs.ascx.designer.cs">
<DependentUpon>SecurityGroupTabs.ascx</DependentUpon>
</Compile>
<Compile Include="ExchangeServer\UserControls\UsersList.ascx.cs">
<SubType>ASPXCodeBehind</SubType>
<DependentUpon>UsersList.ascx</DependentUpon>
</Compile>
<Compile Include="ExchangeServer\UserControls\UsersList.ascx.designer.cs">
<DependentUpon>UsersList.ascx</DependentUpon>
</Compile>
<Compile Include="ExchangeServer\UserControls\UserTabs.ascx.cs">
<DependentUpon>UserTabs.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@ -360,13 +395,6 @@
<Compile Include="ProviderControls\CRM2011_Settings.ascx.designer.cs">
<DependentUpon>CRM2011_Settings.ascx</DependentUpon>
</Compile>
<Compile Include="ProviderControls\EnterpriseStorage_Settings.ascx.cs">
<DependentUpon>EnterpriseStorage_Settings.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="ProviderControls\EnterpriseStorage_Settings.ascx.designer.cs">
<DependentUpon>EnterpriseStorage_Settings.ascx</DependentUpon>
</Compile>
<Compile Include="ProviderControls\HeliconZoo_Settings.ascx.cs">
<DependentUpon>HeliconZoo_Settings.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@ -3941,14 +3969,18 @@
<Content Include="ExchangeServer\ExchangeDistributionListMemberOf.ascx" />
<Content Include="ExchangeServer\ExchangeMailboxMemberOf.ascx" />
<Content Include="ExchangeServer\OrganizationAddDomainName.ascx" />
<Content Include="ExchangeServer\OrganizationCreateSecurityGroup.ascx" />
<Content Include="ExchangeServer\OrganizationDomainNames.ascx" />
<Content Include="ExchangeServer\ExchangeAddMailboxPlan.ascx" />
<Content Include="ExchangeServer\ExchangeDisclaimers.ascx" />
<Content Include="ExchangeServer\ExchangeDisclaimerGeneralSettings.ascx" />
<Content Include="ExchangeServer\OrganizationSecurityGroupGeneralSettings.ascx" />
<Content Include="ExchangeServer\OrganizationSecurityGroups.ascx" />
<Content Include="ExchangeServer\OrganizationUserMemberOf.ascx" />
<Content Include="ExchangeServer\UserControls\SecurityGroupTabs.ascx" />
<Content Include="ExchangeServer\UserControls\UsersList.ascx" />
<Content Include="Lync\UserControls\LyncUserSettings.ascx" />
<Content Include="ProviderControls\CRM2011_Settings.ascx" />
<Content Include="ProviderControls\EnterpriseStorage_Settings.ascx" />
<Content Include="ProviderControls\HeliconZoo_Settings.ascx" />
<Content Include="ServersEditWebPlatformInstaller.ascx" />
<Content Include="ExchangeServer\ExchangeMailboxPlans.ascx" />
@ -5151,7 +5183,12 @@
<Content Include="App_LocalResources\PhoneNumbers.ascx.resx" />
<Content Include="App_LocalResources\PhoneNumbersAddPhoneNumber.ascx.resx" />
<Content Include="App_LocalResources\PhoneNumbersEditPhoneNumber.ascx.resx" />
<Content Include="ProviderControls\App_LocalResources\EnterpriseStorage_Settings.ascx.resx" />
<Content Include="ExchangeServer\App_LocalResources\OrganizationCreateSecurityGroup.ascx.resx" />
<Content Include="ExchangeServer\App_LocalResources\OrganizationSecurityGroupGeneralSettings.ascx.resx" />
<Content Include="ExchangeServer\App_LocalResources\OrganizationSecurityGroups.ascx.resx" />
<Content Include="ExchangeServer\UserControls\App_LocalResources\AccountsListWithPermissions.ascx.resx" />
<Content Include="ExchangeServer\UserControls\App_LocalResources\SecurityGroupTabs.ascx.resx" />
<Content Include="ExchangeServer\UserControls\App_LocalResources\UsersList.ascx.resx" />
<EmbeddedResource Include="UserControls\App_LocalResources\EditDomainsList.ascx.resx">
<SubType>Designer</SubType>
</EmbeddedResource>