Skip to content

Restrict access to users that have not accepted terms of use#507

Merged
jsnshrmn merged 4 commits into
WikipediaLibrary:masterfrom
suecarmol:suecarmol/T260229-restrict-access-no-terms
Aug 27, 2020
Merged

Restrict access to users that have not accepted terms of use#507
jsnshrmn merged 4 commits into
WikipediaLibrary:masterfrom
suecarmol:suecarmol/T260229-restrict-access-no-terms

Conversation

@suecarmol

@suecarmol suecarmol commented Aug 13, 2020

Copy link
Copy Markdown
Contributor

Description

Describe your changes in detail following the commit message guidelines
Added a condition to check if a user has agreed to the terms of service in order to get any access to the library's collections.

Rationale

The button for an individual partner is not greyed-out when a user has not accepted the terms of service, which shouldn't be happening.

Phabricator Ticket

T260229

How Has This Been Tested?

A test was added to check the correct functionality of the user_update_eligibility management command and made manual tests to check that access is being granted or denied based on acceptance of the terms of use.

Manual test instructions:

Manual test 1:

  1. If a user is bundle eligible, has agreed to the terms of use, and is logged in, they should be able to access the collections.
  2. Go to the terms of use page and opt-out of the terms.
  3. Navigate to the bundle library. Buttons should be greyed-out.
  4. Click on one of the bundle partners. The Access Collection button should be greyed-out.
  5. Go to the terms of use page and accept the terms again.
  6. User should have access to bundle items again

Manual test 2:

  1. If a user is bundle eligible, has agreed to the terms of use, and is logged in, they should be able to access the collections.
  2. Go to the terms of use page and opt-out of the terms.
  3. Log out of your session.
  4. Log back in and, without agreeing to the terms of service, navigate to the library bundle page.
  5. User should see library bundle permission is expired.
  6. Go to the terms of use page and accept the terms again.
  7. Log out and log back in. User should again have access to the library bundle collections.

Screenshots of your changes (if appropriate):

User is bundle eligible and has agreed to the terms of use

Screen Shot 2020-08-13 at 19 19 01

Screen Shot 2020-08-13 at 19 19 15

User is bundle eligible but has not agreed to the terms of use

Screen Shot 2020-08-13 at 19 19 42

Screen Shot 2020-08-13 at 19 19 51

User is bundle eligible, has not agreed to the terms of use, logged out and logged back in

Screen Shot 2020-08-13 at 19 21 05

Types of changes

What types of changes does your code introduce? Add an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

@suecarmol suecarmol changed the title [WIP] Restrict access to users that have not accepted terms of use Restrict access to users that have not accepted terms of use Aug 14, 2020

@jsnshrmn jsnshrmn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd call TWLight.users.helpers.editor_data.editor_bundle_eligible() and update the editor's eligibility upon accepting terms. Other than that and one inline comment, this is looking good!

Comment thread TWLight/resources/templates/resources/partner_detail.html Outdated
@suecarmol
suecarmol requested a review from jsnshrmn August 20, 2020 18:39
Comment thread TWLight/resources/views.py Outdated
@suecarmol
suecarmol requested a review from jsnshrmn August 24, 2020 19:40

@jsnshrmn jsnshrmn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good!

@jsnshrmn
jsnshrmn merged commit c02477b into WikipediaLibrary:master Aug 27, 2020
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