Beispiel #1
0
        public ActionResult Check(ConversionProfile profile, Accounts accounts, CheckLevel checkLevel)
        {
            if (!IsEnabled(profile))
            {
                return(new ActionResult());
            }

            var isJobLevelCheck = checkLevel == CheckLevel.Job;

            var account = accounts.GetDropboxAccount(profile);

            if (account == null)
            {
                return(new ActionResult(ErrorCode.Dropbox_AccountNotSpecified));
            }

            var accessToken = account.AccessToken;

            if (string.IsNullOrEmpty(accessToken))
            {
                return(new ActionResult(ErrorCode.Dropbox_AccessTokenNotSpecified));
            }

            if (!isJobLevelCheck && TokenIdentifier.ContainsTokens(profile.DropboxSettings.SharedFolder))
            {
                return(new ActionResult());
            }

            if (!ValidName.IsValidDropboxFolder(profile.DropboxSettings.SharedFolder))
            {
                return(new ActionResult(ErrorCode.Dropbox_InvalidFolderName));
            }

            return(new ActionResult());
        }