Skip to content

Commit

Permalink
Update permissions for backwards compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Aug 26, 2023
1 parent 301b63d commit 10d33d1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pydatalab/pydatalab/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def get_default_permissions(user_only: bool = True) -> Dict[str, Any]:
):
return {}

null_perm = {"creator_ids": {"$size": 0}}
null_perm = {"$or": [{"creator_ids": {"$size": 0}}, {"creator_ids": {"$exists": False}}]}
if current_user.is_authenticated and current_user.person is not None:
# find managed users under the given user (can later be expanded to groups)
managed_users = list(
Expand All @@ -41,7 +41,7 @@ def get_default_permissions(user_only: bool = True) -> Dict[str, Any]:
)
if managed_users:
managed_users = [u["_id"] for u in managed_users]
LOGGER.info("Found users %s for user %s", managed_users, current_user.person)
LOGGER.debug("Found managed users %s for user %s", managed_users, current_user.person)

user_perm = {"creator_ids": {"$in": [current_user.person.immutable_id] + managed_users}}
if user_only:
Expand Down

0 comments on commit 10d33d1

Please sign in to comment.