Пример #1
0
    def delete_context(self, context_gus):
        """
        This DELETE operation, its permanent, and remove all the reference
        a Context has within the system (Tip, File, submission...)
        """
        store = self.getStore()

        # Get context description, just to verify that context_gus is valid
        context_iface = Context(store)
        context_desc = context_iface.get_single(context_gus)

        # Collect tip by context and iter on the list
        receivertip_iface = ReceiverTip(store)
        tips_related_blocks = receivertip_iface.get_tips_by_context(context_gus)

        internaltip_iface = InternalTip(store)
        whistlebtip_iface = WhistleblowerTip(store)
        file_iface = File(store)
        comment_iface = Comment(store)

        # For every InternalTip, delete comment, wTip, rTip and Files
        for tip_block in tips_related_blocks:

            internaltip_id = tip_block.get('internaltip')['internaltip_id']

            whistlebtip_iface.delete_access_by_itip(internaltip_id)
            receivertip_iface.massive_delete(internaltip_id)
            comment_iface.delete_comment_by_itip(internaltip_id)
            file_iface.delete_file_by_itip(internaltip_id)

            # and finally, delete the InternalTip
            internaltip_iface.tip_delete(internaltip_id)

        # (Just a consistency check - need to be removed)
        receiver_iface = Receiver(store)
        receivers_associated = receiver_iface.get_receivers_by_context(context_gus)
        print "receiver associated by context POV:", len(receivers_associated),\
        "receiver associated by context DB-field:", len(context_desc['receivers'])

        # Align all the receiver associated to the context, that the context cease to exist
        receiver_iface.align_context_delete(context_desc['receivers'], context_gus)

        # Get the profile list related to context_gus and delete all of them
        profile_iface = PluginProfiles(store)
        profile_list = profile_iface.get_profiles_by_contexts([ context_gus ])
        for prof in profile_list:
            profile_iface.delete_profile(prof['profile_gus'])

        # Get the submission list under the context, and delete all of them
        submission_iface = Submission(store)
        submission_list = submission_iface.get_all()
        for single_sub in submission_list:
            submission_iface.submission_delete(single_sub['submission_gus'], wb_request=False)

        # Finally, delete the context
        context_iface.delete_context(context_gus)

        self.returnData(context_desc)
        self.returnCode(200)
        return self.prepareRetVals()
Пример #2
0
    def get(self, receiver_token_auth, *uriargs):
        """
        Parameters: receiver_token_auth
        Response: receiverProfileList
        Errors: None
        """

        try:
            # TODO receiver_token_auth sanity and security check

            receivertip_iface = ReceiverTip()
            receivers_map = yield receivertip_iface.get_receivers_by_tip(receiver_token_auth)
            # receivers_map is a dict with these keys: 'others' : [$], 'actor': $, 'mapped' [ ]

            receiver_associated_contexts = receivers_map['actor']['contexts']

            profile_iface = PluginProfiles()
            profiles_list = yield profile_iface.get_profiles_by_contexts(receiver_associated_contexts)

            # TODO output filtering to receiver recipient
            # self.write(json.dumps(profiles_list))
            self.write({'a' : profiles_list})
            self.set_status(200)

        except TipGusNotFound, e: # InvalidTipAuthToken

            self.set_status(e.http_status)
            self.write({'error_message': e.error_message, 'error_code' : e.error_code})
Пример #3
0
    def do_fileprocess_validation(self, store, context_gus, filepath ):

        plugin_type = u'fileprocess'

        profile_iface = PluginProfiles(store)
        profile_associated = profile_iface.get_profiles_by_contexts([ context_gus ] )

        plugin_found = False
        validate_file = False

        for p_cfg in profile_associated:

            # Plugin FileProcess
            if p_cfg['plugin_type'] != plugin_type:
                continue

            plugin_found = True
            print "processing", filepath, "using the profile", p_cfg['profile_gus'], "configured for", p_cfg['plugin_name']

            plugin = PluginManager.instance_plugin(p_cfg['plugin_name'])
            validate_file = plugin.do_fileprocess(filepath, p_cfg['admin_settings'])

        if not plugin_found:
            # FileProcess profile has been not configured, file accepted by default
            validate_file = True

        return validate_file
