Skip to content

Commit

Permalink
type fixes for rbac secured py
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton authored and nsoranzo committed Aug 1, 2024
1 parent a4e9a3a commit aeb8880
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/galaxy/managers/rbac_secured.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ def error_unless_permitted(self, item, user, trans=None):
error_info = dict(model_class=item.__class__, id=getattr(item, "id", None))
raise self.permission_failed_error_class(**error_info)

def grant(self, item, user, flush=True):
def grant(self, item, user, flush: bool = True):
raise NotImplementedError("abstract parent class")

def revoke(self, item, user, flush=True):
def revoke(self, item, user, flush: bool = True):
raise NotImplementedError("abstract parent class")

def _role_is_permitted(self, item, role):
Expand Down Expand Up @@ -197,13 +197,13 @@ def is_permitted(self, dataset, user, trans=None):
return True
return False

def grant(self, dataset, user, flush=True):
def grant(self, item, user, flush: bool = True):
private_role = self._user_private_role(user)
return self._grant_role(dataset, private_role, flush=flush)
return self._grant_role(item, private_role, flush=flush)

def revoke(self, dataset, user, flush=True):
def revoke(self, item, user, flush: bool = True):
private_role = self._user_private_role(user)
return self._revoke_role(dataset, private_role, flush=flush)
return self._revoke_role(item, private_role, flush=flush)

# ---- private
def _role_is_permitted(self, dataset, role):
Expand Down Expand Up @@ -253,13 +253,13 @@ def is_permitted(self, dataset, user, trans=None):
or self._user_has_all_roles(user, current_roles)
)

def grant(self, item, user):
def grant(self, item, user, flush: bool = True):
pass
# not so easy
# need to check for a sharing role
# then add the new user to it

def revoke(self, item, user):
def revoke(self, item, user, flush: bool = True):
pass
# not so easy

Expand Down

0 comments on commit aeb8880

Please sign in to comment.