예제 #1
0
        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);
        }
예제 #2
0
        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[]
            {
                ','
            })));
        }
예제 #3
0
 protected override void CreateChildControls()
 {
     this.hasButton = (this.PickerRoles == null || LoginUtil.IsInRoles(this.Context.User, this.PickerRoles));
     if (this.hasButton)
     {
         this.CreateChildControlsWithButton();
         return;
     }
     this.CreateChildControlsWithoutButton();
 }
예제 #4
0
        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);
            }
        }
예제 #5
0
        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);
        }
예제 #6
0
 public virtual bool IsAccessibleToUser(IPrincipal user)
 {
     return(this.roles == null || LoginUtil.IsInRoles(user, this.roles));
 }