Beispiel #1
0
 public void InitView(Boolean isOnModalWindow, long time, long timeValidity, String mac, long idPath, long idActivity, long idSubactivity, Int32 idUser = -1)
 {
     if (UserContext.isAnonymous)
     {
         View.DisplaySessionTimeout();
     }
     else
     {
         Int32 idCommunity             = Service.GetPathIdCommunity(idPath);
         dtoSubActivityCertificate dto = Service.GetDtoSubActivityCertificate(idSubactivity);
         if (dto == null || (dto.IdPath != idPath))
         {
             View.DisplayUnknownItem();
         }
         else
         {
             lm.Comol.Core.Authentication.liteGenericEncryption sEncryptor = null;
             Boolean    canRestore = false;
             litePerson person     = CurrentManager.GetLitePerson(UserContext.CurrentUserID);
             if (person != null)
             {
                 canRestore = (person.TypeID == (int)UserTypeStandard.SysAdmin || person.TypeID == (int)UserTypeStandard.Administrator);
                 if (!canRestore)
                 {
                     ModuleEduPath mEduPath = Service.ServiceStat.GetPermissionForCertification(idCommunity, person, idPath);
                     canRestore = mEduPath.Administration;
                 }
                 if (canRestore)
                 {
                     sEncryptor = CurrentManager.GetUrlMacEncryptor();
                     canRestore = (sEncryptor != null && sEncryptor.Validate(mac, UserContext.WorkSessionID, time, timeValidity, idPath, idSubactivity, idUser));
                 }
             }
             if (canRestore)
             {
                 View.AddAutoRedirectoToDownloadPage(RootObject.CertificationGenerateAndDownloadPage(sEncryptor.Encrypt(UserContext.WorkSessionID, time, timeValidity, idPath, idSubactivity, idUser), time, timeValidity, idPath, idActivity, idSubactivity, idUser, isOnModalWindow));
             }
             else
             {
                 View.DisplayNoPermissions();
             }
         }
     }
 }