Skip to content

Commit

Permalink
Refactor permissions checks to match changes made to neon-data-models
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Nov 19, 2024
1 parent d0776e9 commit 9095b54
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions neon_users_service/mq_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def parse_mq_request(self, mq_req: dict) -> dict:
auth_user = self.service.read_authenticated_user(
mq_req.auth_user_spec, mq_req.password,
mq_req.access_token)
if auth_user.permissions.diana < AccessRoles.ADMIN and \
auth_user.permissions.diana != AccessRoles.READ_USERS:
if auth_user.permissions.users < AccessRoles.USER and \
auth_user.permissions.users != AccessRoles.RW_USERS:
raise PermissionError(f"User {auth_user.username} does "
f"not have permission to read "
f"other users")
Expand All @@ -67,7 +67,7 @@ def parse_mq_request(self, mq_req: dict) -> dict:
# Get the authenticating user, maybe raising an AuthenticationError
auth = self.service.read_authenticated_user(mq_req.auth_username,
mq_req.auth_password)
if auth.permissions.diana < AccessRoles.ADMIN:
if auth.permissions.users < AccessRoles.ADMIN:
if auth.user_id != mq_req.user.user_id:
raise PermissionError(f"User {auth.username} does not "
f"have permission to modify "
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pydantic~=2.0
ovos-config~=0.1
ovos-utils~=0.0
neon-data-models
neon-data-models @ git+https://github.com/neongeckocom/neon-data-models@FEAT_UpdateUserDbCRUDOperations

0 comments on commit 9095b54

Please sign in to comment.