Пример #4
0
    def get_profile_list(self):

        profile_iface = PluginProfiles(self.getStore())
        all_profiles = profile_iface.get_all()

        self.returnData(all_profiles)
        self.returnCode(200)
        return self.prepareRetVals()
Пример #5
0
    def get(self, what, *uriargs):
        """
        Parameters: None
        Response: Unknown
        Errors: None

        /admin/overview GET should return up to all the tables of GLBackend
        """
        from globaleaks.models.externaltip import ReceiverTip, WhistleblowerTip, Comment
        from globaleaks.models.options import PluginProfiles, ReceiverConfs
        from globaleaks.models.internaltip import InternalTip
        from globaleaks.models.receiver import Receiver

        expected = [ 'itip', 'wtip', 'rtip', 'receivers', 'comment', 'profiles', 'rcfg', 'all' ]

        if what == 'receivers' or what == 'all':
            receiver_iface = Receiver()
            receiver_list = yield receiver_iface.admin_get_all()
            self.write({ 'elements' : len(receiver_list), 'receivers' : receiver_list})

        if what == 'itip' or what == 'all':
            itip_iface = InternalTip()
            itip_list = yield itip_iface.admin_get_all()
            self.write({ 'elements' : len(itip_list), 'internaltips' : itip_list })

        if what == 'rtip' or what == 'all':
            rtip_iface = ReceiverTip()
            rtip_list = yield rtip_iface.admin_get_all()
            self.write({ 'elements' : len(rtip_list), 'receivers_tips' : rtip_list })

        if what == 'wtip' or what == 'all':
            wtip_iface = WhistleblowerTip()
            wtip_list = yield wtip_iface.admin_get_all()
            self.write({ 'elements' : len(wtip_list), 'whistleblower_tips' : wtip_list })

        if what == 'comment' or what == 'all':
            comment_iface = Comment()
            comment_list = yield comment_iface.admin_get_all()
            self.write({ 'elements' : len(comment_list), 'comments' : comment_list })

        if what == 'profiles' or what == 'all':
            profile_iface = PluginProfiles()
            profile_list = yield profile_iface.admin_get_all()
            self.write({ 'elements' : len(profile_list), 'profiles' : profile_list })

        if what == 'rcfg' or what == 'all':
            rconf_iface = ReceiverConfs()
            rconf_list = yield rconf_iface.admin_get_all()
            self.write({ 'elements' : len(rconf_list), 'settings' : rconf_list })


        if not what in expected:
            self.set_status(405)
        else:
            self.set_status(200)

        self.finish()
Пример #6
0
    def update_profile(self, profile_gus, request):

        profile_iface = PluginProfiles(self.getStore())

        profile_description = profile_iface.update(profile_gus, request)

        self.returnData(profile_description)
        self.returnCode(201)
        return self.prepareRetVals()
Пример #7
0
    def get_profile(self, profile_gus):

        profile_iface = PluginProfiles(self.getStore())

        profile_description = profile_iface.get_single(profile_gus)

        self.returnData(profile_description)
        self.returnCode(200)
        return self.prepareRetVals()
Пример #8
0
    def get_profiles_by_receiver(self, receiver_associated_contexts):

        store = self.getStore()

        profile_iface = PluginProfiles(store)
        profiles_list = profile_iface.get_profiles_by_contexts(receiver_associated_contexts)

        self.returnData(profiles_list)
        self.returnCode(200)
        return self.prepareRetVals()
Пример #9
0
    def get(self, *uriargs):
        """
        Parameters: profile_gus
        Response: adminProfileList
        Errors: ProfileGusNotFound
        """

        profile_iface = PluginProfiles()
        profiles_list = yield profile_iface.get_all()

        self.set_status(200)
        # TODO outputSanitization + json
        self.write(json.dumps(profiles_list))
        self.finish()
