feat(role): role bind

This commit is contained in:
2026-01-31 17:23:56 +08:00
parent 4dc46659c9
commit 41cdbb5b29
30 changed files with 1773 additions and 52 deletions

View File

@@ -4,8 +4,8 @@ use sqlx::PgPool;
use uuid::Uuid;
#[tokio::test]
async fn set_user_roles_is_idempotent_and_validates_tenant_roles(
) -> Result<(), Box<dyn std::error::Error>> {
async fn set_user_roles_is_idempotent_and_validates_tenant_roles()
-> Result<(), Box<dyn std::error::Error>> {
let database_url = match std::env::var("DATABASE_URL") {
Ok(v) if !v.trim().is_empty() => v,
_ => return Ok(()),
@@ -42,6 +42,7 @@ async fn set_user_roles_is_idempotent_and_validates_tenant_roles(
name: "R1".into(),
description: Some("role1".into()),
},
user_id,
)
.await?;
let role2 = role_service
@@ -51,6 +52,7 @@ async fn set_user_roles_is_idempotent_and_validates_tenant_roles(
name: "R2".into(),
description: Some("role2".into()),
},
user_id,
)
.await?;
@@ -80,6 +82,7 @@ async fn set_user_roles_is_idempotent_and_validates_tenant_roles(
name: "Other".into(),
description: None,
},
user_id,
)
.await?;