<commit_before>using System;
using System.Collections.Generic;
using System.Security.Principal;
using System.Web.UI;
using System.Web.UI.WebControls;
using N2.Configuration;
using N2.Security;

namespace N2.Edit.Security
{
    [ToolbarPlugin("PERM", "security", "{ManagementUrl}/Content/Security/Default.aspx?{Selection.SelectedQueryKey}={selected}", ToolbarArea.Preview, Targets.Preview, "{ManagementUrl}/Resources/icons/key.png", 100, 
        ToolTip = "allowed roles for selected item",
        GlobalResourceClassName = "Toolbar",
        RequiredPermission = Permission.Publish,
        Legacy = true)]
    public partial class Default : Web.EditPage
    {
        protected Permission[] Permissions;
        protected string[] Roles;
        Control[,] map;

        protected override void OnInit(EventArgs e)
        {
            InitValues();

            base.OnInit(e);
        }

        protected override void OnLoad(EventArgs e)
        {
            if(!IsPostBack)
            {
                DataBind();
            }

            base.OnLoad(e);
        }



        protected void rptPermissions_ItemDataBound(object sender, RepeaterItemEventArgs args)
        {
            CheckBox cb = (CheckBox)args.Item.FindControl("cbRole");
        }

        protected void rptPermissions_ItemCreated(object sender, RepeaterItemEventArgs args)
        {
            if(args.Item.ItemType == ListItemType.Item || args.Item.ItemType == ListItemType.AlternatingItem)
            {
                int roleIndex = ((RepeaterItem) ((Control) sender).Parent).ItemIndex;
                map[args.Item.ItemIndex, roleIndex] = args.Item;
            }
        }



        protected void btnSave_Command(object sender, CommandEventArgs e)
        {
            Validate();
            if(!IsValid)
                return;

            ApplyRoles(Selection.SelectedItem);
            InitValues();
            DataBind();

            base.Refresh(Selection.SelectedItem, ToolbarArea.Navigation);
        }

        protected void btnSaveRecursive_Command(object sender, CommandEventArgs e)
        {
            Validate();
            if (!IsValid)<commit_msg>Removed code wart (fixes #421)<commit_after>using System;
using System.Collections.Generic;
using System.Security.Principal;
using System.Web.UI;
using System.Web.UI.WebControls;
using N2.Configuration;
using N2.Security;

namespace N2.Edit.Security
{
    [ToolbarPlugin("PERM", "security", "{ManagementUrl}/Content/Security/Default.aspx?{Selection.SelectedQueryKey}={selected}", ToolbarArea.Preview, Targets.Preview, "{ManagementUrl}/Resources/icons/key.png", 100, 
        ToolTip = "allowed roles for selected item",
        GlobalResourceClassName = "Toolbar",
        RequiredPermission = Permission.Publish,
        Legacy = true)]
    public partial class Default : Web.EditPage
    {
        protected Permission[] Permissions;
        protected string[] Roles;
        Control[,] map;

        protected override void OnInit(EventArgs e)
        {
            InitValues();

            base.OnInit(e);
        }

        protected override void OnLoad(EventArgs e)
        {
            if(!IsPostBack)
            {
                DataBind();
            }

            base.OnLoad(e);
        }

        protected void rptPermissions_ItemCreated(object sender, RepeaterItemEventArgs args)
        {
            if(args.Item.ItemType == ListItemType.Item || args.Item.ItemType == ListItemType.AlternatingItem)
            {
                int roleIndex = ((RepeaterItem) ((Control) sender).Parent).ItemIndex;
                map[args.Item.ItemIndex, roleIndex] = args.Item;
            }
        }



        protected void btnSave_Command(object sender, CommandEventArgs e)
        {
            Validate();
            if(!IsValid)
                return;

            ApplyRoles(Selection.SelectedItem);
            InitValues();
            DataBind();

            base.Refresh(Selection.SelectedItem, ToolbarArea.Navigation);
        }

        protected void btnSaveRecursive_Command(object sender, CommandEventArgs e)
        {
            Validate();
            if (!IsValid)
{'fraction_non_alphanumeric': 0.09841574651944311, 'fraction_numerical': 0.003600576092174748, 'mean_word_length': 2.1520423600605145, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6643989', 'n_tokens_mistral': 1104, 'n_tokens_neox': 1056, 'n_words': 220}