Пример #10
0
    def put(self, receiver_token_auth, conf_id, *uriargs):
        """
        Parameters:
        Parameters: receiver_token_auth, receiver_configuration_id
        Request: receiverConfDesc
        Response: receiverConfDesc
        Errors: InvalidInputFormat, ProfileGusNotFound, ContextGusNotFound, ReceiverGusNotFound,

        update the resource ReceiverConf by a specific receiver, and if is requested as active,
        deactivate the others related to the same context.
        """

        receivertip_iface = ReceiverTip()

        try:
            request = validateMessage(self.request.body, requests.receiverReceiverDesc)

            receivers_map = yield receivertip_iface.get_receivers_by_tip(receiver_token_auth)
            user = receivers_map['actor']

            # ++ sanity checks that can't be make by validateMessage or by model:
            profile_iface = PluginProfiles()
            profile_desc = yield profile_iface.get_single(request['profile_gus'])

            if profile_desc['plugin_type'] == u'notification' and user['can_configure_notification']:
                pass
            elif profile_desc['plugin_type'] == u'delivery' and user['can_configure_delivery']:
                pass
            else:
                raise ForbiddenOperation
            # -- end of the sanity checks

            receivercfg_iface = ReceiverConfs()
            config_update = yield receivercfg_iface.update(conf_id, user['receiver_gus'], request)

            if config_update['active']:
                # keeping active only the last configuration requested
                yield receivercfg_iface.deactivate_all_but(config_update['config_id'], config_update['context_gus'],
                    user['receiver_gus'], config_update['plugin_type'])

            self.write(config_update)
            self.set_status(200) # OK

        except InvalidTipAuthToken, e:

            self.set_status(e.http_status)
            self.write({'error_message': e.error_message, 'error_code' : e.error_code})
Пример #11
0
    def comment_notification(self):

        plugin_type = u'notification'
        store = self.getStore()

        comment_iface = Comment(store)
        internaltip_iface = InternalTip(store)
        receivercfg_iface = ReceiverConfs(store)
        profile_iface = PluginProfiles(store)

        not_notified_comments = comment_iface.get_comment_by_mark(marker=u'not notified')

        for comment in not_notified_comments:

            receivers_list = internaltip_iface.get_receivers_by_itip(comment['internaltip_id'])

            # needed to obtain context!
            itip_info = internaltip_iface.get_single(comment['internaltip_id'])

            for receiver_info in receivers_list:

                receiver_conf = receivercfg_iface.get_active_conf(receiver_info['receiver_gus'],
                    itip_info['context_gus'], plugin_type)

                if receiver_conf is None:
                    # TODO applicative log, database tracking of queue
                    continue

                # Ok, we had a valid an appropriate receiver configuration for the notification task
                related_profile = profile_iface.get_single(receiver_conf['profile_gus'])

                settings_dict = { 'admin_settings' : related_profile['admin_settings'],
                                  'receiver_settings' : receiver_conf['receiver_settings']}

                plugin = PluginManager.instance_plugin(related_profile['plugin_name'])

                return_code = plugin.do_notify(settings_dict, u'comment', comment)

                if return_code:
                    print "Notification of comment successful for user", receiver_conf['receiver_gus']
                else:
                    print "Notification of comment failed for user", receiver_conf['receiver_gus']

            # remind: comment are not guarantee until Task manager is not developed
            comment_iface.flip_mark(comment['comment_id'], u'notified')
