Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Hawxy committed Oct 4, 2022
1 parent a3e8695 commit 1a04b04
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ These attributes can be used in both minimal APIs & in your controller(s):
public class DocumentController : ControllerBase
{
[HttpGet("view/{documentId}")]
[FgaRouteObject("viewer", "doc", "documentId")]
[FgaRouteObject("read", "document", "documentId")]
public string GetByConvention(string documentId)
{
return documentId;
Expand All @@ -97,7 +97,7 @@ These attributes can be used in both minimal APIs & in your controller(s):
// Minimal APIs
app.MapGet("/viewminimal/{documentId}", (string documentId) => Task.FromResult(documentId))
.RequireAuthorization(FgaAuthorizationDefaults.PolicyKey)
.WithMetadata(new FgaRouteObjectAttribute("viewer", "doc", "documentId"));
.WithMetadata(new FgaRouteObjectAttribute("read", "document", "documentId"));
```


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ public class DocumentController : ControllerBase
{

[HttpGet("view/{documentId}")]
[FgaRouteObject(Fga.Document.Viewer, Fga.Document.Type, "documentId")]
[FgaRouteObject(Fga.Document.Read, Fga.Document.Type, "documentId")]
public string GetByConvention(string documentId)
{
return documentId;
}

[HttpGet]
[FgaString("anne", "viewer", "document:12345")]
[FgaString("anne", "read", "document:12345")]
public string GetHardcoded()
{
return string.Empty;
Expand All @@ -33,9 +33,9 @@ public class Document
{
public const string Type = "document";

public const string Viewer = "viewer";
public const string Editor = "editor";
public const string Owner = "owner";
public const string Read = "read";
public const string Write = "write";

}
}

0 comments on commit 1a04b04

Please sign in to comment.