fix: resolve bound im tenant for company admins

This commit is contained in:
richjohnrambo
2026-09-16 13:19:55 +08:00
parent 5dbbf39cce
commit c258e0473b
2 changed files with 22 additions and 5 deletions
+3 -3
View File
@@ -53,7 +53,7 @@ func resolveImAdminScopeWithAll(ctx context.Context, selectedTenantId int64, all
return scope, nil
}
if !contexts.IsTenantDept(ctx) {
if !contexts.IsTenantDept(ctx) && !(contexts.IsCompanyDept(ctx) && contexts.GetTenantId(ctx) > 0) {
return scope, gerror.New("当前账号无权管理IM租户")
}
tenantId, err := resolveImAdminBoundTenant(ctx)
@@ -68,10 +68,10 @@ func resolveImAdminScopeWithAll(ctx context.Context, selectedTenantId int64, all
}
func isImPlatformAdmin(ctx context.Context, operatorId int64) bool {
if contexts.IsCompanyDept(ctx) {
if service.AdminMember().VerifySuperId(ctx, operatorId) {
return true
}
return service.AdminMember().VerifySuperId(ctx, operatorId)
return contexts.IsCompanyDept(ctx) && contexts.GetTenantId(ctx) <= 0
}
func resolveImAdminBoundTenant(ctx context.Context) (int64, error) {