Esempio n. 1
0
def test_contrib_explicit_access(dummy_event, dummy_user, allowed, event_allowed):
    dummy_event.protection_mode = ProtectionMode.public if event_allowed else ProtectionMode.protected
    rh = RHContributionDisplayBase()
    rh.event = dummy_event
    rh.contrib = MagicMock()
    rh.contrib.can_access.return_value = allowed
    # event access should not matter for the RH access check as having access e.g.
    # to a specific contribution lets users view the details for that contribution
    assert dummy_event.can_access(dummy_user) == event_allowed
    if allowed:
        rh._check_access()
    else:
        with pytest.raises(Forbidden):
            rh._check_access()
Esempio n. 2
0
 def _check_access(self):
     RequireUserMixin._check_access(self)
     RHContributionDisplayBase._check_access(self)
Esempio n. 3
0
 def _check_access(self):
     if not TokenAccessMixin._token_can_access(self):
         RequireUserMixin._check_access(self)
         RHContributionDisplayBase._check_access(self)
Esempio n. 4
0
 def _check_access(self):
     RHContributionDisplayBase._check_access(self)
     if not session.user:
         raise Forbidden