• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python permissions.PermissionManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中stoqlib.lib.permissions.PermissionManager的典型用法代码示例。如果您正苦于以下问题:Python PermissionManager类的具体用法?Python PermissionManager怎么用?Python PermissionManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了PermissionManager类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, wizard, store, model):
     WizardEditorStep.__init__(self, store, wizard, model)
     pm = PermissionManager.get_permission_manager()
     if not pm.can_create('Supplier'):
         self.add_supplier.hide()
     if not pm.can_edit('Supplier'):
         self.edit_supplier.hide()
开发者ID:Guillon88,项目名称:stoq,代码行数:7,代码来源:purchasewizard.py


示例2: _create_actions

    def _create_actions(self):
        # Gloabl actions avaiable at any time from all applications
        actions = [
            ('preferences', None),
            ('export', None),
            ('print', None),
            ('sign_out', None),
            ('change_password', None),
            ('HelpApp', None),
            ('HelpContents', None),
            ('HelpTranslate', None),
            ('HelpSupport', None),
            ('HelpChat', None),
            ('HelpAbout', None),
            ('quit', None),
        ]

        pm = PermissionManager.get_permission_manager()
        group = Gio.SimpleActionGroup()
        self.toplevel.insert_action_group('stoq', group)
        for (name, param_type) in actions:
            action = Gio.SimpleAction.new(name, param_type)
            group.add_action(action)
            # Save the action in self so that auto signal connections work
            setattr(self, name, action)

            # Check permissions
            key, required = self.action_permissions.get(name,
                                                        (None, pm.PERM_ALL))
            if not pm.get(key) & required:
                action.set_enabled(False)
开发者ID:hackedbellini,项目名称:stoq,代码行数:31,代码来源:shellwindow.py


示例3: tearDownClass

    def tearDownClass(cls):
        """Undo what is done in the setup on NFeUI

        We must do this otherwise it will affect other tests
        """
        pm = PermissionManager.get_permission_manager()
        pm.set('InvoiceLayout', pm.PERM_ALL)
        pm.set('InvoicePrinter', pm.PERM_ALL)
        pm.set('app.sales.print_invoice', pm.PERM_ALL)
开发者ID:hackedbellini,项目名称:stoq,代码行数:9,代码来源:test_nfe_ui.py


示例4: setUp

    def setUp(self):
        super(BaseTest, self).setUp()

        # The final interface depends on this
        pm = PermissionManager.get_permission_manager()
        pm.set('Product', PermissionManager.PERM_ALL)

        self.wizard = self.wizard_class(self.store)
        self.step = self.step_class(self.wizard, None, self.store, self.wizard.model)
开发者ID:leandrorchaves,项目名称:stoq,代码行数:9,代码来源:test_wizarditemsteps.py


示例5: __init__

    def __init__(self):
        SaleStatusChangedEvent.connect(self._on_SaleStatusChanged)

        pm = PermissionManager.get_permission_manager()
        pm.set('InvoiceLayout', pm.PERM_HIDDEN)
        pm.set('InvoicePrinter', pm.PERM_HIDDEN)

        # since the nfe plugin was enabled, the user must not be able to print
        # the regular fiscal invoice (replaced by the nfe).
        pm.set('app.sales.print_invoice', pm.PERM_HIDDEN)
开发者ID:Joaldino,项目名称:stoq,代码行数:10,代码来源:nfeui.py


示例6: __init__

 def __init__(self, store, model=None, visual_mode=False, category=None):
     self._default_category = category
     self.proxy = None
     super(WorkOrderEditor, self).__init__(store, model=model,
                                           visual_mode=visual_mode)
     self._setup_widgets()
     pm = PermissionManager.get_permission_manager()
     if not pm.can_create('WorkOrderCategory'):
         self.category_create.hide()
     if not pm.can_edit('WorkOrderCategory'):
         self.category_edit.hide()
开发者ID:barkinet,项目名称:stoq,代码行数:11,代码来源:workordereditor.py


示例7: __init__

    def __init__(self):
        self._setup_params()
        self._setup_events()

        pm = PermissionManager.get_permission_manager()
        pm.set('InvoiceLayout', pm.PERM_HIDDEN)
        pm.set('InvoicePrinter', pm.PERM_HIDDEN)

        # since the nfe plugin was enabled, the user must not be able to print
        # the regular fiscal invoice (replaced by the nfe).
        pm.set('app.sales.print_invoice', pm.PERM_HIDDEN)
        self._update_forms()
