mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 20:50:19 +08:00
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:
@ -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() {
|
||||
|
Reference in New Issue
Block a user