Skip to content

Commit b89936d

Browse files
brandon-wadaAuto-format Bot
andauthored
User changes (#265)
Fixes to go along with user auth migration --------- Co-authored-by: Auto-format Bot <[email protected]>
1 parent 126f308 commit b89936d

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ packages = [
99
{include = "**/*.py", from = "src"},
1010
]
1111
readme = "README.md"
12-
version = "0.18.2"
12+
version = "0.18.3"
1313

1414
[tool.poetry.dependencies]
1515
# For certifi, use ">=" instead of "^" since it upgrades its "major version" every year, not really following semver

src/groundlight/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,15 @@ def whoami(self) -> str:
205205
:return: str
206206
"""
207207
obj = self.user_api.who_am_i()
208-
return obj["username"]
208+
return obj["email"]
209209

210210
def _user_is_privileged(self) -> bool:
211211
"""
212212
Return a boolean indicating whether the user is privileged.
213213
Privleged users have elevated permissions, so care should be taken when using a privileged account.
214214
"""
215215
obj = self.user_api.who_am_i()
216-
return obj["is_superuser"] or obj["is_staff"]
216+
return obj["is_superuser"]
217217

218218
def get_detector(self, id: Union[str, Detector]) -> Detector: # pylint: disable=redefined-builtin
219219
"""

test/unit/test_user.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from groundlight import Groundlight
2+
3+
4+
def test_whoami(gl: Groundlight):
5+
user = gl.whoami()
6+
assert user is not None
7+
assert isinstance(user, str)

0 commit comments

Comments
 (0)