Пример #12
0
    def post(self, receiver_token_auth, *uriargs):
        """
        Parameters: receiver_token_auth
        Request: receiverConfDesc
        Response: receiverConfDesc
        Errors: TipGusNotFound, InvalidTipAuthToken, ForbiddenOperation, ContextGusNotFound, ReceiverGusNotFound

        Create a new configuration for a plugin
        """

        receivertip_iface = ReceiverTip()

        try:
            request = validateMessage(self.request.body, requests.receiverReceiverDesc)

            receivers_map = yield receivertip_iface.get_receivers_by_tip(receiver_token_auth)
            user = receivers_map['actor']

            # ++ sanity checks that can't be make by validateMessage or by model:
            profile_iface = PluginProfiles()
            profile_desc = yield profile_iface.get_single(request['profile_gus'])

            if profile_desc['plugin_type'] == u'notification' and user['can_configure_notification']:
                pass
            elif profile_desc['plugin_type'] == u'delivery' and user['can_configure_delivery']:
                pass
            else:
                raise ForbiddenOperation
            # -- end of the sanity checks

            receivercfg_iface = ReceiverConfs()
            config_desc = yield receivercfg_iface.new(user['receiver_gus'], request)

            if config_desc['active']:
                # keeping active only the last configuration requested
                yield receivercfg_iface.deactivate_all_but(config_desc['config_id'], config_desc['context_gus'],
                    user['receiver_gus'], config_desc['plugin_type'])

            self.write(config_desc)
            self.set_status(201) # Created

        except InvalidTipAuthToken, e:

            self.set_status(e.http_status)
            self.write({'error_message': e.error_message, 'error_code' : e.error_code})
Пример #13
0
    def tip_notification(self):

        plugin_type = u'notification'
        store = self.getStore()

        receivertip_iface = ReceiverTip(store)
        receivercfg_iface = ReceiverConfs(store)
        profile_iface = PluginProfiles(store)

        not_notified_tips = receivertip_iface.get_tips_by_notification_mark(u'not notified')

        for single_tip in not_notified_tips:

        # from a single tip, we need to extract the receiver, and then, having
        # context + receiver, find out which configuration setting has active

            receivers_map = receivertip_iface.get_receivers_by_tip(single_tip['tip_gus'])

            receiver_info = receivers_map['actor']

            receiver_conf = receivercfg_iface.get_active_conf(receiver_info['receiver_gus'],
               single_tip['context_gus'], plugin_type)

            if receiver_conf is None:
               print "Receiver", receiver_info['receiver_gus'],\
               "has not an active notification settings in context", single_tip['context_gus'], "for", plugin_type
                # TODO separate key in answer
               continue

            # Ok, we had a valid an appropriate receiver configuration for the notification task
            related_profile = profile_iface.get_single(receiver_conf['profile_gus'])

            settings_dict = { 'admin_settings' : related_profile['admin_settings'],
                             'receiver_settings' : receiver_conf['receiver_settings']}

            plugin = PluginManager.instance_plugin(related_profile['plugin_name'])

            updated_tip = receivertip_iface.update_notification_date(single_tip['tip_gus'])
            return_code = plugin.do_notify(settings_dict, u'tip', updated_tip)

            if return_code:
               receivertip_iface.flip_mark(single_tip['tip_gus'], u'notified')
            else:
               receivertip_iface.flip_mark(single_tip['tip_gus'], u'unable to notify')
Пример #14
0
    def operation(self):
        """
        Goal of this function is to check all the new files and validate
        thru the configured SystemSettings

        possible marker in the file are:
            'not processed', 'ready', 'blocked', 'stored'
        defined in File._marker

        """
        plugin_type = u'fileprocess'

        file_iface = File()
        profile_iface = PluginProfiles()

        not_processed_file = yield file_iface.get_file_by_marker(file_iface._marker[0])

        print "FileProcess", not_processed_file

        for single_file in not_processed_file:

            profile_associated = yield profile_iface.get_profiles_by_contexts([ single_file['context_gus'] ] )

            for p_cfg in profile_associated:

                if p_cfg['plugin_type'] != plugin_type:
                    continue

                print "processing", single_file['file_name'], "using the profile", p_cfg['profile_gus'], "configured for", p_cfg['plugin_name']
                plugin = PluginManager.instance_plugin(p_cfg['plugin_name'])

                try:
                    tempfpath = os.path.join(config.advanced.submissions_dir, single_file['file_gus'])
                except AttributeError:
                    # XXX hi level danger Log - no directory present to perform file analysis
                    continue

                return_code = plugin.do_fileprocess(tempfpath, p_cfg['admin_settings'])

                # Todo Log/stats in both cases
                if return_code:
                    yield file_iface.flip_mark(single_file['file_gus'], file_iface._marker[1]) # ready
                else:
                    yield file_iface.flip_mark(single_file['file_gus'], file_iface._marker[2]) # blocked
