Skip to content

Commit

Permalink
fix: modify code such that delete role binding when delete workspace …
Browse files Browse the repository at this point in the history
…space
  • Loading branch information
yjinjo committed Oct 2, 2024
1 parent a883c77 commit f942557
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/spaceone/identity/service/workspace_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
from spaceone.identity.manager.project_manager import ProjectManager
from spaceone.identity.manager.resource_manager import ResourceManager
from spaceone.identity.manager.role_binding_manager import RoleBindingManager
from spaceone.identity.manager.service_account_manager import ServiceAccountManager
from spaceone.identity.manager.trusted_account_manager import TrustedAccountManager
from spaceone.identity.manager.workspace_group_manager import WorkspaceGroupManager
from spaceone.identity.manager.service_account_manager import \
ServiceAccountManager
from spaceone.identity.manager.trusted_account_manager import \
TrustedAccountManager
from spaceone.identity.manager.workspace_group_manager import \
WorkspaceGroupManager
from spaceone.identity.manager.workspace_manager import WorkspaceManager
from spaceone.identity.model import Workspace
from spaceone.identity.model.workspace.request import *
Expand Down Expand Up @@ -482,7 +485,6 @@ def _remove_workspace_from_group_with_workspace_vo(
self, workspace_vo: Workspace, old_workspace_group_id: str, domain_id: str
) -> None:
workspace_id = workspace_vo.workspace_id
self._delete_role_bindings(workspace_id, domain_id, old_workspace_group_id)

workspace_vo.changed_at = datetime.utcnow()
workspace_vo.workspace_group_id = None
Expand All @@ -496,6 +498,9 @@ def _remove_workspace_from_group_with_workspace_vo(
],
}
).get("results", [])
self._delete_role_bindings(
workspace_id, domain_id, old_workspace_group_id, user_rb_ids
)
user_rb_total_count = len(user_rb_ids)

self.workspace_mgr.update_workspace_by_vo(
Expand Down

0 comments on commit f942557

Please sign in to comment.