當前位置: 首頁>>代碼示例>>Python>>正文


Python permissions.PermissionManager類代碼示例

本文整理匯總了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;未經允許,請勿轉載。