Пример #1
0
        /// <summary>
        /// Validates access for an external lock
        /// </summary>
        /// <param name="category">Category of the lock</param>
        /// <param name="id">Id of the resource</param>
        /// <param name="token">Access token Token</param>
        /// <returns>True if the access is valid, else false</returns>
        private async Task <bool> ValidateExternalAccess(string category, string id, string token)
        {
            if (category == "KirjaReview")
            {
                KirjaPageReview review = await _kirjaReviewDbAccess.GetPageReviewById(id);

                if (review != null && !string.IsNullOrEmpty(review.ExternalAccessToken) && review.ExternalAccessToken == token)
                {
                    return(true);
                }
            }

            return(false);
        }
Пример #2
0
        public async Task <IActionResult> ExternalReview(string id, string token)
        {
            if (_DisableWikiExternalSharing)
            {
                return(NotFound());
            }

            KirjaPageReview pageReview = await _reviewDbAccess.GetPageReviewById(id);

            if (pageReview == null || string.IsNullOrEmpty(pageReview.ExternalAccessToken) || pageReview.ExternalAccessToken != token)
            {
                return(NotFound());
            }

            KirjaReviewViewModel model = new KirjaReviewViewModel();

            model.DisableWikiExternalSharing = _DisableWikiExternalSharing;
            return(View("Review", model));
        }