protected override void OnLoad(EventArgs e) { string text = null; if (this.MicroEditPanel != null) { text = this.MicroEditPanel.Roles; } bool flag = string.IsNullOrEmpty(text) || LoginUtil.IsInRoles(this.Context.User, text.Split(new char[] { ',' })); List <ColumnHeader> list = base.Columns.FindAll((ColumnHeader x) => x is MicroEditColumnHeader); if (this.MicroEditPanel == null || !flag) { list.ForEach(delegate(ColumnHeader x) { base.Columns.Remove(x); }); } else if (list.Count <ColumnHeader>() == 0) { base.Columns.Add(new MicroEditColumnHeader()); } if (this.MicroEditPanel != null && this.MicroEditPanel.ServiceUrl == null) { this.MicroEditPanel.ServiceUrl = base.ServiceUrl; } base.OnLoad(e); }
public static bool IsAccessibleToUser(this ListItem listItem, IPrincipal user) { string text = listItem.Attributes["Roles"]; return(string.IsNullOrEmpty(text) || LoginUtil.IsInRoles(user, text.Split(new char[] { ',' }))); }
protected override void CreateChildControls() { this.hasButton = (this.PickerRoles == null || LoginUtil.IsInRoles(this.Context.User, this.PickerRoles)); if (this.hasButton) { this.CreateChildControlsWithButton(); return; } this.CreateChildControlsWithoutButton(); }
protected override ScriptControlDescriptor GetScriptDescriptor() { ScriptControlDescriptor scriptDescriptor = base.GetScriptDescriptor(); scriptDescriptor.Type = "SubscriptionResultWizardStep"; scriptDescriptor.AddProperty("FailedHelpLink", HelpUtil.BuildEhcHref(OptionsHelpId.AutoProvisionFailed.ToString())); scriptDescriptor.AddProperty("NewPopAccessible", LoginUtil.CheckUrlAccess("NewPopSubscription.aspx")); scriptDescriptor.AddProperty("NewImapAccessible", LoginUtil.CheckUrlAccess("NewImapSubscription.aspx")); return(scriptDescriptor); }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); if (string.IsNullOrEmpty(this.SourceID)) { throw new InvalidOperationException("DetailsPane requires the SourceID parameter to be set"); } Control control = this.NamingContainer.FindControl(this.SourceID); if (control != null) { ListView listView = control as ListView; if (listView != null) { this.ListViewID = listView.ClientID; } else { EcpCollectionEditor ecpCollectionEditor = control as EcpCollectionEditor; if (ecpCollectionEditor != null) { this.ListViewID = ecpCollectionEditor.ListViewID; } } } if (string.IsNullOrEmpty(this.ListViewID)) { throw new InvalidOperationException(string.Format("Cannot find control that corresponds to SourceID '{0}' passed to the details pane with ID '{1}'. ", this.SourceID, this.ID)); } if (string.IsNullOrEmpty(this.BaseUrl)) { throw new InvalidOperationException("DetailsPane requires the BaseUrl property to be set"); } this.BaseUrl = base.ResolveClientUrl(this.BaseUrl); if (string.IsNullOrEmpty(this.FrameTitle)) { throw new InvalidOperationException("DetailsPane requires the FrameTitle property to be set, otherwise there is accessibility issue for screen readers."); } if (this.TypeMappings.Count != 0) { foreach (TypeMapping typeMapping in this.TypeMappings) { if (string.IsNullOrWhiteSpace(typeMapping.BaseUrl)) { throw new InvalidOperationException("BaseUrl in TypeMappings property cannot be empty string"); } typeMapping.BaseUrl = base.ResolveClientUrl(typeMapping.BaseUrl); if (typeMapping.InRole == null) { typeMapping.InRole = new bool?(LoginUtil.CheckUrlAccess(typeMapping.BaseUrl)); } } } }
protected override void OnPreRender(EventArgs e) { if (!string.IsNullOrEmpty(this.NavigationUrl)) { string path = base.TargetControl.ResolveClientUrl(this.NavigationUrl); if (!LoginUtil.CheckUrlAccess(path)) { Util.MakeControlRbacDisabled(base.TargetControl); base.Enabled = false; } } base.OnPreRender(e); }
protected override void CreateChildControls() { base.CreateChildControls(); string text = base.Attributes["SetRoles"]; this.hasWebServicePermission = ((string.IsNullOrEmpty(text) || LoginUtil.IsInRoles(this.Context.User, text.Split(new char[] { ',' }))) && null != this.ServiceUrl); if (this.hasWebServicePermission && !string.IsNullOrEmpty(this.RefreshProperties)) { this.RefreshWebServiceMethod = new WebServiceMethod(); this.RefreshWebServiceMethod.ID = "WebServiceDropDownRefresh"; this.Controls.Add(this.RefreshWebServiceMethod); } }
public override bool ApplyRbacRolesAndAddControls(WebControl parentControl, IPrincipal currentUser) { bool flag = true; if (base.HasAttributes) { string text = base.Attributes["SetRoles"]; if (!string.IsNullOrEmpty(text) && !LoginUtil.IsInRoles(currentUser, text.Split(new char[] { ',' }))) { flag = false; } } if (flag) { parentControl.Controls.Add(this); } return(flag); }
protected override void BuildScriptDescriptor(ScriptComponentDescriptor descriptor) { base.BuildScriptDescriptor(descriptor); descriptor.AddComponentProperty("ListView", this.ListViewID, this); descriptor.AddScriptProperty("BaseTypeMapping", new TypeMapping { BaseUrl = this.BaseUrl, InRole = new bool?(LoginUtil.CheckUrlAccess(this.BaseUrl)) }.ToJsonString(null)); if (this.TypeProperty != "Type") { descriptor.AddProperty("TypeProperty", this.TypeProperty); } if (!string.IsNullOrWhiteSpace(this.ArgumentProperty)) { descriptor.AddProperty("ArgumentProperty", this.ArgumentProperty); } descriptor.AddScriptProperty("TypeMappings", this.TypeMappings.ToJsonString(null)); if (this.SuppressFrameCache) { descriptor.AddProperty("SuppressFrameCache", true); } descriptor.AddElementProperty("ContentPanel", this.ContentPanelID, true); descriptor.AddElementProperty("LoadingDiv", this.LoadingDivID, true); descriptor.AddElementProperty("NoPermissionDiv", this.noPermissionDiv.ClientID, true); if (this.ShowPaddingPanels) { descriptor.AddProperty("ShowPaddingPanels", true); descriptor.AddElementProperty("TopEmptyPanel", this.TopEmptyPanelID, true); descriptor.AddElementProperty("MiddleEmptyPanel", this.MiddleEmptyPanelID, true); descriptor.AddElementProperty("BottomEmptyPanel", this.BottomEmptyPanelID, true); } descriptor.AddElementProperty("Frame", this.FrameID, true); descriptor.AddProperty("FrameTitle", this.FrameTitle, true); if (this.toolbar != null && this.ShowToolbar) { descriptor.AddComponentProperty("Toolbar", this.toolbar.ClientID); } }
public override bool IsAccessibleToUser(IPrincipal user) { return((this.BypassUrlCheck || LoginUtil.CheckUrlAccess(this.NavigateUrl)) && base.IsAccessibleToUser(user)); }
public virtual bool IsAccessibleToUser(IPrincipal user) { return(this.roles == null || LoginUtil.IsInRoles(user, this.roles)); }