Ejemplo n.º 1
0
        internal void CreateGroup(officeDB.OfficeRow or, FileManager offFM)
        {
            SecurityDB.secGroupRow gr = (SecurityDB.secGroupRow)offFM.AtMng.SecurityManager.GetsecGroup().Add(null);
            gr.GroupName = or.OfficeName;
            gr.DescE     = or.OfficeName;
            gr.DescF     = or.OfficeNameFre;

            BusinessProcess bp = myA.GetBP();

            bp.AddForUpdate(offFM.AtMng.SecurityManager.GetsecGroup());
            bp.Update();


            offFM.EFile.BreakInherit();
            atriumDB.secFileRuleRow sfr = (atriumDB.secFileRuleRow)offFM.GetsecFileRule().Add(offFM.CurrentFile);
            sfr.FileId  = offFM.CurrentFile.FileId;
            sfr.GroupId = gr.GroupId;
            sfr.RuleId  = (int)atSecurity.SpecialRules.GeneralRule;

            BusinessProcess bp1 = myA.GetBP();

            bp1.AddForUpdate(offFM.GetsecFileRule());
            bp1.Update();

            //get rid of new row if present as database new row will have been returned with a different pkid
            lmDatasets.atriumDB.secFileRuleRow sfr0 = offFM.DB.secFileRule.FindById(0);
            if (sfr0 != null)
            {
                offFM.DB.secFileRule.RemovesecFileRuleRow(sfr0);
                offFM.DB.secFileRule.AcceptChanges();
            }
        }
Ejemplo n.º 2
0
        internal void AddUserFileRule(int groupId, atriumDB.EFileRow file, int ruleId)
        {
            FileManager fm = myA.AtMng.GetFile(file.FileId);

            atriumDB.secFileRuleRow sfr = (atriumDB.secFileRuleRow)fm.GetsecFileRule().Add(file);
            sfr.FileId  = file.FileId;
            sfr.GroupId = groupId;
            sfr.RuleId  = ruleId;

            BusinessProcess bp = fm.GetBP();

            bp.AddForUpdate(fm.GetsecFileRule());
            bp.Update();
            //myA.AtMng.SecurityManager.Commit();

            //get rid of new row if present as database new row will have been returned with a different pkid
            //lmDatasets.SecurityDB.secFileRuleRow sfr0 = myA.AtMng.SecurityManager.DB.secFileRule.FindById(0);
            //if (sfr0 != null)
            //{
            //    myA.AtMng.SecurityManager.DB.secFileRule.RemovesecFileRuleRow(sfr0);
            //    myA.AtMng.SecurityManager.DB.secFileRule.AcceptChanges();
            //}
        }