コード例 #1
0
ファイル: FilesController.cs プロジェクト: hiarcdb/hiarc
        public async Task <IActionResult> AddClassificationToFile(string fileKey, [FromBody] AddClassificationToFileRequest request)
        {
            try
            {
                var  userKey           = _contextAccessor.UserKeyFromContext();
                bool userCanAccessFile = await UserCanAccessFile(userKey, fileKey, _hiarcDatabase, AccessLevelGroup.CoOwner);

                if (userCanAccessFile)
                {
                    await _hiarcDatabase.AddClassificationToFile(fileKey, request);

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