当前位置: 首页>>代码示例>>Python>>正文


Python PermissionManager.get_permission_manager方法代码示例

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


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

示例1: __init__

# 需要导入模块: from stoqlib.lib.permissions import PermissionManager [as 别名]
# 或者: from stoqlib.lib.permissions.PermissionManager import get_permission_manager [as 别名]
 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,代码行数:9,代码来源:purchasewizard.py

示例2: _create_actions

# 需要导入模块: from stoqlib.lib.permissions import PermissionManager [as 别名]
# 或者: from stoqlib.lib.permissions.PermissionManager import get_permission_manager [as 别名]
    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,代码行数:33,代码来源:shellwindow.py

示例3: tearDownClass

# 需要导入模块: from stoqlib.lib.permissions import PermissionManager [as 别名]
# 或者: from stoqlib.lib.permissions.PermissionManager import get_permission_manager [as 别名]
    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,代码行数:11,代码来源:test_nfe_ui.py

示例4: setUp

# 需要导入模块: from stoqlib.lib.permissions import PermissionManager [as 别名]
# 或者: from stoqlib.lib.permissions.PermissionManager import get_permission_manager [as 别名]
    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,代码行数:11,代码来源:test_wizarditemsteps.py

示例5: __init__

# 需要导入模块: from stoqlib.lib.permissions import PermissionManager [as 别名]
# 或者: from stoqlib.lib.permissions.PermissionManager import get_permission_manager [as 别名]
    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,代码行数:12,代码来源:nfeui.py

示例6: __init__

# 需要导入模块: from stoqlib.lib.permissions import PermissionManager [as 别名]
# 或者: from stoqlib.lib.permissions.PermissionManager import get_permission_manager [as 别名]
 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,代码行数:13,代码来源:workordereditor.py

示例7: __init__

# 需要导入模块: from stoqlib.lib.permissions import PermissionManager [as 别名]
# 或者: from stoqlib.lib.permissions.PermissionManager import get_permission_manager [as 别名]
    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,代码行数:14,代码来源:nfeui.py

示例8: __init__

# 需要导入模块: from stoqlib.lib.permissions import PermissionManager [as 别名]
# 或者: from stoqlib.lib.permissions.PermissionManager import get_permission_manager [as 别名]
    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,代码行数:19,代码来源:nfeui.py

示例9: __init__

# 需要导入模块: from stoqlib.lib.permissions import PermissionManager [as 别名]
# 或者: from stoqlib.lib.permissions.PermissionManager import get_permission_manager [as 别名]
 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,代码行数:20,代码来源:workordereditor.py

示例10: _check_permissions

# 需要导入模块: from stoqlib.lib.permissions import PermissionManager [as 别名]
# 或者: from stoqlib.lib.permissions.PermissionManager import get_permission_manager [as 别名]
    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,代码行数:20,代码来源:searcheditor.py

示例11: testShowWithoutPermission

# 需要导入模块: from stoqlib.lib.permissions import PermissionManager [as 别名]
# 或者: from stoqlib.lib.permissions.PermissionManager import get_permission_manager [as 别名]
    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,代码行数:20,代码来源:test_productsearch.py

示例12: tearDown

# 需要导入模块: from stoqlib.lib.permissions import PermissionManager [as 别名]
# 或者: from stoqlib.lib.permissions.PermissionManager import get_permission_manager [as 别名]
    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,代码行数:8,代码来源:test_productsearch.py


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