Пример #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();
            }
        }
Пример #2
0
 public void SavePrefsCommit()
 {
     //save and commit
     try
     {
         BusinessProcess bp = myA.GetBP();
         bp.AddForUpdate(this);
         bp.Update();
     }
     catch (Exception x)
     {
         // myA.AtMng.AppMan.Rollback();
         //Add an entry to auditlog if setpref fails?
         //throw an error?  no, right?
     }
 }
Пример #3
0
        public void CreatePersonalFiles(int parentFileId, officeDB.OfficerRow or, bool useSeparatePersonalFiles)
        {
            //JLL: 2009/07/27 Note about CONVERSION
            // when creating personal files in Personnel Management file, structure should be:
            // Personnel Management
            //      Officers
            //      Role-Based Accounts

            //check to make sure myfileid is null
            //if (!or.IsMyFileIdNull())
            //    throw new AtriumException("File already created.");

            //check to make sure the officer has an account
            SecurityDB.secUserRow sur = myA.AtMng.SecurityManager.GetsecUser().GetSecUserForOfficer(or);

            try
            {
                //create my file
                FileManager myFile = myA.AtMng.CreateFile(myA.AtMng.GetFile(parentFileId));
                myFile.CurrentFile.NameE    = string.Format("{0}, {1} [{2}]", or.LastName, or.FirstName, or.OfficerCode);
                myFile.CurrentFile.FileType = "PR";

                BusinessProcess bp = myA.GetBP();

                bp.AddForUpdate(myFile.EFile);
                bp.AddForUpdate(myFile.GetFileXRef());
                bp.AddForUpdate(myFile.GetFileOffice());
                bp.AddForUpdate(myFile.GetFileContact());
                bp.AddForUpdate(myFile.EFile);
                bp.Update();
                //myFile.AtMng.AppMan.Commit();

                or.MyFileId = myFile.CurrentFile.FileId;

                //break security inheritance
                myFile.EFile.BreakInherit();

                //set new perms to this user and sysadmin?
                AddUserFileRule(sur.UserId, myFile.CurrentFile, (int)atSecurity.SpecialRules.MyPersonalFile);
                AddUserFileRule((int)atSecurity.SpecialGroups.Everyone, myFile.CurrentFile, (int)atSecurity.SpecialRules.ReadMail);



                //Create Setting For Below
                if (!useSeparatePersonalFiles)
                {
                    or.InboxId     = or.MyFileId;
                    or.SentItemsId = or.MyFileId;
                }
                else
                {
                    //create inbox
                    FileManager inbox = myA.AtMng.CreateFile(myFile);
                    inbox.CurrentFile.NameE = "Inbox";
                    inbox.CurrentFile.NameF = "Dossier corbeille arrivée";
                    BusinessProcess bpi = myA.GetBP();

                    bpi.AddForUpdate(inbox.EFile);
                    bpi.AddForUpdate(inbox.GetFileXRef());
                    bpi.AddForUpdate(inbox.GetFileOffice());
                    bpi.AddForUpdate(inbox.GetFileContact());
                    bpi.AddForUpdate(inbox.EFile);
                    bpi.Update();

                    or.InboxId = inbox.CurrentFile.FileId;

                    //create sentitems
                    FileManager sentItems = myA.AtMng.CreateFile(myFile);
                    sentItems.CurrentFile.NameE = "Sent Items";
                    sentItems.CurrentFile.NameF = "Dossier corbeille envoyée";
                    BusinessProcess bpsi = myA.GetBP();

                    bpsi.AddForUpdate(sentItems.EFile);
                    bpsi.AddForUpdate(sentItems.GetFileXRef());
                    bpsi.AddForUpdate(sentItems.GetFileOffice());
                    bpsi.AddForUpdate(sentItems.GetFileContact());
                    bpsi.AddForUpdate(sentItems.EFile);
                    bpsi.Update();

                    or.SentItemsId = sentItems.CurrentFile.FileId;
                }
                //create shortcuts
                FileManager shortcuts = myA.AtMng.CreateFile(myFile);
                shortcuts.CurrentFile.NameE    = "My Shortcuts";
                shortcuts.CurrentFile.NameF    = "Dossier de raccourcis";
                shortcuts.CurrentFile.MetaType = "SC";
                BusinessProcess bpsc = myA.GetBP();

                bpsc.AddForUpdate(shortcuts.EFile);
                bpsc.AddForUpdate(shortcuts.GetFileXRef());
                bpsc.AddForUpdate(shortcuts.GetFileOffice());
                bpsc.AddForUpdate(shortcuts.GetFileContact());
                bpsc.AddForUpdate(shortcuts.EFile);
                bpsc.Update();

                or.ShortcutsId = shortcuts.CurrentFile.FileId;
            }
            catch (Exception x)
            {
                //myA.AtMng.AppMan.Rollback();
                throw x;
            }
        }