开发者ID:adrianoaguiar,项目名称:stoq,代码行数:12,代码来源:nfeui.py


示例8: __init__

    def __init__(self):
        SaleReturnWizardFinishEvent.connect(self._on_SaleReturnWizardFinish)
        SaleStatusChangedEvent.connect(self._on_SaleStatusChanged)
        StockDecreaseWizardFinishEvent.connect(self._on_StockDecreaseWizardFinish)
        StockTransferWizardFinishEvent.connect(self._on_StockTransferWizardFinish)
        # TODO: Before enable the the NF-e generation. Save the invoice data,
        # in Invoice table (for each operation below).
#        NewLoanWizardFinishEvent.connect(self._on_NewLoanWizardFinish)

        pm = PermissionManager.get_permission_manager()
        pm.set('InvoiceLayout', pm.PERM_HIDDEN)
        pm.set('InvoicePrinter', pm.PERM_HIDDEN)

        # since the nfe plugin was enabled, the user must not be able to print
        # the regular fiscal invoice (replaced by the nfe).
        pm.set('app.sales.print_invoice', pm.PERM_HIDDEN)
        self._update_forms()
开发者ID:Guillon88,项目名称:stoq,代码行数:17,代码来源:nfeui.py


示例9: __init__

 def __init__(self, store, model=None, visual_mode=False, category=None,
              available_categories=None):
     """
     @param category: The default category that should be already selected.
     @param available_categories: A list of categories names that should be
       available to the user. If None, all categoires will be available
     """
     self._default_category = category
     self.categories_for_combo = available_categories
     self.proxy = None
     super(WorkOrderEditor, self).__init__(store, model=model,
                                           visual_mode=visual_mode)
     self._setup_widgets()
     pm = PermissionManager.get_permission_manager()
     if not pm.can_create('WorkOrderCategory'):
         self.category_create.hide()
     if not pm.can_edit('WorkOrderCategory'):
         self.category_edit.hide()
开发者ID:Guillon88,项目名称:stoq,代码行数:18,代码来源:workordereditor.py


示例10: _check_permissions

    def _check_permissions(self):
        if not self.editor_class:
            return

        pm = PermissionManager.get_permission_manager()
        key = self.editor_class.model_type.__name__
        if not pm.can_create(key):
            self.hide_new_button()

        if not pm.can_edit(key):
            if pm.can_see_details(key):
                # Replace edit button with a details button. self._read_only
                # will activate visual_mode for the editor
                self._read_only = True
                self._toolbar.edit_button_label.set_text(_('Details'))
                self._toolbar.edit_button_image.set_from_stock('gtk-info', gtk.ICON_SIZE_BUTTON)
            else:
                self.hide_edit_button()
开发者ID:tmaxter,项目名称:stoq,代码行数:18,代码来源:searcheditor.py


示例11: testShowWithoutPermission

    def testShowWithoutPermission(self, run_dialog):
        # Our only permission now is to see details
        pm = PermissionManager.get_permission_manager()
        pm.set('Product', pm.PERM_ONLY_DETAILS)
        search = self._show_search()

        # New button shoud not be visible and edit button should actually be
        # 'Details'
        self.assertNotVisible(search._toolbar, ['new_button'])
        self.assertSensitive(search._toolbar, ['edit_button'])
        self.assertEquals(search._toolbar.edit_button_label.get_label(),
                          _('Details'))

        # Editor should be called with visual mode set.
        self.click(search._toolbar.edit_button)
        args, kwargs = run_dialog.call_args
        self.assertTrue('visual_mode' in kwargs)
        self.assertEquals(kwargs['visual_mode'], True)
开发者ID:romaia,项目名称:stoq,代码行数:18,代码来源:test_productsearch.py


示例12: tearDown

    def tearDown(self):
        GUITest.tearDown(self)

        # Reset the permitions so they wont influence other tests
        pm = PermissionManager.get_permission_manager()
        pm.set('Product', PermissionManager.PERM_ALL)
开发者ID:Joaldino,项目名称:stoq,代码行数:6,代码来源:test_productsearch.py



注:本文中的stoqlib.lib.permissions.PermissionManager类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pluginmanager.get_plugin_manager函数代码示例发布时间:2022-05-27
下一篇:
Python sysparam.set_bool函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap