Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MA-199 Course Authorization framework in mobile API #6398

Merged
merged 1 commit into from
Jan 8, 2015

Conversation

nasthagiri
Copy link
Contributor

Please review. @aleffert @BenjiLee

@nasthagiri nasthagiri force-pushed the mobile/MA-199 branch 8 times, most recently from 6835837 to 41ba3b2 Compare January 5, 2015 16:57
# check enrollment
(
CourseEnrollment.is_enrolled(user, course.id) or
_has_staff_access_to_descriptor(user, course, course.id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if there's a way we can make the names more obvious. Since it's not just enrollment, it's also beta users though IIRC I had the same problem and didn't come up with anything good.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The can_load_mobile method checks enrollment in addition to the other checks.
The can_load_mobile_not_enrolled method does not check enrollment, but checks release date, beta user, and eventually cohorted content (once supported).

How about can_load_mobile and can_load_mobile_no_enrollment_check?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds good to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed load_mobile_not_enrolled -> load_mobile_no_enrollment_check in latest commit.

@aleffert
Copy link
Contributor

aleffert commented Jan 5, 2015

That's all from me.

from courseware.tests.factories import UserFactory
from student import auth
from student.models import CourseEnrollment

from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate imports.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops! Thanks. I'm surprised pylint doesn't raise this issue.

@nasthagiri
Copy link
Contributor Author

@BenjiLee @aleffert I believe I have addressed all your comments. Please see the latest commit edx/edx-platform@a221727.

from xmodule.modulestore.django import modulestore
from static_replace import make_static_urls_absolute, replace_static_urls

from ..utils import MobileView, mobile_course_access

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More unused imports:
from rest_framework import permissions
from rest_framework.authentication import OAuth2Authentication, SessionAuthentication

from opaque_keys.edx.keys import CourseKey
from xmodule.modulestore.django import modulestore

@aleffert
Copy link
Contributor

aleffert commented Jan 7, 2015

👍

self.client.login(username=self.username, password=self.password)

def logout(self):
"""Login test user."""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logout*

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@BenjiLee
Copy link
Contributor

BenjiLee commented Jan 7, 2015

👍

nasthagiri added a commit that referenced this pull request Jan 8, 2015
MA-199 Course Authorization framework in mobile API
@nasthagiri nasthagiri merged commit 3c274e2 into master Jan 8, 2015
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.

3 participants