Skip to content

Commit e0846b2

Browse files
author
edle
committed
Changes
1 parent 9f8ed47 commit e0846b2

File tree

2 files changed

+73
-1
lines changed

2 files changed

+73
-1
lines changed

libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/agent_notification.py

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,75 @@ async def handle_user_deleted(context, state, notification):
426426
"""
427427
return self.on_lifecycle_notification(AgentLifecycleEvent.USERDELETED, **kwargs)
428428

429+
def on_user_undeleted(
430+
self, **kwargs: Any
431+
) -> Callable[[AgentHandler], Callable[[TurnContext, TurnState], Awaitable[None]]]:
432+
"""Register a handler for user un-deletion lifecycle events.
433+
434+
This is a convenience decorator that registers a handler specifically for
435+
agentic user identity un-deletion events.
436+
437+
Args:
438+
**kwargs: Additional keyword arguments passed to the app's add_route method.
439+
440+
Returns:
441+
A decorator function that registers the handler with the application.
442+
443+
Example:
444+
```python
445+
@notifications.on_user_undeleted()
446+
async def handle_user_undeleted(context, state, notification):
447+
print("Agentic user identity un-deleted")
448+
```
449+
"""
450+
return self.on_lifecycle_notification(AgentLifecycleEvent.USERUNDELETED, **kwargs)
451+
452+
def on_user_updated(
453+
self, **kwargs: Any
454+
) -> Callable[[AgentHandler], Callable[[TurnContext, TurnState], Awaitable[None]]]:
455+
"""Register a handler for user updated lifecycle events.
456+
457+
This is a convenience decorator that registers a handler specifically for
458+
agentic user identity updated events.
459+
460+
Args:
461+
**kwargs: Additional keyword arguments passed to the app's add_route method.
462+
463+
Returns:
464+
A decorator function that registers the handler with the application.
465+
466+
Example:
467+
```python
468+
@notifications.on_user_updated()
469+
async def handle_user_updated(context, state, notification):
470+
print("Agentic user identity updated")
471+
```
472+
"""
473+
return self.on_lifecycle_notification(AgentLifecycleEvent.USERUPDATED, **kwargs)
474+
475+
def on_user_manager_updated(
476+
self, **kwargs: Any
477+
) -> Callable[[AgentHandler], Callable[[TurnContext, TurnState], Awaitable[None]]]:
478+
"""Register a handler for user manager updated lifecycle events.
479+
480+
This is a convenience decorator that registers a handler specifically for
481+
agentic user manager updated events.
482+
483+
Args:
484+
**kwargs: Additional keyword arguments passed to the app's add_route method.
485+
486+
Returns:
487+
A decorator function that registers the handler with the application.
488+
489+
Example:
490+
```python
491+
@notifications.on_user_manager_updated()
492+
async def handle_user_manager_updated(context, state, notification):
493+
print("Agentic user manager updated")
494+
```
495+
"""
496+
return self.on_lifecycle_notification(AgentLifecycleEvent.USERMANAGERUPDATED, **kwargs)
497+
429498
@staticmethod
430499
def _normalize_subchannel(value: str | AgentSubChannel | None) -> str:
431500
"""Normalize a subchannel value to a lowercase string.

libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/models/agent_lifecycle_event.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ class AgentLifecycleEvent(str, Enum):
1919

2020
USERCREATED = "agenticuseridentitycreated"
2121
USERWORKLOADONBOARDINGUPDATED = "agenticuserworkloadonboardingupdated"
22-
USERDELETED = "agenticuseridentitydeleted"
22+
USERDELETED = "agenticuserdeleted"
23+
USERUNDELETED = "agenticuserundeleted"
24+
USERUPDATED = "agenticuseridentityupdated"
25+
USERMANAGERUPDATED = "agenticusermanagerupdated"

0 commit comments

Comments
 (0)