Skip to content

Commit

Permalink
incusd/auth: Update for openfga-go-sdk API breakage
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Graber <[email protected]>
  • Loading branch information
stgraber committed Sep 6, 2024
1 parent d8cc028 commit 061a5f8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/server/auth/driver_openfga.go
Original file line number Diff line number Diff line change
Expand Up @@ -1121,9 +1121,9 @@ func (f *fga) GetInstanceAccess(ctx context.Context, projectName string, instanc

if err != nil {
fgaAPIErr, ok := err.(openfga.FgaApiValidationError)
if !ok || fgaAPIErr.ResponseCode() != openfga.RELATION_NOT_FOUND {
if !ok || fgaAPIErr.ResponseCode() != openfga.ERRORCODE_RELATION_NOT_FOUND {
fgaNotFoundErr, ok := err.(openfga.FgaApiNotFoundError)
if ok && fgaNotFoundErr.ResponseCode() == openfga.UNDEFINED_ENDPOINT {
if ok && fgaNotFoundErr.ResponseCode() == openfga.NOTFOUNDERRORCODE_UNDEFINED_ENDPOINT {
return nil, fmt.Errorf("OpenFGA server doesn't support listing users")
}

Expand Down Expand Up @@ -1176,9 +1176,9 @@ func (f *fga) GetProjectAccess(ctx context.Context, projectName string) (*api.Ac

if err != nil {
fgaAPIErr, ok := err.(openfga.FgaApiValidationError)
if !ok || fgaAPIErr.ResponseCode() != openfga.RELATION_NOT_FOUND {
if !ok || fgaAPIErr.ResponseCode() != openfga.ERRORCODE_RELATION_NOT_FOUND {
fgaNotFoundErr, ok := err.(openfga.FgaApiNotFoundError)
if ok && fgaNotFoundErr.ResponseCode() == openfga.UNDEFINED_ENDPOINT {
if ok && fgaNotFoundErr.ResponseCode() == openfga.NOTFOUNDERRORCODE_UNDEFINED_ENDPOINT {
return nil, fmt.Errorf("OpenFGA server doesn't support listing users")
}

Expand Down

0 comments on commit 061a5f8

Please sign in to comment.