知识库增加租户隔离
This commit is contained in:
@@ -64,5 +64,13 @@ func JWTAuthMiddleware() web.FilterFunc {
|
||||
ctx.Input.SetData("userId", claims.UserID)
|
||||
ctx.Input.SetData("username", claims.Username)
|
||||
ctx.Input.SetData("tenantId", claims.TenantId)
|
||||
|
||||
// 判断用户类型:检查userId是否在员工表中
|
||||
// 如果userId在yz_tenant_employees表中存在,则为员工登录;否则为用户登录
|
||||
userType := "user"
|
||||
if models.IsEmployee(claims.UserID) {
|
||||
userType = "employee"
|
||||
}
|
||||
ctx.Input.SetData("userType", userType)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user