Skip to content

Commit

Permalink
Adjust sample to show convention
Browse files Browse the repository at this point in the history
  • Loading branch information
Hawxy committed Oct 4, 2022
1 parent 7a72f49 commit a3e8695
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions samples/Fga.Example.AspNetCore/Controllers/DocumentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,32 @@ namespace Fga.Example.AspNetCore.Controllers;
[Authorize(FgaAuthorizationDefaults.PolicyKey)]
public class DocumentController : ControllerBase
{

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

[HttpGet]
[FgaString("anne", "read", "doc:Z")]
[FgaString("anne", "viewer", "document:12345")]
public string GetHardcoded()
{
return string.Empty;
}

}

public static class Fga
{
public class Document
{
public const string Type = "document";

public const string Viewer = "viewer";
public const string Editor = "editor";
public const string Owner = "owner";

}
}

0 comments on commit a3e8695

Please sign in to comment.