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 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); }
public virtual bool IsAccessibleToUser(IPrincipal user) { return(this.roles == null || LoginUtil.IsInRoles(user, this.roles)); }