def _process_args(self): RHContributionDisplayBase._process_args(self) self.editable_type = EditableType[request.view_args['type']] self.editable = (Editable.query .with_parent(self.contrib) .filter_by(type=self.editable_type) .first())
def _process_args(self): RHContributionDisplayBase._process_args(self) self.editable_type = EditableType[request.view_args['type']] self.editable = (Editable.query.with_parent( self.contrib).filter_by(type=self.editable_type).options( *self._editable_query_options).first()) if self.editable is None and self.EDITABLE_REQUIRED: raise NotFound
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()
def _check_access(self): RequireUserMixin._check_access(self) RHContributionDisplayBase._check_access(self)
def _check_access(self): if not TokenAccessMixin._token_can_access(self): RequireUserMixin._check_access(self) RHContributionDisplayBase._check_access(self)
def _check_access(self): RHContributionDisplayBase._check_access(self) if not session.user: raise Forbidden
def _checkParams(self, params): RHContributionDisplayBase._checkParams(self, params) self.paper_file = PaperFile.get_one(request.view_args['paper_file_id'])
def _checkParams(self, params): RHContributionDisplayBase._checkParams(self, params) self.paper_file = PaperFile.get_one(request.view_args['paper_file_id'])