def setup_slaves(self): BasePersonRoleEditor.setup_slaves(self) user_status = UserStatusSlave(self.store, self.model, visual_mode=self.visual_mode) self.main_slave.attach_person_slave(user_status) passwd_fields = not self.edit_mode self.user_details = UserDetailsSlave( self.store, self.model, show_password_fields=passwd_fields, visual_mode=self.visual_mode) tab_text = _('User Details') self.main_slave._person_slave.add_extra_tab(tab_text, self.user_details, self.USER_TAB_POSITION) tab_text = _('Branch Access') self.user_branches = UserBranchAccessSlave(self.store, self.model) # XXX: workaround border being to large self.user_branches.vbox1.set_border_width(0) self.main_slave._person_slave.add_extra_tab(tab_text, self.user_branches)
def setup_slaves(self): BasePersonRoleEditor.setup_slaves(self) user_status = UserStatusSlave(self.store, self.model, visual_mode=self.visual_mode) self.main_slave.attach_person_slave(user_status) passwd_fields = not self.edit_mode self.user_details = UserDetailsSlave(self.store, self.model, show_password_fields=passwd_fields, visual_mode=self.visual_mode) tab_text = _('User Details') self.main_slave._person_slave.attach_custom_slave(self.user_details, tab_text) tab_child = self.main_slave._person_slave.custom_tab notebook = self.main_slave._person_slave.person_notebook notebook.reorder_child(tab_child, position=self.USER_TAB_POSITION) notebook.set_current_page(self.USER_TAB_POSITION) tab_text = _('Branch Access') self.user_branches = UserBranchAccessSlave(self.store, self.model) # XXX: workaround border being to large self.user_branches.vbox1.set_border_width(0) self.main_slave._person_slave.attach_extra_slave(self.user_branches, tab_text)
class UserEditor(BasePersonRoleEditor): model_name = _('User') title = _('New User') model_type = LoginUser gladefile = 'BaseTemplate' USER_TAB_POSITION = 0 help_section = 'user' ui_form_name = u'user' def create_model(self, store): person = BasePersonRoleEditor.create_model(self, store) return person.login_user or LoginUser(person=person, store=store, username=u"", password=u"", profile=None) def setup_slaves(self): BasePersonRoleEditor.setup_slaves(self) user_status = UserStatusSlave(self.store, self.model, visual_mode=self.visual_mode) self.main_slave.attach_person_slave(user_status) passwd_fields = not self.edit_mode self.user_details = UserDetailsSlave( self.store, self.model, show_password_fields=passwd_fields, visual_mode=self.visual_mode) tab_text = _('User Details') self.main_slave._person_slave.add_extra_tab(tab_text, self.user_details, self.USER_TAB_POSITION) tab_text = _('Branch Access') self.user_branches = UserBranchAccessSlave(self.store, self.model) # XXX: workaround border being to large self.user_branches.vbox1.set_border_width(0) self.main_slave._person_slave.add_extra_tab(tab_text, self.user_branches) def validate_confirm(self): return (self.user_details.validate_confirm() and self.user_branches.validate_confirm())
class UserEditor(BasePersonRoleEditor): model_name = _('User') title = _('New User') model_type = LoginUser gladefile = 'BaseTemplate' USER_TAB_POSITION = 0 help_section = 'user' ui_form_name = u'user' def create_model(self, store): person = BasePersonRoleEditor.create_model(self, store) return person.login_user or LoginUser(person=person, store=store, username=u"", password=u"", profile=None) def setup_slaves(self): BasePersonRoleEditor.setup_slaves(self) user_status = UserStatusSlave(self.store, self.model, visual_mode=self.visual_mode) self.main_slave.attach_person_slave(user_status) passwd_fields = not self.edit_mode self.user_details = UserDetailsSlave(self.store, self.model, show_password_fields=passwd_fields, visual_mode=self.visual_mode) tab_text = _('User Details') self.main_slave._person_slave.attach_custom_slave(self.user_details, tab_text) tab_child = self.main_slave._person_slave.custom_tab notebook = self.main_slave._person_slave.person_notebook notebook.reorder_child(tab_child, position=self.USER_TAB_POSITION) notebook.set_current_page(self.USER_TAB_POSITION) tab_text = _('Branch Access') self.user_branches = UserBranchAccessSlave(self.store, self.model) # XXX: workaround border being to large self.user_branches.vbox1.set_border_width(0) self.main_slave._person_slave.attach_extra_slave(self.user_branches, tab_text) def validate_confirm(self): return (self.user_details.validate_confirm() and self.user_branches.validate_confirm())
def setup_slaves(self): BasePersonRoleEditor.setup_slaves(self) user_status = UserStatusSlave(self.store, self.model, visual_mode=self.visual_mode) self.main_slave.attach_person_slave(user_status) passwd_fields = not self.edit_mode self.user_details = UserDetailsSlave(self.store, self.model, show_password_fields=passwd_fields, visual_mode=self.visual_mode) tab_text = _('User Details') self.main_slave._person_slave.add_extra_tab(tab_text, self.user_details, self.USER_TAB_POSITION) tab_text = _('Branch Access') self.user_branches = UserBranchAccessSlave(self.store, self.model) self.main_slave._person_slave.add_extra_tab(tab_text, self.user_branches)
class UserEditor(BasePersonRoleEditor): model_name = _('User') title = _('New User') model_type = LoginUser gladefile = 'BaseTemplate' USER_TAB_POSITION = 0 help_section = 'user' ui_form_name = u'user' def create_model(self, store): person = BasePersonRoleEditor.create_model(self, store) return person.login_user or LoginUser(person=person, store=store, username=u"", password=u"", profile=None) def setup_slaves(self): BasePersonRoleEditor.setup_slaves(self) user_status = UserStatusSlave(self.store, self.model, visual_mode=self.visual_mode) self.main_slave.attach_person_slave(user_status) passwd_fields = not self.edit_mode self.user_details = UserDetailsSlave(self.store, self.model, show_password_fields=passwd_fields, visual_mode=self.visual_mode) tab_text = _('User Details') self.main_slave._person_slave.add_extra_tab(tab_text, self.user_details, self.USER_TAB_POSITION) tab_text = _('Branch Access') self.user_branches = UserBranchAccessSlave(self.store, self.model) self.main_slave._person_slave.add_extra_tab(tab_text, self.user_branches) def validate_confirm(self): return (self.user_details.validate_confirm() and self.user_branches.validate_confirm())
def test_create(self): user = self.create_user() slave = UserBranchAccessSlave(self.store, user) self.check_slave(slave, 'user-branch-access-slave-create')