feat: fix bug in GetPolicies()

This commit is contained in:
Yang Luo 2024-07-18 18:40:55 +08:00
parent da70682cd1
commit a38747d90e

View File

@ -16,6 +16,7 @@ package controllers
import (
"encoding/json"
"fmt"
"github.com/beego/beego/utils/pagination"
"github.com/casdoor/casdoor/object"
@ -163,11 +164,17 @@ func (c *ApiController) GetPolicies() {
c.ResponseError(err.Error())
return
}
if adapter == nil {
c.ResponseError(fmt.Sprintf(c.T("the adapter: %s is not found"), adapterId))
return
}
err = adapter.InitAdapter()
if err != nil {
c.ResponseError(err.Error())
return
}
c.ResponseOk()
return
}