Пример #15
0
    def get(self, profile_gus, *uriargs):
        """
        Parameters: profile_gus
        Response: adminProfileDesc
        Errors: ProfileGusNotFound
        """

        plugin_iface = PluginProfiles()

        try:
            profile_description = yield plugin_iface.get_single(profile_gus)

            self.set_status(200)
            self.write(profile_description)

        except ProfileGusNotFound, e:

            self.set_status(e.http_status)
            self.write({'error_message': e.error_message, 'error_code' : e.error_code})
Пример #16
0
    def delete(self, profile_gus, *uriargs):
        """
        Request: adminProfileDesc
        Response: None
        Errors: ProfileGusNotFound, InvalidInputFormat
        """

        try:
            # TODO parameter validation
            profile_iface = PluginProfiles()

            # TODO get context_gus, put a message in admin+context that a profile
            # has been removed and need to be replaced

            yield profile_iface.delete_profile(profile_gus)
            self.set_status(200)

        except InvalidInputFormat, e:

            self.set_status(e.http_status)
            self.write({'error_message': e.error_message, 'error_code' : e.error_code})
Пример #17
0
    def post(self, *uriargs):
        """
        Request: adminProfileDesc
        Response: adminProfileDesc
        Errors: InvalidInputFormat, ProfileNameConflict
        """

        try:
            # TODO input mesage validation, or InvalidInputFormat
            request = validateMessage(self.request.body, requests.adminProfileDesc)

            profile_iface = PluginProfiles()

            profile_description = yield profile_iface.new(request)

            self.set_status(200)
            self.write(profile_description)

        except InvalidInputFormat, e:

            self.set_status(e.http_status)
            self.write({'error_message': e.error_message, 'error_code' : e.error_code})
Пример #18
0
    def put(self, profile_gus, *uriargs):
        """
        Parameters: profile_gus
        Request: adminProfileDesc
        Response: adminProfileDesc
        Errors: ProfileGusNotFound, InvalidInputFormat, ProfileNameConflict
        """

        try:
            # TODO input mesage validation + parameter validation
            request = validateMessage(self.request.body, requests.adminProfileDesc)

            profile_iface = PluginProfiles()

            profile_description = yield profile_iface.update(profile_gus, request)

            self.set_status(200)
            self.write(profile_description)

        except ProfileGusNotFound, e:

            self.set_status(e.http_status)
            self.write({'error_message': e.error_message, 'error_code' : e.error_code})
Пример #19
0
    def fileprocess(self):

        plugin_type = u'fileprocess'

        store = self.getStore()

        file_iface = File(store)
        profile_iface = PluginProfiles(store)

        not_processed_file = file_iface.get_file_by_marker(file_iface._marker[0])

        for single_file in not_processed_file:

            profile_associated = profile_iface.get_profiles_by_contexts([ single_file['context_gus'] ] )

            for p_cfg in profile_associated:

                if p_cfg['plugin_type'] != plugin_type:
                    continue

                print "processing", single_file['file_name'], "using the profile", p_cfg['profile_gus'], "configured for", p_cfg['plugin_name']
                plugin = PluginManager.instance_plugin(p_cfg['plugin_name'])

                try:
                    tempfpath = os.path.join(config.advanced.submissions_dir, single_file['file_gus'])
                except AttributeError:
                    # XXX hi level danger Log - no directory present to perform file analysis
                    continue

                return_code = plugin.do_fileprocess(tempfpath, p_cfg['admin_settings'])

                # Todo Log/stats in both cases
                if return_code:
                    file_iface.flip_mark(single_file['file_gus'], file_iface._marker[1]) # ready
                else:
                    file_iface.flip_mark(single_file['file_gus'], file_iface._marker[2]) # blocked
