func (s *Server) DeleteUser(ctx context.Context, in *pb.UserRoleRequest) (*pb.BoolReply, error) {
	e, err := s.getEnforcer(int(in.EnforcerHandler))
	if err != nil {
		return &pb.BoolReply{}, err
	}
	ruleRemoved, err := e.RemoveFilteredGroupingPolicy(0, in.User)
	return &pb.BoolReply{Res: ruleRemoved}, err
}
DeleteUser deletes a user.
Returns false if the user does not exist (aka not affected).
package server
import (
	"context"
	pb "github.com/casbin/casbin-server/proto"
)
func (s *Server) GetRolesForUser(ctx context.Context, in *pb.UserRoleRequest) (*pb.ArrayReply, error) {
	e, err := s.getEnforcer(int(in.EnforcerHandler))
	if err != nil {
		return &pb.ArrayReply{}, err
	}
	res, _ := e.GetModel()["g"]["g"].RM.GetRoles(in.User)
	return &pb.ArrayReply{Array: res}, nil
}
func (s *Server) GetImplicitRolesForUser(ctx context.Context, in *pb.UserRoleRequest) (*pb.ArrayReply, error) {
	e, err := s.getEnforcer(int(in.EnforcerHandler))
	if err != nil {
		return &pb.ArrayReply{}, err
	}
	res, err := e.GetImplicitRolesForUser(in.User)
	return &pb.ArrayReply{Array: res}, err
}
func (s *Server) GetUsersForRole(ctx context.Context, in *pb.UserRoleRequest) (*pb.ArrayReply, error) {
	e, err := s.getEnforcer(int(in.EnforcerHandler))
	if err != nil {
		return &pb.ArrayReply{}, err
	}
	res, _ := e.GetModel()["g"]["g"].RM.GetUsers(in.Role)
	return &pb.ArrayReply{Array: res}, nil
}
func (s *Server) HasRoleForUser(ctx context.Context, in *pb.UserRoleRequest) (*pb.BoolReply, error) {
	e, err := s.getEnforcer(int(in.EnforcerHandler))
	if err != nil {
		return &pb.BoolReply{}, err
	}
	roles, err := e.GetRolesForUser(in.User)
	if err != nil {
		return &pb.BoolReply{}, err
	}
	for _, r := range roles {
		if r == in.Role {
			return &pb.BoolReply{Res: true}, nil
		}
	}
	return &pb.BoolReply{}, nil
}
func (s *Server) AddRoleForUser(ctx context.Context, in *pb.UserRoleRequest) (*pb.BoolReply, error) {
	e, err := s.getEnforcer(int(in.EnforcerHandler))
	if err != nil {
		return &pb.BoolReply{}, err
	}
	ruleAdded, err := e.AddGroupingPolicy(in.User, in.Role)
	return &pb.BoolReply{Res: ruleAdded}, err
}
func (s *Server) DeleteRoleForUser(ctx context.Context, in *pb.UserRoleRequest) (*pb.BoolReply, error) {
	e, err := s.getEnforcer(int(in.EnforcerHandler))
	if err != nil {
		return &pb.BoolReply{}, err
	}
	ruleRemoved, err := e.RemoveGroupingPolicy(in.User, in.Role)
	return &pb.BoolReply{Res: ruleRemoved}, err
}
func (s *Server) DeleteRolesForUser(ctx context.Context, in *pb.UserRoleRequest) (*pb.BoolReply, error) {
	e, err := s.getEnforcer(int(in.EnforcerHandler))
	if err != nil {
		return &pb.BoolReply{}, err
	}
	ruleRemoved, err := e.RemoveFilteredGroupingPolicy(0, in.User)
	return &pb.BoolReply{Res: ruleRemoved}, err
}