...
|
...
|
@@ -143,30 +143,6 @@ func ChangeLoginToken(userid, companyid int64) (protocol.LoginAuthToken, error) |
|
|
return logintoken, nil
|
|
|
}
|
|
|
|
|
|
// func RefreshLoginToken(refreshtoken string) (protocol.LoginAuthToken, error) {
|
|
|
// var (
|
|
|
// logintoken protocol.LoginAuthToken
|
|
|
// mtoken *MyToken
|
|
|
// err error
|
|
|
// storetoken redisdata.RedisLoginToken
|
|
|
// )
|
|
|
// mtoken, err = ValidJWTToken(refreshtoken)
|
|
|
// if err != nil {
|
|
|
// log.Debug("token失效 err:%s", err)
|
|
|
// return logintoken, protocol.NewErrWithMessage("10024")
|
|
|
// }
|
|
|
// storetoken, err = redisdata.GetLoginToken(mtoken.UID, mtoken.CompanyID)
|
|
|
// if err != nil {
|
|
|
// log.Error("redis err:%s", err)
|
|
|
// return logintoken, protocol.NewErrWithMessage("10024")
|
|
|
// }
|
|
|
// if storetoken.RefreshToken != refreshtoken {
|
|
|
// return logintoken, protocol.NewErrWithMessage("10024")
|
|
|
// }
|
|
|
// logintoken, _ = GenerateAuthToken(mtoken.UID, mtoken.CompanyID)
|
|
|
// return logintoken, nil
|
|
|
// }
|
|
|
|
|
|
func LoginAuthByUCenter(account, password string) (protocol.LoginAuthToken, error) {
|
|
|
var (
|
|
|
err error
|
...
|
...
|
@@ -392,22 +368,6 @@ func GetUserHasMenu(userid, companyid int64) ([]protocol.ResponseUserHasMenu, er |
|
|
return list, nil
|
|
|
}
|
|
|
|
|
|
//主管拥有全部的菜单
|
|
|
// func getAdminHasMenu() ([]protocol.PermissionItem, error) {
|
|
|
// const datasql string = `SELECT id,name,icon,parent_id,senior_status,sort,code
|
|
|
// FROM menu WHERE enabled=1 ORDER BY sort `
|
|
|
// var (
|
|
|
// list = make([]protocol.PermissionItem, 0)
|
|
|
// err error
|
|
|
// )
|
|
|
// err = utils.ExecuteQueryAll(&list, datasql)
|
|
|
// if err != nil {
|
|
|
// log.Error("EXECUTE SQL err:%s", err)
|
|
|
// return nil, protocol.NewErrWithMessage("1")
|
|
|
// }
|
|
|
// return list, nil
|
|
|
// }
|
|
|
|
|
|
func LoginAuthBySmsCode(phone string, code string) (protocol.LoginAuthToken, error) {
|
|
|
var (
|
|
|
err error
|
...
|
...
|
@@ -532,10 +492,20 @@ func ValidUserPermission(urlPath string, userid int64, companyid int64) bool { |
|
|
ok bool = false
|
|
|
permissionObj serverbac.PermissionOptionObject
|
|
|
)
|
|
|
|
|
|
permissionbase, ok = serverbac.RouterPermission[urlPath]
|
|
|
if !ok {
|
|
|
return true
|
|
|
}
|
|
|
companyinfo, err := models.GetCompanyById(companyid)
|
|
|
if err != nil {
|
|
|
log.Error("获取公司数据失败")
|
|
|
return false
|
|
|
}
|
|
|
if companyinfo.AdminId == userid {
|
|
|
return true
|
|
|
}
|
|
|
|
|
|
permissionObj, err = redisdata.GetUserPermission(userid, permissionbase.CodeName)
|
|
|
if err != nil {
|
|
|
log.Error("未取到权限数据")
|
...
|
...
|
|