Skip to content

Commit b63ca03

Browse files
authored
M kovalsky/userencoding (#546)
* fix user encoding * date
1 parent cdba1d0 commit b63ca03

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ An even better way to ensure the semantic-link-labs library is available in your
123123
2. Select your newly created environment within the 'Environment' drop down in the navigation bar at the top of the notebook
124124

125125
## Version History
126-
* [0.9.5](https://github.com/microsoft/semantic-link-labs/releases/tag/0.9.5) (March 6, 2025)
126+
* [0.9.5](https://github.com/microsoft/semantic-link-labs/releases/tag/0.9.5) (March 7, 2025)
127127
* [0.9.4](https://github.com/microsoft/semantic-link-labs/releases/tag/0.9.4) (February 27, 2025)
128128
* [0.9.3](https://github.com/microsoft/semantic-link-labs/releases/tag/0.9.3) (February 13, 2025)
129129
* [0.9.2](https://github.com/microsoft/semantic-link-labs/releases/tag/0.9.2) (February 5, 2025)

src/sempy_labs/_helper_functions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ def _build_url(url: str, params: dict) -> str:
3030
return url
3131

3232

33+
def _encode_user(user: str) -> str:
34+
35+
return urllib.parse.quote(user, safe="@")
36+
37+
3338
def create_abfss_path(
3439
lakehouse_id: UUID,
3540
lakehouse_workspace_id: UUID,

src/sempy_labs/admin/_workspaces.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from sempy_labs._helper_functions import (
22
_base_api,
33
_build_url,
4+
_encode_user,
45
)
56
from uuid import UUID
67
from typing import Optional
@@ -48,6 +49,8 @@ def add_user_to_workspace(
4849
f"{icons.red_dot} Invalid principal type. Please choose from {principal_types}"
4950
)
5051

52+
user = _encode_user(user)
53+
5154
payload = {
5255
"identifier": user, # identifier or emailAddress?
5356
"principalType": principal_type,
@@ -92,6 +95,7 @@ def delete_user_from_workspace(
9295

9396
(workspace_name, workspace_id) = _resolve_workspace_name_and_id(workspace)
9497

98+
user = _encode_user(user)
9599
url = f"/v1.0/myorg/admin/groups/{workspace_id}/users/{user}"
96100

97101
params = {}

0 commit comments

Comments
 (0)