internal RecipientRow GetOwnedDistributionGroup(string identity) { RecipientRow result = null; if (RbacPrincipal.Current.ExecutingUserId != null) { Identity identity2 = new Identity(identity, identity); PSCommand pscommand = new PSCommand().AddCommand("Get-Recipient"); string distinguishedName = RbacPrincipal.Current.ExecutingUserId.DistinguishedName; string value = string.Format("ManagedBy -eq '{0}'", distinguishedName.Replace("'", "''")); pscommand.AddParameter("Filter", value); PowerShellResults <RecipientRow> @object = base.GetObject <RecipientRow>(pscommand, identity2); if (@object.SucceededWithValue) { result = @object.Value; } } return(result); }
private void AddEditGroupLink(string groupId) { if (RbacPrincipal.Current.IsInRole("Get-DistributionGroup@R:MyDistributionGroups+Get-Group@R:MyDistributionGroups") && RbacPrincipal.Current.IsInRole("Get-Recipient?Identity&Filter@R:MyDistributionGroups")) { RecipientTrackingDetails recipientTrackingDetails = new RecipientTrackingDetails(); RecipientRow ownedDistributionGroup = recipientTrackingDetails.GetOwnedDistributionGroup(groupId); if (ownedDistributionGroup != null) { Literal literal = new Literal(); literal.Text = "<br />"; this.deliveryReportDetailsPane.Controls.Add(literal); string arg = "BuildCenteredWindowFeatureString(600, 540, GlobalVariables.FeaturesForPopups)"; HtmlAnchor htmlAnchor = new HtmlAnchor(); htmlAnchor.HRef = "~/MyGroups/EditDistributionGroup.aspx?id=" + ownedDistributionGroup.Identity.RawIdentity; htmlAnchor.Target = "editGroups"; htmlAnchor.Attributes.Add("onclick", string.Format("PopupWindowManager.OpenWindow('{0}', '{1}', {2});return false;", base.ResolveClientUrl(htmlAnchor.HRef), "editGroups", arg)); htmlAnchor.Title = OwaOptionStrings.EditGroups; htmlAnchor.InnerText = OwaOptionStrings.EditGroups; this.deliveryReportDetailsPane.Controls.Add(htmlAnchor); } } }