|
@@ -521,7 +521,7 @@ func SmsCodeCheck(phone string, code string) error { |
|
@@ -521,7 +521,7 @@ func SmsCodeCheck(phone string, code string) error { |
521
|
}
|
521
|
}
|
522
|
|
522
|
|
523
|
//InitPermission 登录时权限初始化
|
523
|
//InitPermission 登录时权限初始化
|
524
|
-func InitPermission(usercompanyid int64, usercompamyid int64) (map[string]serverbac.PermissionOptionObject, error) {
|
524
|
+func InitPermission(usercompanyid int64, userid int64) (map[string]serverbac.PermissionOptionObject, error) {
|
525
|
var (
|
525
|
var (
|
526
|
err error
|
526
|
err error
|
527
|
permissionMap = make(map[string]serverbac.PermissionOptionObject)
|
527
|
permissionMap = make(map[string]serverbac.PermissionOptionObject)
|
|
@@ -532,7 +532,7 @@ func InitPermission(usercompanyid int64, usercompamyid int64) (map[string]server |
|
@@ -532,7 +532,7 @@ func InitPermission(usercompanyid int64, usercompamyid int64) (map[string]server |
532
|
return permissionMap, err
|
532
|
return permissionMap, err
|
533
|
}
|
533
|
}
|
534
|
|
534
|
|
535
|
- err = redisdata.SetUserPermission(permissionMap, usercompamyid)
|
535
|
+ err = redisdata.SetUserPermission(permissionMap, userid)
|
536
|
if err != nil {
|
536
|
if err != nil {
|
537
|
log.Error("缓存用户权限失败:%s", err)
|
537
|
log.Error("缓存用户权限失败:%s", err)
|
538
|
}
|
538
|
}
|
|
@@ -575,11 +575,11 @@ func ValidUserPermission(urlPath string, userid int64, companyid int64) bool { |
|
@@ -575,11 +575,11 @@ func ValidUserPermission(urlPath string, userid int64, companyid int64) bool { |
575
|
//LoginAuthBySecretKey 使用秘钥进行登录
|
575
|
//LoginAuthBySecretKey 使用秘钥进行登录
|
576
|
func LoginAuthBySecretKey(secretKey string) (protocol.LoginAuthToken, error) {
|
576
|
func LoginAuthBySecretKey(secretKey string) (protocol.LoginAuthToken, error) {
|
577
|
var (
|
577
|
var (
|
578
|
- err error
|
|
|
579
|
- logintoken protocol.LoginAuthToken
|
|
|
580
|
- usercompanyid int64
|
|
|
581
|
- userdata *models.User
|
|
|
582
|
- companyData *models.Company
|
578
|
+ err error
|
|
|
579
|
+ logintoken protocol.LoginAuthToken
|
|
|
580
|
+ // usercompanyid int64
|
|
|
581
|
+ userdata *models.User
|
|
|
582
|
+ companyData *models.Company
|
583
|
)
|
583
|
)
|
584
|
var uclientReturn *ucenter.ResponseLogin
|
584
|
var uclientReturn *ucenter.ResponseLogin
|
585
|
uclientReturn, err = ucenter.RequestUCenterLoginBySecret(secretKey)
|
585
|
uclientReturn, err = ucenter.RequestUCenterLoginBySecret(secretKey)
|
|
@@ -628,6 +628,6 @@ func LoginAuthBySecretKey(secretKey string) (protocol.LoginAuthToken, error) { |
|
@@ -628,6 +628,6 @@ func LoginAuthBySecretKey(secretKey string) (protocol.LoginAuthToken, error) { |
628
|
if err != nil {
|
628
|
if err != nil {
|
629
|
log.Error("更新用户user_company数据失败:%s", err)
|
629
|
log.Error("更新用户user_company数据失败:%s", err)
|
630
|
}
|
630
|
}
|
631
|
- InitPermission(usercompanyid, userdata.Id)
|
631
|
+ InitPermission(ucompany.Id, userdata.Id)
|
632
|
return logintoken, err
|
632
|
return logintoken, err
|
633
|
} |
633
|
} |