예제 #1
0
    def test_is_admin_only(self):
        self.assertFalse(
            security_manager.is_admin_only(
                security_manager.find_permission_view_menu(
                    'can_show', 'TableModelView')))
        self.assertFalse(
            security_manager.is_admin_only(
                security_manager.find_permission_view_menu(
                    'all_datasource_access', 'all_datasource_access')))

        self.assertTrue(
            security_manager.is_admin_only(
                security_manager.find_permission_view_menu(
                    'can_delete', 'DatabaseView')))
        if app.config.get('ENABLE_ACCESS_REQUEST'):
            self.assertTrue(
                security_manager.is_admin_only(
                    security_manager.find_permission_view_menu(
                        'can_show', 'AccessRequestsModelView')))
        self.assertTrue(
            security_manager.is_admin_only(
                security_manager.find_permission_view_menu(
                    'can_edit', 'UserDBModelView')))
        self.assertTrue(
            security_manager.is_admin_only(
                security_manager.find_permission_view_menu(
                    'can_approve', 'Superset')))
        self.assertTrue(
            security_manager.is_admin_only(
                security_manager.find_permission_view_menu(
                    'all_database_access', 'all_database_access')))
예제 #2
0
    def test_is_admin_only(self):
        self.assertFalse(
            security_manager.is_admin_only(
                security_manager.find_permission_view_menu(
                    "can_show", "TableModelView")))
        self.assertFalse(
            security_manager.is_admin_only(
                security_manager.find_permission_view_menu(
                    "all_datasource_access", "all_datasource_access")))

        self.assertTrue(
            security_manager.is_admin_only(
                security_manager.find_permission_view_menu(
                    "can_delete", "DatabaseView")))
        if app.config.get("ENABLE_ACCESS_REQUEST"):
            self.assertTrue(
                security_manager.is_admin_only(
                    security_manager.find_permission_view_menu(
                        "can_show", "AccessRequestsModelView")))
        self.assertTrue(
            security_manager.is_admin_only(
                security_manager.find_permission_view_menu(
                    "can_edit", "UserDBModelView")))
        self.assertTrue(
            security_manager.is_admin_only(
                security_manager.find_permission_view_menu(
                    "can_approve", "Superset")))
예제 #3
0
    def test_is_admin_only(self):
        self.assertFalse(security_manager.is_admin_only(
            security_manager.find_permission_view_menu('can_show', 'TableModelView')))
        self.assertFalse(security_manager.is_admin_only(
            security_manager.find_permission_view_menu(
                'all_datasource_access', 'all_datasource_access')))

        self.assertTrue(security_manager.is_admin_only(
            security_manager.find_permission_view_menu('can_delete', 'DatabaseView')))
        if app.config.get('ENABLE_ACCESS_REQUEST'):
            self.assertTrue(security_manager.is_admin_only(
                security_manager.find_permission_view_menu(
                    'can_show', 'AccessRequestsModelView')))
        self.assertTrue(security_manager.is_admin_only(
            security_manager.find_permission_view_menu(
                'can_edit', 'UserDBModelView')))
        self.assertTrue(security_manager.is_admin_only(
            security_manager.find_permission_view_menu(
                'can_approve', 'Superset')))
        self.assertTrue(security_manager.is_admin_only(
            security_manager.find_permission_view_menu(
                'all_database_access', 'all_database_access')))