예제 #1
0
        public async Task <IActionResult> GetAll()
        {
            try
            {
                var userKey = _contextAccessor.UserKeyFromContext();
                if (userKey != Auth.ADMIN_NAME_CLAIM_VALUE)
                {
                    _logger.LogWarning($"Attempt to access endpoint that requires Admin with '{Auth.AS_USER_HEADER_NAME}' header populated.");
                    return(StatusCode(StatusCodes.Status403Forbidden));
                }

                var allCollections = await _hiarcDatabase.GetAllCollections();

                return(Ok(allCollections));
            }
            catch (Exception ex)
            {
                return(BuildErrorResponse(ex, _logger));
            }
        }