protected override void OnLoad(EventArgs e)
        {
            Title = "View Permission Settings";

            if (
                CurrentList.ParentWeb.Properties.ContainsKey(String.Format("ViewPermission{0}",
                                                                           CurrentList.ID)))
            {
                _roleProperties = new Dictionary <int, Dictionary <Guid, bool> >();
                _defaultViews   = new Dictionary <int, Guid>();
                ViewPermissionUtil.ConvertFromStringForPage(ref _roleProperties, ref _defaultViews,
                                                            CurrentList.ParentWeb.Properties[
                                                                String.Format("ViewPermission{0}",
                                                                              CurrentList.ID)], CurrentList);
            }
            else
            {
                _roleProperties = new Dictionary <int, Dictionary <Guid, bool> >();
                _defaultViews   = new Dictionary <int, Guid>();

                // Récupération des groups
                foreach (SPGroup group in CurrentList.ParentWeb.Groups)
                {
                    _groups.Add(group);
                }

                // Récupération des vues
                foreach (SPView view in CurrentList.Views)
                {
                    if ((!view.Hidden) && (!view.PersonalView))
                    {
                        _views.Add(view);
                    }
                }

                foreach (SPGroup group in _groups)
                {
                    _roleProperties.Add(group.ID, new Dictionary <Guid, bool>());
                    _defaultViews.Add(group.ID, CurrentList.DefaultView.ID);
                    foreach (SPView view in _views)
                    {
                        _roleProperties[group.ID].Add(view.ID, true);
                    }
                }
            }

            _pageRender = PrepareRenderPage();
            RegisterScript();

            Cancel.PostBackUrl = string.Format("~/_layouts/listedit.aspx?List={0}", CurrentList.ID);
        }
        protected override void OnLoad(EventArgs e)
        {
            if (Visible)
            {
                if (CheckIfFeatureIsEnabled())
                {
                    string key = String.Format("ViewPermission{0}", SPContext.Current.List.ID);

                    if (
                        SPContext.Current.List.ParentWeb.Properties.ContainsKey(key))
                    {
                        _featureEnabled = true;
                        _roleProperties = new Dictionary <int, Dictionary <Guid, bool> >();
                        _defaultViews   = new Dictionary <int, Guid>();

                        using (SPWeb web = SPContext.Current.List.ParentWeb)
                        {
                            ViewPermissionUtil.ConvertFromString(ref _roleProperties, ref _defaultViews,
                                                                 web.Properties[key],
                                                                 SPContext.Current.List);

                            if (!UserCanSeeView(RenderContext.ViewContext.View.ID, _roleProperties))
                            {
                                SPUtility.Redirect(GoToDefaultView(_defaultViews).ServerRelativeUrl,
                                                   SPRedirectFlags.Default, HttpContext.Current, "redirect=true");
                            }
                            else
                            {
                                if (!ComeFromView())
                                {
                                    SPUtility.Redirect(GoToDefaultView(_defaultViews).ServerRelativeUrl,
                                                       SPRedirectFlags.Default, HttpContext.Current, "redirect=true");
                                }
                            }
                        }
                    }
                }


                base.OnLoad(e);
            }
            else
            {
                base.OnLoad(e);
            }
        }