示例#1
0
        public fSelectFeatures(atriumBE.atriumManager atmng, SecurityDB.secRuleRow ruleRow)
        {
            InitializeComponent();
            secFeatureGridEX.RootTable.Caption = "Available Features for: " + ruleRow.RuleName;

            List <SecurityDB.secFeatureRow> availableFeatures = new List <SecurityDB.secFeatureRow>();

            SecurityDB.secPermissionRow[] establishedRulePerms = (SecurityDB.secPermissionRow[])atmng.SecurityManager.DB.secPermission.Select("RuleId=" + ruleRow.RuleId);
            foreach (SecurityDB.secFeatureRow fr in atmng.SecurityManager.DB.secFeature)
            {
                bool featureImplemented = false;
                foreach (SecurityDB.secPermissionRow secr in establishedRulePerms)
                {
                    if (secr.FeatureId == fr.FeatureId)
                    {
                        featureImplemented = true;
                    }
                }
                if (!featureImplemented)
                {
                    availableFeatures.Add(fr);
                }
            }

            if (availableFeatures.Count == 0)
            {
                MessageBox.Show("All features are already implemented on this rule");
            }

            secFeatureBindingSource.DataSource = availableFeatures;
        }
示例#2
0
 //JLL: 2009/07/28
 public void CreateFeaturePermissionForNewRule(SecurityDB.secRuleRow srr)
 {
     foreach (int id in Enum.GetValues(typeof(atSecurity.SecurityManager.Features)))
     {
         SecurityDB.secPermissionRow spr = (SecurityDB.secPermissionRow)myA.GetsecPermission().Add(srr);
         spr.FeatureId = id;
         //spr.RuleId = srr.RuleId;
     }
 }
示例#3
0
        protected override void AfterAdd(DataRow ddr)
        {
            SecurityDB.secRuleRow mem = (SecurityDB.secRuleRow)ddr;
            mem.RuleId   = myA.PKIDGet("secRule", 1);
            mem.RuleName = "[New Rule]";

            //JLL 2009/07/28 Automatically create secPermission records for each feature when rule is created
            //JLL 2014/3/27 commented out
            //myA.GetsecPermission().CreateFeaturePermissionForNewRule(mem);
        }
示例#4
0
 private void secRuleGridEX_FormattingRow(object sender, Janus.Windows.GridEX.RowLoadEventArgs e)
 {
     try
     {
         if (e.Row.RowType == Janus.Windows.GridEX.RowType.Record && e.Row.Table.Key.ToUpper() == "SECRULE")
         {
             SecurityDB.secRuleRow         srr  = (SecurityDB.secRuleRow)((DataRowView)e.Row.DataRow).Row;
             SecurityDB.secPermissionRow[] sprs = (SecurityDB.secPermissionRow[])mySecMan.DB.secPermission.Select("RuleId=" + srr.RuleId);
             e.Row.Cells["FeaturesCount"].Text = sprs.Length.ToString();
         }
     }
     catch (Exception x)
     {
         throw x;
     }
 }
示例#5
0
        private void uiCommandManager1_CommandClick(object sender, Janus.Windows.UI.CommandBars.CommandEventArgs e)
        {
            try
            {
                switch (e.Command.Key)
                {
                case "cmdCancel":
                    UIHelper.Cancel(secRuleBindingSource, mySecMan.DB.secPermission);
                    UIHelper.Cancel(secRuleBindingSource, mySecMan.DB.secRule);
                    break;

                case "cmdAdd":
                    SecurityDB.secRuleRow srr = (SecurityDB.secRuleRow)mySecMan.GetsecRule().Add(null);
                    secRuleBindingSource.Position = secRuleBindingSource.Find("RuleId", srr.RuleId);

                    break;

                case "cmdNewFeature":
                    mySecMan.GetsecPermission().Add(CurrentRow());
                    break;

                case "cmdSave":
                    Save();
                    break;

                case "cmdCollapse":
                    secRuleGridEX.CollapseRecords();
                    break;

                case "cmdExpand":
                    secRuleGridEX.ExpandRecords();
                    break;

                case "cmdCloneRule":
                    CloneRule();
                    break;
                }
            }
            catch (Exception x)
            {
                UIHelper.HandleUIException(x);
            }
        }
示例#6
0
        private void CloneRule()
        {
            SecurityDB.secRuleRow currRowRef = CurrentRow();
            SecurityDB.secRuleRow srr        = (SecurityDB.secRuleRow)mySecMan.GetsecRule().Add(null);
            srr.RuleName = "Copy of: " + currRowRef.RuleName;
            SecurityDB.secPermissionRow[] currPerms = (SecurityDB.secPermissionRow[])mySecMan.DB.secPermission.Select("RuleId=" + currRowRef.RuleId);

            foreach (SecurityDB.secPermissionRow prm in currPerms)
            {
                SecurityDB.secPermissionRow newPerm = (SecurityDB.secPermissionRow)mySecMan.GetsecPermission().Add(srr);
                newPerm.FeatureId    = prm.FeatureId;
                newPerm.AllowCreate  = prm.AllowCreate;
                newPerm.AllowExecute = prm.AllowExecute;
                newPerm.DeleteLevel  = prm.DeleteLevel;
                newPerm.OverrideRule = prm.OverrideRule;
                newPerm.ReadLevel    = prm.ReadLevel;
                newPerm.UpdateLevel  = prm.UpdateLevel;
            }

            secRuleBindingSource.Position = secRuleBindingSource.Find("RuleId", srr.RuleId);
        }
示例#7
0
        private void secRuleGridEX_LoadingRow(object sender, Janus.Windows.GridEX.RowLoadEventArgs e)
        {
            if (e.Row.RowType == Janus.Windows.GridEX.RowType.Record)
            {
                if (e.Row.Table.Key == "FK_secPermission_secRule")
                {
                    SecurityDB.secPermissionRow spr = (SecurityDB.secPermissionRow)((DataRowView)e.Row.DataRow).Row;
                    if (spr.RowState == DataRowState.Added)
                    {
                        e.Row.Cells["State"].Value = 1;
                    }
                    else if (spr.RowState == DataRowState.Modified)
                    {
                        e.Row.Cells["State"].Value = 2;
                    }
                    else
                    {
                        e.Row.Cells["State"].Value = 0;
                    }
                }

                if (e.Row.Table.Key.ToUpper() == "SECRULE")
                {
                    SecurityDB.secRuleRow spr = (SecurityDB.secRuleRow)((DataRowView)e.Row.DataRow).Row;
                    if (spr.RowState == DataRowState.Added)
                    {
                        e.Row.Cells["State"].Value = 1;
                    }
                    else if (spr.RowState == DataRowState.Modified)
                    {
                        e.Row.Cells["State"].Value = 2;
                    }
                    else
                    {
                        e.Row.Cells["State"].Value = 0;
                    }
                }
            }
        }