Skip to content

Commit

Permalink
fix(auth): Fixed Auth method for checking study permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
b32147 committed Nov 3, 2020
1 parent faaea36 commit ec728e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions ppmutils/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,24 +121,24 @@ def has_ppm_permission(cls, permissions, method=None):
return item is not None and permission is not None

@classmethod
def has_study_permission(cls, method, permissions, study):
def has_study_permission(cls, permissions, study, method=None):
"""
Inspects the set of permissions and returns whether this
user has needed permissions on the particular PPM study
for the given operation.
:param method: The requested method to check permissions for
:type method: str
:param permissions: A list of permissions from DBMI-AuthZ
:type permissions: list
:param study: A specific study
:type study: str
:param method: The requested method to check permissions for
:type method: str, default None
:returns: Whether the user has the permissions or not
:rtype: bool
"""

# Get permission
item, permission = Auth.get_permission(method, permissions, study)
item, permission = Auth.get_permission(permissions, method=method, study=study)

return item is not None and permission is not None

Expand Down
2 changes: 1 addition & 1 deletion ppmutils/ppm.py
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ def questionnaire_for_study(study):
return PPM.Questionnaire.RANTQuestionnaire.value

elif PPM.Study.get(study) is PPM.Study.EXAMPLE:
return PPM.Questionnaire.ExampleQuestionnaire.value
return PPM.Questionnaire.EXAMPLEQuestionnaire.value

@staticmethod
def questionnaire_for_consent(composition):
Expand Down

0 comments on commit ec728e6

Please sign in to comment.