Skip to content

Move access control backends into courseware - #543

Merged
OmarIthawi merged 1 commit into
appsembler/tahoe/developfrom
omar/move-acb-courseware
Mar 17, 2020
Merged

Move access control backends into courseware#543
OmarIthawi merged 1 commit into
appsembler/tahoe/developfrom
omar/move-acb-courseware

Conversation

@OmarIthawi

Copy link
Copy Markdown

Description

Moving Access Control Backends to the courseware Django app because it depends on AccessResponse class. Basically I made a mistake in not checking has_access properly and this PR fixes the issue. Otherwise, Course Access Groups will throw an exception.

Why

Access Control Backends were designed with the assumption that courseware.access.has_access returns a simple True or False. I turns out it returns a magical object of type AccessResponse, which can be cast to bool.

Reference

class AccessResponse(object):
"""Class that represents a response from a has_access permission check."""

and

def __nonzero__(self):
"""
Overrides bool().
Allows for truth value testing of AccessResponse objects, so callers
who do not need the specific error information can check if access
is granted.
Returns:
bool: whether or not access is granted
"""
return self.has_access

Because it depends on AccessResponse class
@OmarIthawi
OmarIthawi merged commit 04e9f59 into appsembler/tahoe/develop Mar 17, 2020
@OmarIthawi
OmarIthawi deleted the omar/move-acb-courseware branch March 17, 2020 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants