Skip to content

Commit e5277c7

Browse files
authored
Merge pull request #8 from SAPUCC/fix/externalusers
Fix: Support external users in Azure AD
2 parents a20d901 + b036528 commit e5277c7

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919

2020
-
2121

22+
## [0.1.3] - 2023-04-12
23+
24+
### Fix
25+
26+
- Fix: Support external users in Azure AD. (Remove _abc.com#EXT# artifacts from username)
27+
2228
## [0.1.2] - 2023-03-13
2329

2430
### Fix

inviter/ms_graph_connector.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
from inviter.config import Config
2626
from inviter.room_structure import MXID, PowerLevel, RoomMember, Room, RoomAlias
2727

28+
import re
29+
2830

2931
async def get_client(tenant_id: str, client_id: str, client_secret: str) -> GraphClient:
3032
"""
@@ -136,9 +138,10 @@ async def get_rooms(config: Config) -> List[Room]:
136138
elif account_enabled is False:
137139
continue
138140

139-
# Get room member details from user
141+
# Get room member details from user, remove artifacts of external users
142+
userPrincipalName: str = re.sub('\_.*#EXT#', '', user.get('userPrincipalName').split('@', 1)[0])
140143
mxid = config.get_renamed_mxid(
141-
MXID(user.get('userPrincipalName').split('@', 1)[0], member_homeserver))
144+
MXID(userPrincipalName, member_homeserver))
142145
permission_level = PowerLevel.STANDARD
143146

144147
# Group owners in AD get the moderator role in matrix room

maubot.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
maubot: 0.2.0
22
id: de.in4md-service.inviterbot
3-
version: 0.1.2
3+
version: 0.1.3
44
license: GPLv3
55
modules:
66
- inviter

0 commit comments

Comments
 (0)