Skip to content

Commit 65fe8a5

Browse files
fix(rbac): Emit event when owner is assigned org role (#568)
## πŸ“ Description https://github.com/renderedtext/tasks/issues/8572 ## βœ… Checklist - [x] I have tested this change - [ ] This change requires documentation update
1 parent b56bb17 commit 65fe8a5

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

β€Žee/rbac/lib/rbac/services/organization_created.exβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ defmodule Rbac.Services.OrganizationCreated do
1919

2020
Rbac.Store.RbacRole.create_default_roles_for_organization(event.org_id)
2121
Rbac.TempSync.assign_org_owner_role(event.org_id)
22+
owner_id = Rbac.TempSync.get_org_creator_id(event.org_id)
23+
Rbac.Events.Authorization.publish("role_assigned", owner_id, event.org_id)
2224
end,
2325
retries: 10,
2426
delay: 1000

β€Žee/rbac/lib/rbac/tmp_sync.exβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ defmodule Rbac.TempSync do
8383
end)
8484
end
8585

86-
defp get_org_creator_id(org_id, no_of_retries \\ 0) do
86+
def get_org_creator_id(org_id, no_of_retries \\ 0) do
8787
case Rbac.FrontRepo.Organization
8888
|> where([org], org.id == ^org_id)
8989
|> select([org], org.creator_id)

0 commit comments

Comments
Β (0)