Exemplo n.º 1
0
    def can_perform_action(self, store, tip_id):
        rtip = db_access_rtip(store, self.current_user.user_id, tip_id)
        if not rtip.internaltip.context.enable_rc_to_wb_files:
            return errors.ForbiddenOperation()
        n = store.find(WhistleblowerFile, WhistleblowerFile.receivertip_id == rtip.id).count()
        if n > 100:
            return errors.FailedSanityCheck()

        rtip_dict = serialize_rtip(store, rtip, self.request.language)
        wbfile_names = [f['name'] for f in rtip_dict['wbfiles']]
        # The next line will throw a KeyError if the file is not set
        new_name = self.request.args['file'][0]['filename']
        if new_name in wbfile_names:
            return errors.FailedSanityCheck()

        return None
Exemplo n.º 2
0
        def https_disabled_wrapper(*args, **kwargs):
            if GLSettings.memory_copy.private.https_enabled:
                raise errors.FailedSanityCheck()

            return f(*args, **kwargs)