If you are using Casbin.js at your frontend and Go Casbinas your backend Casbin service, you can install this package at your backend. This package provides a wrapper for generating the user permission, which can be passed to Casbin.js at the frontend.
go get github.com/casbin-js/go-utils/v2
package main import ( "fmt" casbinjs "github.com/casbin-js/go-utils" "github.com/casbin/casbin" ) func main() { e, err := casbin.NewEnforcer("path/to/model.conf", "path/to/policy.csv") if err != nil { panic(err) } s, _ := casbinjs.GetPermissionForUser(e, "alice") // Now `s` has the info of alice's permission // Pass the permission data to your frontend application. }