Skip to content

Commit

Permalink
feat(images): restrict images for public list endpoint (#181)
Browse files Browse the repository at this point in the history
* feat(images): restrict images for public list endpoint

* chore(backoffice): show restricted status on images
  • Loading branch information
Fenrikur authored Aug 25, 2024
1 parent 27adac6 commit 622a8cc
Show file tree
Hide file tree
Showing 11 changed files with 1,466 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<MudTextField T="string" Value="Record.InternalReference" Label="Name" ReadOnly="true" />
<MudTextField Value="Record.SizeInBytes" Label="Size (Bytes)" ReadOnly="true" />
<MudTextField Value="Record.MimeType" Label="Mime type" ReadOnly="true" />
<MudTextField Value="Record.IsRestricted" Label="Is restricted?" ReadOnly="true" />
<MudItem xs="3">
<MudTextField Value="Record.Width" Label="Width" ReadOnly="true" />
</MudItem>
Expand Down
6 changes: 6 additions & 0 deletions src/Eurofurence.App.Backoffice/Pages/Images.razor
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@
<MudIcon Icon="@Icons.Material.Outlined.Announcement"></MudIcon>
</MudTooltip>
}
@if (context.Item is { IsRestricted: true })
{
<MudTooltip Text="Restricted">
<MudIcon Icon="@Icons.Material.Outlined.Block"></MudIcon>
</MudTooltip>
}
</CellTemplate>
</TemplateColumn>
<TemplateColumn>
Expand Down
2 changes: 1 addition & 1 deletion src/Eurofurence.App.Backoffice/Services/ImageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class ImageService(HttpClient http) : IImageService

public async Task<ImageRecord[]> GetImagesAsync()
{
return (await http.GetFromJsonAsync<ImageRecord[]>("images"))?.Where(ke => ke.IsDeleted != 1).ToArray() ?? [];
return (await http.GetFromJsonAsync<ImageRecord[]>("images/:all"))?.Where(ke => ke.IsDeleted != 1).ToArray() ?? [];
}

public async Task<ImageWithRelationsResponse[]> GetImagesWithRelationsAsync()
Expand Down
4 changes: 4 additions & 0 deletions src/Eurofurence.App.Domain.Model/Images/ImageRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ public class ImageRecord : EntityBase
[DataMember]
public string Url { get; set; }

[Required]
[DataMember]
public bool IsRestricted { get; set; }

[Required]
[JsonIgnore]
public string InternalFileName { get; set; }
Expand Down
Loading

0 comments on commit 622a8cc

Please sign in to comment.