Example #1
0
        private QueryResponse CreateJob(Contracts.JobTypes.Ftp.Model.FtpDownloadJob model)
        {
            string username = model.Username;
            string password = model.Password;

            try
            {
                if (new EncryptionFeatureToggle().FeatureEnabled)
                {
                    username = AESGCM.SimpleEncrypt(username, Convert.FromBase64String(ConfigurationManager.AppSettings["SchedulerEncryptionKey"]));
                    password = AESGCM.SimpleEncrypt(password, Convert.FromBase64String(ConfigurationManager.AppSettings["SchedulerEncryptionKey"]));
                }
            }
            catch (Exception ex)
            {
                Logger.Error("ConfigurationError creating FtpDownload job.", ex);
            }

            var dataMap = new Dictionary <string, object>
            {
                { "ftpHost", model.FtpHost },
                { "serverPort", model.ServerPort },
                { "userName", username },
                { "password", password },
                { "localDirectoryPath", model.LocalDirectoryPath },
                { "remoteDirectoryPath", model.RemoteDirectoryPath },
                { "fileExtensions", model.FileExtensions },
                { "cutOffTimeSpan", model.CutOffTimeSpan }
            };

            return(base.CreateJob(model, typeof(FtpDownloadJob), dataMap, model.Description));
        }
Example #2
0
        public QueryResponse Put([FromBody] Contracts.JobTypes.Ftp.Model.FtpDownloadJob model)
        {
            Logger.DebugFormat("Entered FtpJobsController.Put(). Job Name = {0}", model.JobName);

            var authorizedJobGroups = _permissionsHelper.GetAuthorizedJobGroups().ToList();

            if ((authorizedJobGroups.Contains(model.JobGroup) || authorizedJobGroups.Contains("*")) && model.JobGroup != "*")
            {
                return(CreateJob(model));
            }
            throw new HttpResponseException(HttpStatusCode.Unauthorized);
        }
Example #3
0
        public QueryResponse Post([FromBody] Contracts.JobTypes.Ftp.Model.FtpDownloadJob model)
        {
            Logger.DebugFormat("Entered FtpJobsController.Post(). Job Name = {0}", model.JobName);

            var dataMap = new Dictionary <string, object>
            {
                { "ftpHost", model.FtpHost },
                { "serverPort", model.ServerPort },
                { "userName", model.Username },
                { "password", model.Password },
                { "localDirectoryPath", model.LocalDirectoryPath },
                { "remoteDirectoryPath", model.RemoteDirectoryPath },
                { "fileExtensions", model.FileExtensions },
                { "cutOffTimeSpan", model.CutOffTimeSpan }
            };

            return(base.CreateJob(model, typeof(FtpDownloadJob), dataMap, model.Description));
        }
Example #4
0
        public QueryResponse Put([FromBody] Contracts.JobTypes.Ftp.Model.FtpDownloadJob model)
        {
            Logger.DebugFormat("Entered FtpJobsController.Put(). Job Name = {0}", model.JobName);

            return(CreateJob(model));
        }