Esempio n. 1
0
        public async Task <IActionResult> GetVersions(string fileKey)
        {
            try
            {
                var userKey           = _contextAccessor.UserKeyFromContext();
                var userCanAccessFile = await UserCanAccessFile(userKey, fileKey, _hiarcDatabase, AccessLevelGroup.ReadOnlyOrHigher);

                if (userCanAccessFile)
                {
                    var theFileVersions = await _hiarcDatabase.GetFileVersions(fileKey);

                    return(Ok(theFileVersions));
                }
                else
                {
                    return(StatusCode(StatusCodes.Status403Forbidden));
                }
            }
            catch (Exception ex)
            {
                return(BuildErrorResponse(ex, _logger));
            }
        }