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(); } }
protected override void AfterUpdate(DataRow row) { atriumDB.secFileRuleRow dr = (atriumDB.secFileRuleRow)row; if (dr.Id >= 0 & dr.Id <= 20) { mysecFileRuleDT.RemovesecFileRuleRow(dr); mysecFileRuleDT.AcceptChanges(); } }
protected override void AfterAdd(DataRow row) { atriumDB.secFileRuleRow dr = (atriumDB.secFileRuleRow)row; dr.ApplyTo = (int)ApplyTo.ThisFileAndChildFiles; dr.Disabled = false; dr.Inherited = false; dr.StartDate = DateTime.Today; dr.EndDate = EndDateHack; }
public override bool CanEdit(DataRow row) { atriumDB.secFileRuleRow dr = (atriumDB.secFileRuleRow)row; if (dr.Inherited) { return(false); } else { return(AllowEdit || myA.AtMng.SecurityManager.CanUpdate(dr.FileId, atSecurity.SecurityManager.Features.secFileRule) > atSecurity.SecurityManager.LevelPermissions.No); } }
protected override void BeforeChange(DataColumn dc, DataRow row) { atriumDB.secFileRuleRow dr = (atriumDB.secFileRuleRow)row; switch (dc.ColumnName) { case "Inherited": if (dr.RowState != DataRowState.Added & myA.IsFieldChanged(dc, dr)) { throw new ReadOnlyException(dc.ColumnName); } break; } }
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(); //} }
private void AddSecFileRuleOnAssignment(CLAS.FileHistoryRow fhr) { OfficeManager om = myA.FM.AtMng.GetOffice(fhr.OfficeId); if (!om.CurrentOffice.IsDefaultGroupNull()) { atriumDB.secFileRuleRow secRule = (atriumDB.secFileRuleRow)myA.FM.GetsecFileRule().Add(myA.FM.CurrentFile); secRule.StartDate = DateTime.Today; secRule.Inherited = false; secRule.GroupId = om.CurrentOffice.DefaultGroup; try { secRule.RuleId = myA.AtMng.GetSetting(AppIntSetting.LeadOfficeSecFileRule); } catch (Exception x) { throw new AtriumException("ATTEMPT TO SET RULEID ON SECURITY FILE RULE HAS FAILED. RETRIEVAL OF LEAD OFFICE APPSETTING CAUSED AN ERROR"); } } else { throw new AtriumException("SELECTED OFFICE'S DEFAULT SECURITY GROUP IS NOT DEFINED."); } }