1
0
forked from baron/baron-sso

Merge branch 'dev' into feature/af-issue363

This commit is contained in:
2026-03-18 09:05:23 +09:00
35 changed files with 2225 additions and 317 deletions

View File

@@ -34,15 +34,16 @@ func SyncKetoRelations(db *gorm.DB, keto service.KetoService) error {
}
slog.Info("Syncing users to Keto", "count", len(users))
for _, u := range users {
role := domain.NormalizeRole(u.Role)
// Membership
if u.TenantID != nil {
_ = keto.CreateRelation(ctx, "Tenant", *u.TenantID, "members", "User:"+u.ID)
}
// Roles
if u.Role == domain.RoleSuperAdmin {
if role == domain.RoleSuperAdmin {
_ = keto.CreateRelation(ctx, "System", "global", "super_admins", "User:"+u.ID)
} else if u.Role == domain.RoleTenantAdmin && u.TenantID != nil {
} else if role == domain.RoleTenantAdmin && u.TenantID != nil {
_ = keto.CreateRelation(ctx, "Tenant", *u.TenantID, "admins", "User:"+u.ID)
}
}