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.
OneAuth/api/role/roleAuth.go

43 lines
824 B
Go

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package role
import (
"github.com/veypi/OneAuth/libs/auth"
"github.com/veypi/OneAuth/libs/base"
"github.com/veypi/OneAuth/libs/oerr"
"github.com/veypi/OneBD"
)
/**
* @name: roleAuth
* @author: veypi <i@veypi.com>
* @date: 2021-11-17 15:20
* @descriptionroleAuth
* @update: 2021-11-17 15:20
*/
var rap = OneBD.NewHandlerPool(func() OneBD.Handler {
return &roleAuthHandler{}
})
type roleAuthHandler struct {
base.AppHandler
id uint
aid uint
}
func (h *roleAuthHandler) Init(m OneBD.Meta) error {
id := uint(m.ParamsInt("id"))
aid := uint(m.ParamsInt("aid"))
if id == 0 || aid == 0 {
return oerr.ApiArgsError
}
return h.ApiHandler.Init(m)
}
func (h *roleAuthHandler) Post() (interface{}, error) {
if !h.Payload.GetAuth(auth.Auth, h.UUID).CanCreate() {
return nil, oerr.NoAuth
}
return nil, nil
}