Exemple #1
0
        public static LayerResponse BuildLayerResponse(this IdentityResult fromIdentityResult)
        {
            var identityLayerResponse = LayerResponse.Build();

            foreach (var error in fromIdentityResult.Errors)
            {
                identityLayerResponse.AddErrorMessage(error);
            }

            return(identityLayerResponse);
        }
        private LayerResponse ValidateDoesUserHasAccessTo(IEnumerable <string> providedTags, string forUsername)
        {
            var availableTagsForUser = GetAllAvailableTags(forUsername);

            var invalidProvidedTags = providedTags.Where(tagToCheck => !availableTagsForUser.Contains(tagToCheck));

            LayerResponse validationResponse = LayerResponse.Build();

            foreach (var invalidTag in invalidProvidedTags)
            {
                validationResponse.AddErrorMessage($"User does not have access to: {invalidTag}");
            }

            return(validationResponse);
        }