get list permission authsms
This commit is contained in:
parent
b5fe2c5a71
commit
f0eb62f3f5
|
@ -6,6 +6,7 @@ import (
|
|||
"git.selly.red/Selly-Modules/natsio"
|
||||
"git.selly.red/Selly-Modules/natsio/model"
|
||||
"git.selly.red/Selly-Modules/natsio/subject"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
)
|
||||
|
||||
// AuthSMS ...
|
||||
|
@ -36,3 +37,24 @@ func (s AuthSMS) CreateUserSMSViaAuthSMS(p model.CreateUserSMSRequest) (*model.C
|
|||
|
||||
return r.Data, nil
|
||||
}
|
||||
|
||||
func (s AuthSMS) GetListPermission() (*model.GetListPermissionResponse, error) {
|
||||
msg, err := natsio.GetServer().Request(subject.AuthSMS.GetListPermission, toBytes(bson.M{}))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r struct {
|
||||
Data *model.GetListPermissionResponse `json:"data"`
|
||||
Error string `json:"error"`
|
||||
}
|
||||
|
||||
if err = json.Unmarshal(msg.Data, &r); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if r.Error != "" {
|
||||
return nil, errors.New(r.Error)
|
||||
}
|
||||
|
||||
return r.Data, nil
|
||||
}
|
||||
|
|
|
@ -3,3 +3,7 @@ package model
|
|||
type CreateUserSMSResponse struct {
|
||||
ID string `json:"_id"`
|
||||
}
|
||||
|
||||
type GetListPermissionResponse struct {
|
||||
Permission []string `json:"permission"`
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ func getAuthSMSValue(val string) string {
|
|||
|
||||
var AuthSMS = struct {
|
||||
CreateUserSMS string
|
||||
GetListPermission string
|
||||
}{
|
||||
CreateUserSMS: getAuthSMSValue("create_user_sms"),
|
||||
GetListPermission: getAuthSMSValue("get_list_permission"),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue