Skip to content

Commit

Permalink
Merge branch 'main' into use_source_for_confidence
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon-groundlight committed Oct 14, 2024
2 parents 5f0a7f8 + b89936d commit 0d7043d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/groundlight/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,15 @@ def whoami(self) -> str:
:return: str
"""
obj = self.user_api.who_am_i()
return obj["username"]
return obj["email"]

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

def get_detector(self, id: Union[str, Detector]) -> Detector: # pylint: disable=redefined-builtin
"""
Expand Down
7 changes: 7 additions & 0 deletions test/unit/test_user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from groundlight import Groundlight


def test_whoami(gl: Groundlight):
user = gl.whoami()
assert user is not None
assert isinstance(user, str)

0 comments on commit 0d7043d

Please sign in to comment.