Beispiel #1
0
    def update_role_settings(self, new_settings, reindex):
        """"Method Wrapper for the super method, to allow notify a
        LocalRolesModified event. Needed for adding a Journalentry after a
        role_settings change"""

        old_local_roles = dict(self.context.get_local_roles())
        changed = super(OpengeverSharingView,
                        self).update_role_settings(new_settings, reindex)

        if changed:
            notify(
                LocalRolesModified(self.context, old_local_roles,
                                   self.context.get_local_roles()))

        return changed
    def update_role_settings(self, new_settings, reindex=True):
        """Method Wrapper for the super method, to allow notify a
        LocalRolesModified event. Needed for adding a Journalentry after a
        role_settings change
        """
        old_local_roles = dict(self.context.get_local_roles())
        self._update_role_settings(new_settings, reindex)

        if old_local_roles != dict(self.context.get_local_roles()):
            notify(
                LocalRolesModified(self.context, old_local_roles,
                                   self.context.get_local_roles()))
            return True

        return False
Beispiel #3
0
    def test_integration_templatefolder_event(self):
        templatefolder = create(Builder('templatefolder'))

        # Local roles Modified
        notify(
            LocalRolesModified(templatefolder, 'old roles',
                               (['catman', ['Owner']], [
                                   'ratman', ['Owner', 'Reader']
                               ], ['test_user', ['Reader', 'Editor']])))

        # CheckLocalRolesModified
        self.check_annotation(templatefolder,
                              action_type='Local roles modified',
                              action_title='Local roles modified.',
                              comment='ratman: sharing_reader; test_user: '******'sharing_reader, sharing_editor')
    def test_integration_repository_events(self):
        """ Trigger every event of a repo at least one times
        and check the journalentries.
        """
        portal = self.layer['portal']

        repo_root = createContentInContainer(
            portal, 'opengever.repository.repositoryroot', 'root')
        repo = createContentInContainer(
            repo_root, 'opengever.repository.repositoryfolder', 'r1')

        # Local roles Aquisition Blocked-Event
        notify(LocalRolesAcquisitionBlocked(repo, ))

        # Check
        self.check_annotation(
            repo_root,
            action_type='Local roles Aquisition Blocked',
            action_title='Local roles aquistion blocked at %s.' %
            (repo.title_or_id()))

        # Local roles Aquisition Activated-Event
        notify(LocalRolesAcquisitionActivated(repo, ))

        # Check
        self.check_annotation(
            repo_root,
            action_type='Local roles Aquisition Activated',
            action_title='Local roles aquistion activated at %s.' %
            (repo.title_or_id()))

        # Local roles Modified
        notify(
            LocalRolesModified(repo, 'old roles', (
                ['catman', ['Owner']],
                ['ratman', ['Owner', 'Reader']],
                ['test_user', ['Reader', 'Publisher']],
            )))

        # CheckLocalRolesModified
        self.check_annotation(
            repo_root,
            action_type='Local roles modified',
            action_title='Local roles modified at %s.' % (
                repo.title_or_id()),
            comment='ratman: sharing_dossier_reader; test_user: '******'sharing_dossier_reader, sharing_dossier_publisher')
Beispiel #5
0
    def test_integration_repository_events(self):
        """ Trigger every event of a repo at least one times
        and check the journalentries.
        """
        repo_root, repo = create(Builder('repository_tree'))

        # Local roles Aquisition Blocked-Event
        notify(
            LocalRolesAcquisitionBlocked(repo, ))

        # Check
        self.check_annotation(
            repo_root,
            action_type='Local roles Aquisition Blocked',
            action_title='Local roles aquistion blocked at %s.' % (
                repo.title_or_id()))

        # Local roles Aquisition Activated-Event
        notify(
            LocalRolesAcquisitionActivated(repo, ))

        # Check
        self.check_annotation(
            repo_root,
            action_type='Local roles Aquisition Activated',
            action_title='Local roles aquistion activated at %s.' % (
                repo.title_or_id()))

        # Local roles Modified
        notify(
            LocalRolesModified(
                repo, 'old roles',
                (['catman', ['Owner']],
                 ['ratman', ['Owner', 'Reader']],
                 ['test_user', ['Reader', 'Publisher']])
            ))

        # CheckLocalRolesModified
        self.check_annotation(
            repo_root,
            action_type='Local roles modified',
            action_title='Local roles modified at %s.' % (
                repo.title_or_id()),
            comment='ratman: sharing_dossier_reader; test_user: '******'sharing_dossier_reader, sharing_dossier_publisher')
    def test_integration_templatedossier_event(self):

        portal = self.layer['portal']

        templatedossier = createContentInContainer(
            portal, 'opengever.dossier.templatedossier', 'templates')

        # Local roles Modified
        notify(
            LocalRolesModified(templatedossier, 'old roles', (
                ['catman', ['Owner']],
                ['ratman', ['Owner', 'Reader']],
                ['test_user', ['Reader', 'Editor']],
            )))

        # CheckLocalRolesModified
        self.check_annotation(
            templatedossier,
            action_type='Local roles modified',
            action_title='Local roles modified.',
            comment='ratman: sharing_reader; test_user: '******'sharing_reader, sharing_editor')
    def test_integration_dossier_events(self):
        """ Trigger every event of a dossier at least one times
        and check the journalentries.
        """
        portal = self.layer['portal']

        # Add-Event
        dossier = createContentInContainer(
            portal, 'opengever.dossier.businesscasedossier', 'd1')

        self.check_object_added(
            dossier,
            'Dossier added',
            'Dossier added: %s' % dossier.title_or_id(),
        )

        # Modified-Event
        notify(ObjectModifiedEvent(dossier))

        # Check
        self.check_annotation(dossier,
                              action_type='Dossier modified',
                              action_title='Dossier modified: %s' %
                              (dossier.title_or_id()))

        # Get the workflow for the dossier to test the ActionSucceededEvent
        wftool = getToolByName(dossier, 'portal_workflow')
        workflow = wftool.get('simple_publication_workflow')

        # Action-Succeeded-Event
        notify(
            ActionSucceededEvent(
                dossier,
                workflow,
                'publish',
                'published',
            ))

        # Check
        self.check_annotation(
            dossier,
            action_type='Dossier state changed',
            action_title='Dossier state changed to published')

        # Local roles Aquisition Blocked-Event
        notify(LocalRolesAcquisitionBlocked(dossier, ))

        # Check
        self.check_annotation(dossier,
                              action_type='Local roles Aquisition Blocked',
                              action_title='Local roles aquistion blocked.')

        # Local roles Aquisition Activated-Event
        notify(LocalRolesAcquisitionActivated(dossier, ))

        # Check
        self.check_annotation(dossier,
                              action_type='Local roles Aquisition Activated',
                              action_title='Local roles aquistion activated.')

        # Local roles Modified
        notify(
            LocalRolesModified(dossier, 'old roles', (
                ['catman', ['Owner']],
                ['ratman', ['Owner', 'Reader']],
                ['test_user', ['Reader', 'Publisher']],
            )))

        # CheckLocalRolesModified
        self.check_annotation(
            dossier,
            action_type='Local roles modified',
            action_title='Local roles modified.',
            comment='ratman: sharing_dossier_reader; test_user: '******'sharing_dossier_reader, sharing_dossier_publisher')