Пример #20
0
    def get(self, what, *uriargs):
        """
        Parameters: None
        Response: Unknown
        Errors: None

        /dump/overview GET should return up to all the tables of GLBackend
        """

        expected = [ 'itip', 'wtip', 'rtip', 'receivers', 'comment',
                     'profiles', 'rcfg', 'file', 'submission', 'contexts', 'plugins', 'all', 'count' ]

        outputDict = {}

        if what == 'receivers' or what == 'all' or what == 'count':
            receiver_iface = Receiver()
            receiver_list = yield receiver_iface.get_all()

            if what != 'count':
                outputDict.update({ 'receivers_elements' : len(receiver_list), 'receivers' : receiver_list})
            else:
                outputDict.update({ 'receivers_elements' : len(receiver_list)})

        if what == 'itip' or what == 'all' or what == 'count':
            itip_iface = InternalTip()
            itip_list = yield itip_iface.get_all()

            if what != 'count':
                outputDict.update({ 'internaltips_elements' : len(itip_list), 'internaltips' : itip_list })
            else:
                outputDict.update({ 'internaltips_elements' : len(itip_list)})

        if what == 'rtip' or what == 'all' or what == 'count':
            rtip_iface = ReceiverTip()
            rtip_list = yield rtip_iface.get_all()

            if what != 'count':
                outputDict.update({ 'rtip_elements' : len(rtip_list), 'receivers_tips' : rtip_list })
            else:
                outputDict.update({ 'rtip_elements' : len(rtip_list)})

        if what == 'wtip' or what == 'all' or what == 'count':
            wtip_iface = WhistleblowerTip()
            wtip_list = yield wtip_iface.get_all()

            if what != 'count':
                outputDict.update({ 'wtip_elements' : len(wtip_list), 'whistleblower_tips' : wtip_list })
            else:
                outputDict.update({ 'wtip_elements' : len(wtip_list)})

        if what == 'comment' or what == 'all' or what == 'count':
            comment_iface = Comment()
            comment_list = yield comment_iface.get_all()

            if what != 'count':
                outputDict.update({ 'comment_elements' : len(comment_list), 'comments' : comment_list })
            else:
                outputDict.update({ 'comment_elements' : len(comment_list)})

        if what == 'profiles' or what == 'all' or what == 'count':
            profile_iface = PluginProfiles()
            profile_list = yield profile_iface.get_all()

            if what != 'count':
                outputDict.update({ 'profiles_elements' : len(profile_list), 'profiles' : profile_list })
            else:
                outputDict.update({ 'profiles_elements' : len(profile_list)})

        if what == 'plugins' or what == 'all' or what == 'count':
            plugin_list = yield PluginManager.get_all()

            if what != 'count':
                outputDict.update({ 'plugins_elements' : len(plugin_list), 'plugins' : plugin_list })
            else:
                outputDict.update({ 'plugins_elements' : len(plugin_list) })

        if what == 'rcfg' or what == 'all' or what == 'count':
            rconf_iface = ReceiverConfs()
            rconf_list = yield rconf_iface.get_all()

            if what != 'count':
                outputDict.update({ 'rcfg_elements' : len(rconf_list), 'settings' : rconf_list })
            else:
                outputDict.update({ 'rcfg_elements' : len(rconf_list)})

        if what == 'submission' or what == 'all' or what == 'count':
            submission_iface = Submission()
            submission_list = yield submission_iface.get_all()

            if what != 'count':
                outputDict.update({ 'submission_elements' : len(submission_list), 'submissions' : submission_list })
            else:
                outputDict.update({ 'submission_elements' : len(submission_list)})

        if what == 'file' or what == 'all' or what == 'count':
            file_iface = File()
            file_list = yield file_iface.get_all()

            if what != 'count':
                outputDict.update({ 'file_elements' : len(file_list), 'files' : file_list })
            else:
                outputDict.update({ 'file_elements' : len(file_list)})

        if what == 'contexts' or what == 'all' or what == 'count':
            context_iface = Context()
            context_list = yield context_iface.get_all()

            if what != 'count':
                outputDict.update({ 'contexts_elements' : len(context_list), 'contexts' : context_list })
            else:
                outputDict.update({ 'contexts_elements' : len(context_list)})


        if not what in expected:
            self.set_status(405)
        else:
            self.set_status(200)
            self.write(outputDict)

        self.finish()
