mirror of https://github.com/veypi/OneAuth.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
497 B
Go
28 lines
497 B
Go
package role
|
|
|
|
import (
|
|
"OneAuth/cfg"
|
|
"OneAuth/libs/auth"
|
|
"OneAuth/libs/base"
|
|
"OneAuth/libs/oerr"
|
|
"OneAuth/models"
|
|
"github.com/veypi/OneBD"
|
|
"github.com/veypi/OneBD/core"
|
|
)
|
|
|
|
var authP = OneBD.NewHandlerPool(func() core.Handler {
|
|
return &authHandler{}
|
|
})
|
|
|
|
type authHandler struct {
|
|
base.ApiHandler
|
|
}
|
|
|
|
func (h *authHandler) Get() (interface{}, error) {
|
|
if !h.GetAuth(auth.Auth).CanRead() {
|
|
return nil, oerr.NoAuth
|
|
}
|
|
l := make([]*models.Auth, 0, 10)
|
|
return &l, cfg.DB().Find(&l).Error
|
|
}
|