コード例 #1
0
    def test_no_org_check(self):
        result_root = can_globally_manage_plugins(None)
        result_install = can_install_plugins(None)
        result_config = can_configure_plugins(None)
        result_view = can_view_plugins(None)

        self.assertFalse(result_root)
        self.assertFalse(result_install)
        self.assertFalse(result_config)
        self.assertFalse(result_view)
コード例 #2
0
def enable_preinstalled_plugins_for_new_team(sender, instance: Team, created: bool, **kwargs):
    if created and can_configure_plugins(instance.organization):
        for order, preinstalled_plugin in enumerate(Plugin.objects.filter(is_preinstalled=True)):

            PluginConfig.objects.create(
                team=instance,
                plugin=preinstalled_plugin,
                enabled=True,
                order=order,
                config=preinstalled_plugin.get_default_config(),
            )
コード例 #3
0
    def test_none_check(self):
        self.organization.plugins_access_level = Organization.PluginsAccessLevel.NONE
        self.organization.save()

        result_root = can_globally_manage_plugins(self.organization)
        result_install = can_install_plugins(self.organization)
        result_config = can_configure_plugins(self.organization)
        result_view = can_view_plugins(self.organization)

        self.assertFalse(result_root)
        self.assertFalse(result_install)
        self.assertFalse(result_config)
        self.assertFalse(result_view)
コード例 #4
0
    def test_config_check_with_id_str(self):
        self.organization.plugins_access_level = Organization.PluginsAccessLevel.CONFIG
        self.organization.save()
        organization_id = str(self.organization.id)

        result_root = can_globally_manage_plugins(organization_id)
        result_install = can_install_plugins(organization_id)
        result_config = can_configure_plugins(organization_id)
        result_view = can_view_plugins(organization_id)

        self.assertFalse(result_root)
        self.assertFalse(result_install)
        self.assertTrue(result_config)
        self.assertTrue(result_view)