Пример #21
0
    def operation(self):
        """
        Goal of this function is to check all the:
            Tips
            Comment
            Folder
            System Event

        marked as 'not notified' and perform notification.
        Notification plugin chose if perform a communication or not,
        Then became marked as:
            'notification ignored', or
            'notified'

        Every notification plugin NEED have a checks to verify
        if notification has been correctly performed. If not (eg: wrong
        login/password, network errors) would be marked as:
        'unable to be notified', and a retry logic is in TODO
        """
        plugin_type = u'notification'

        log.debug("[D]", self.__class__, 'operation', datetime.today().ctime())

        receivertip_iface = ReceiverTip()
        receivercfg_iface = ReceiverConfs()
        profile_iface = PluginProfiles()

        # TODO digest check missing it's required refactor the scheduler using a dedicated Storm table
        not_notified_tips = yield receivertip_iface.get_tips_by_notification_mark(u'not notified')

        for single_tip in not_notified_tips:

            # from a single tip, we need to extract the receiver, and then, having
            # context + receiver, find out which configuration setting has active

            receivers_map = yield receivertip_iface.get_receivers_by_tip(single_tip['tip_gus'])

            receiver_info = receivers_map['actor']

            receiver_conf = yield receivercfg_iface.get_active_conf(receiver_info['receiver_gus'],
                single_tip['context_gus'], plugin_type)

            if receiver_conf is None:
                print "Receiver", receiver_info['receiver_gus'], \
                    "has not an active notification settings in context", single_tip['context_gus'], "for", plugin_type

                # TODO applicative log, database tracking of queue
                continue

            # Ok, we had a valid an appropriate receiver configuration for the notification task
            related_profile = yield profile_iface.get_single(receiver_conf['profile_gus'])

            settings_dict = { 'admin_settings' : related_profile['admin_settings'],
                              'receiver_settings' : receiver_conf['receiver_settings']}

            plugin = PluginManager.instance_plugin(related_profile['plugin_name'])

            updated_tip = yield receivertip_iface.update_notification_date(single_tip['tip_gus'])
            return_code = plugin.do_notify(settings_dict, u'tip', updated_tip)

            if return_code:
                yield receivertip_iface.flip_mark(single_tip['tip_gus'], u'notified')
            else:
                yield receivertip_iface.flip_mark(single_tip['tip_gus'], u'unable to notify')


        # Comment Notification here it's just an incomplete version, that never would supports
        # digest or retry, until Task manager queue is implemented

        comment_iface = Comment()
        internaltip_iface = InternalTip()

        not_notified_comments = yield comment_iface.get_comment_by_mark(marker=u'not notified')

        for comment in not_notified_comments:

            receivers_list = yield internaltip_iface.get_receivers_by_itip(comment['internaltip_id'])

            # needed to obtain context!
            itip_info = yield internaltip_iface.get_single(comment['internaltip_id'])

            for receiver_info in receivers_list:

                receiver_conf = yield receivercfg_iface.get_active_conf(receiver_info['receiver_gus'],
                    itip_info['context_gus'], plugin_type)

                if receiver_conf is None:
                    # TODO applicative log, database tracking of queue
                    continue

                # Ok, we had a valid an appropriate receiver configuration for the notification task
                related_profile = yield profile_iface.get_single(receiver_conf['profile_gus'])

                settings_dict = { 'admin_settings' : related_profile['admin_settings'],
                                  'receiver_settings' : receiver_conf['receiver_settings']}

                plugin = PluginManager.instance_plugin(related_profile['plugin_name'])

                return_code = plugin.do_notify(settings_dict, u'comment', comment)

                if return_code:
                    print "Notification of comment successful for user", receiver_conf['receiver_gus']
                else:
                    print "Notification of comment failed for user", receiver_conf['receiver_gus']

            # remind: comment are not guarantee until Task manager is not developed
            yield comment_iface.flip_mark(comment['comment_id'], u'notified')