Skip to content

Commit

Permalink
calling notify when user_manager is created
Browse files Browse the repository at this point in the history
  • Loading branch information
nilbacardit26 committed Dec 12, 2024
1 parent 7b655dd commit bd84a19
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ CHANGELOG
7.0.4 (unreleased)
------------------

- Nothing changed yet.
- Calling notify event when user_manager folder is creatd, same with
group_manager
[nilbacardit26]


7.0.3 (2024-10-01)
Expand Down
8 changes: 6 additions & 2 deletions guillotina/contrib/dbusers/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from guillotina.interfaces import ILayers
from guillotina.utils import get_authenticated_user_id
from guillotina.utils import get_registry
from guillotina.event import notify
from guillotina.events import ObjectAddedEvent


USERS_LAYER = "guillotina.contrib.dbusers.interfaces.IDBUsersLayer"
Expand All @@ -16,12 +18,14 @@ async def install(self, site, request):
registry = await get_registry()
registry.for_interface(ILayers)["active_layers"] |= {USERS_LAYER}
user = get_authenticated_user_id()
await create_content_in_container(
user_manager = await create_content_in_container(
site, "UserManager", "users", creators=(user,), title="Users", check_constraints=False
)
await create_content_in_container(
await notify(ObjectAddedEvent(user_manager))
group_manager = await create_content_in_container(
site, "GroupManager", "groups", creators=(user,), title="Groups", check_constraints=False
)
await notify(ObjectAddedEvent(group_manager))

@classmethod
async def uninstall(self, site, request):
Expand Down

0 comments on commit bd84a19

Please sign in to comment.