refactor(admin): Move Admin Web Route to user model
This commit is contained in:
@@ -18,11 +18,6 @@ func (lp *LoginPayload) FromUser(user *model.User) {
|
|||||||
lp.Nickname = user.Nickname
|
lp.Nickname = user.Nickname
|
||||||
}
|
}
|
||||||
|
|
||||||
var UserRouteNames = []string{
|
|
||||||
"MyTagList", "MyAddressBookList", "MyInfo", "MyAddressBookCollection", "MyPeer", "MyShareRecordList", "MyLoginLog",
|
|
||||||
}
|
|
||||||
var AdminRouteNames = []string{"*"}
|
|
||||||
|
|
||||||
type UserOauthItem struct {
|
type UserOauthItem struct {
|
||||||
Op string `json:"op"`
|
Op string `json:"op"`
|
||||||
Status int `json:"status"`
|
Status int `json:"status"`
|
||||||
|
|||||||
@@ -27,3 +27,8 @@ type UserList struct {
|
|||||||
Users []*User `json:"list,omitempty"`
|
Users []*User `json:"list,omitempty"`
|
||||||
Pagination
|
Pagination
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var UserRouteNames = []string{
|
||||||
|
"MyTagList", "MyAddressBookList", "MyInfo", "MyAddressBookCollection", "MyPeer", "MyShareRecordList", "MyLoginLog",
|
||||||
|
}
|
||||||
|
var AdminRouteNames = []string{"*"}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package service
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"Gwen/global"
|
"Gwen/global"
|
||||||
adResp "Gwen/http/response/admin"
|
|
||||||
"Gwen/model"
|
"Gwen/model"
|
||||||
"Gwen/utils"
|
"Gwen/utils"
|
||||||
"errors"
|
"errors"
|
||||||
@@ -272,9 +271,9 @@ func (us *UserService) IsAdmin(u *model.User) bool {
|
|||||||
// RouteNames
|
// RouteNames
|
||||||
func (us *UserService) RouteNames(u *model.User) []string {
|
func (us *UserService) RouteNames(u *model.User) []string {
|
||||||
if us.IsAdmin(u) {
|
if us.IsAdmin(u) {
|
||||||
return adResp.AdminRouteNames
|
return model.AdminRouteNames
|
||||||
}
|
}
|
||||||
return adResp.UserRouteNames
|
return model.UserRouteNames
|
||||||
}
|
}
|
||||||
|
|
||||||
// InfoByOauthId 根据oauth的name和openId取用户信息
|
// InfoByOauthId 根据oauth的name和openId取用户信息
|
||||||
|
|||||||
Reference in New Issue
Block a user