diff --git a/common.props b/common.props index e2ba8d6..f729773 100644 --- a/common.props +++ b/common.props @@ -1,7 +1,7 @@ latest - 0.1.5 + 0.1.6 $(NoWarn);CS1591 true EasyAbp Team diff --git a/src/EasyAbp.SharedResources.Application.Contracts/EasyAbp/SharedResources/Resources/Dtos/ResourceDto.cs b/src/EasyAbp.SharedResources.Application.Contracts/EasyAbp/SharedResources/Resources/Dtos/ResourceDto.cs index 2705bd6..94d0a99 100644 --- a/src/EasyAbp.SharedResources.Application.Contracts/EasyAbp/SharedResources/Resources/Dtos/ResourceDto.cs +++ b/src/EasyAbp.SharedResources.Application.Contracts/EasyAbp/SharedResources/Resources/Dtos/ResourceDto.cs @@ -15,6 +15,6 @@ public class ResourceDto : FullAuditedEntityDto public bool IsPublished { get; set; } - public bool IsAuthorized { get; set; } + public bool? IsAuthorized { get; set; } } } \ No newline at end of file diff --git a/src/EasyAbp.SharedResources.Application/EasyAbp/SharedResources/ResourceItems/ResourceItemAppService.cs b/src/EasyAbp.SharedResources.Application/EasyAbp/SharedResources/ResourceItems/ResourceItemAppService.cs index 47f75b1..b6629bd 100644 --- a/src/EasyAbp.SharedResources.Application/EasyAbp/SharedResources/ResourceItems/ResourceItemAppService.cs +++ b/src/EasyAbp.SharedResources.Application/EasyAbp/SharedResources/ResourceItems/ResourceItemAppService.cs @@ -66,7 +66,7 @@ public override async Task GetAsync(Guid id) var dto = await MapToGetOutputDtoAsync(resourceItem); - if (resourceItem.IsPublic || currentUserAllowedToManage || await IsCurrentUserAllowedToReadAsync(resource.Id)) + if (resourceItem.IsPublic || currentUserAllowedToManage || await IsCurrentUserAuthorizedToReadAsync(resource.Id)) { return dto; } @@ -91,7 +91,7 @@ public override async Task> GetListAsync(GetReso { query = query.Where(x => x.IsPublished); - if (!await IsCurrentUserAllowedToReadAsync(resource.Id)) + if (!await IsCurrentUserAuthorizedToReadAsync(resource.Id)) { query = query.Where(x => x.IsPublic); } @@ -186,7 +186,7 @@ protected virtual ResourceItemDto RemoveResourceItemContent(ResourceItemDto dto) return dto; } - protected virtual async Task IsCurrentUserAllowedToReadAsync(Guid resourceId) + protected virtual async Task IsCurrentUserAuthorizedToReadAsync(Guid resourceId) { return CurrentUser.Id.HasValue && await _resourceUserRepository.FindAsync(resourceId, CurrentUser.Id.Value) != null;