func (s *Service) Delete(c *gin.Context, id int) error {
	u, err := s.udb.View(c, id)
	if err != nil {
		return err
	}
	if !s.rbac.IsLowerRole(c, u.Role.AccessLevel) {
		return apperr.Forbidden
	}
	u.Delete()
	return s.udb.Delete(c, u)
}
Delete deletes a user
package user
import (
	"github.com/gin-gonic/gin"
	"github.com/ribice/gorsk-gin/internal"
	"github.com/ribice/gorsk-gin/internal/errors"
	"github.com/ribice/gorsk-gin/internal/platform/query"
	"github.com/ribice/gorsk-gin/internal/platform/structs"
)
func New(udb model.UserDB, rbac model.RBACService, auth model.AuthService) *Service {
	return &Service{udb: udb, rbac: rbac, auth: auth}
}
type Service struct {
	udb  model.UserDB
	rbac model.RBACService
	auth model.AuthService
}
func (s *Service) List(c *gin.Context, p *model.Pagination) ([]model.User, error) {
	u := s.auth.User(c)
	q, err := query.List(u)
	if err != nil {
		return nil, err
	}
	return s.udb.List(c, q, p)
}
func (s *Service) View(c *gin.Context, id int) (*model.User, error) {
	if !s.rbac.EnforceUser(c, id) {
		return nil, apperr.Forbidden
	}
	return s.udb.View(c, id)
}