mirror of
https://github.com/langgenius/dify.git
synced 2026-05-11 23:18:39 +08:00
fix: add miss name
This commit is contained in:
parent
5086dfcf74
commit
a3b00a2f83
@ -113,6 +113,7 @@ class AccessPolicyRoleBinding(_RBACModel):
|
||||
resource_type: str
|
||||
resource_id: str = ""
|
||||
role_id: str
|
||||
role_name: str = ""
|
||||
created_at: int = 0
|
||||
|
||||
|
||||
@ -123,6 +124,7 @@ class AccessPolicyMemberBinding(_RBACModel):
|
||||
resource_type: str
|
||||
resource_id: str = ""
|
||||
account_id: str
|
||||
account_name: str = ""
|
||||
created_at: int = 0
|
||||
|
||||
|
||||
|
||||
@ -220,6 +220,44 @@ class TestResourceAccess:
|
||||
assert call.params == {"app_id": "app-1"}
|
||||
assert out.app_id == "app-1"
|
||||
|
||||
def test_app_role_bindings_preserve_role_name(self, mock_send: MagicMock):
|
||||
mock_send.return_value = {
|
||||
"data": [
|
||||
{
|
||||
"id": "binding-1",
|
||||
"tenant_id": "tenant-1",
|
||||
"access_policy_id": "policy-1",
|
||||
"resource_type": "app",
|
||||
"resource_id": "app-1",
|
||||
"role_id": "role-1",
|
||||
"role_name": "Owner",
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
out = svc.RBACService.AppAccess.list_role_bindings("tenant-1", "acct-1", "app-1", "policy-1")
|
||||
|
||||
assert out.data[0].role_name == "Owner"
|
||||
|
||||
def test_app_member_bindings_preserve_account_name(self, mock_send: MagicMock):
|
||||
mock_send.return_value = {
|
||||
"data": [
|
||||
{
|
||||
"id": "binding-1",
|
||||
"tenant_id": "tenant-1",
|
||||
"access_policy_id": "policy-1",
|
||||
"resource_type": "app",
|
||||
"resource_id": "app-1",
|
||||
"account_id": "acct-1",
|
||||
"account_name": "Alice",
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
out = svc.RBACService.AppAccess.list_member_bindings("tenant-1", "acct-1", "app-1", "policy-1")
|
||||
|
||||
assert out.data[0].account_name == "Alice"
|
||||
|
||||
def test_app_replace_bindings(self, mock_send: MagicMock):
|
||||
mock_send.return_value = {"data": []}
|
||||
payload = svc.ReplaceBindings(role_ids=["workspace.owner"], account_ids=["acct-2"])
|
||||
|
||||
Loading…
Reference in New Issue
Block a user