feat: response with status in casbin_adapter.go (#1384)

* fix: response standardized information with status in `casbin_adapter.go`

* fix: remove redundant statements
This commit is contained in:
imp2002
2022-12-08 10:22:59 +08:00
committed by GitHub
parent 2bb2c36f22
commit e705eecffe
3 changed files with 13 additions and 12 deletions

View File

@ -32,8 +32,8 @@ func (c *ApiController) GetCasbinAdapters() {
sortField := c.Input().Get("sortField")
sortOrder := c.Input().Get("sortOrder")
if limit == "" || page == "" {
c.Data["json"] = object.GetCasbinAdapters(owner)
c.ServeJSON()
adapters := object.GetCasbinAdapters(owner)
c.ResponseOk(adapters)
} else {
limit := util.ParseInt(limit)
paginator := pagination.SetPaginator(c.Ctx, limit, int64(object.GetCasbinAdapterCount(owner, field, value)))
@ -44,8 +44,8 @@ func (c *ApiController) GetCasbinAdapters() {
func (c *ApiController) GetCasbinAdapter() {
id := c.Input().Get("id")
c.Data["json"] = object.GetCasbinAdapter(id)
c.ServeJSON()
adapter := object.GetCasbinAdapter(id)
c.ResponseOk(adapter)
}
func (c *ApiController) UpdateCasbinAdapter() {
@ -96,8 +96,7 @@ func (c *ApiController) SyncPolicies() {
return
}
c.Data["json"] = policies
c.ServeJSON()
c.ResponseOk(policies)
}
func (c *ApiController) UpdatePolicy() {