def _createFinancesGroup(self): """ Create the finances group. """ context = self.portal.portal_setup._getImportContext('Products.MeetingCharleroi:testing') initializer = ToolInitializer(context, PROJECTNAME) # create echevin2 first as it is a group in charge of finances org orgs, active_orgs, savedOrgsData = initializer.addOrgs([charleroi_import_data.ech2_grp]) for org in orgs: org_uid = org.UID() self._select_organization(org_uid) dirfin_grp = deepcopy(charleroi_import_data.dirfin_grp) dirfin_grp.groups_in_charge = [org_id_to_uid(group_in_charge_id) for group_in_charge_id in dirfin_grp.groups_in_charge] orgs, active_orgs, savedOrgsData = initializer.addOrgs([dirfin_grp]) initializer.data = initializer.getProfileData() for org in orgs: org_uid = org.UID() org.item_advice_states = initializer._correct_advice_states(dirfin_grp.item_advice_states) org.item_advice_edit_states = initializer._correct_advice_states(dirfin_grp.item_advice_edit_states) self._select_organization(org_uid) select_org_for_function(org_uid, 'financialcontrollers') select_org_for_function(org_uid, 'financialeditors') select_org_for_function(org_uid, 'financialmanagers') select_org_for_function(org_uid, 'financialreviewers') # clean forever cache on utils finance_group_uid _memos.clear()
def setUpBourgmestreConfig(self): """Setup meeting-config-bourgmestre : - Create groups and users; - ... """ self.changeUser('siteadmin') self._createFinanceGroups() self.setMeetingConfig(self.meetingConfig3.getId()) context = self.portal.portal_setup._getImportContext( 'Products.MeetingLiege:testing') initializer = ToolInitializer(context, PROJECTNAME) orgs, active_orgs, savedOrgsData = initializer.addOrgs( bg_import_data.orgs) for org in orgs: self._select_organization(org.UID()) initializer.addUsers(bg_import_data.orgs) initializer.addUsersOutsideGroups( bg_import_data.data.usersOutsideGroups) for userId in ('pmMeetingManagerBG', 'generalManager', 'bourgmestreManager', 'bourgmestreReviewer'): _createMemberarea(self.portal, userId) cfg = self.meetingConfig cfg.setUsedAdviceTypes(cfg.getUsedAdviceTypes() + ('asked_again', )) cfg.setItemAdviceStates(('proposed_to_director_waiting_advices', )) cfg.setItemAdviceEditStates = (( 'proposed_to_director_waiting_advices', )) cfg.setKeepAccessToItemWhenAdvice('is_given')
def setUpRestrictedPowerObservers(self): """""" self.changeUser('siteadmin') context = self.portal.portal_setup._getImportContext( 'Products.MeetingBEP:testing') initializer = ToolInitializer(context, PROJECTNAME) initializer.addOrgs([rhc_org]) self._setPowerObserverStates(states=( 'itemcreated', 'presented', 'returned_to_proposing_group', )) self._setPowerObserverStates(observer_type='restrictedpowerobservers', states=( 'itemcreated', 'presented', 'returned_to_proposing_group', )) cfg = self.meetingConfig cfg.setWorkflowAdaptations(('return_to_proposing_group', )) cfg.at_post_edit_script()
def _createFinancesGroup(self): """ Create the finances group. """ context = self.portal.portal_setup._getImportContext('Products.MeetingPROVHainaut:testing') initializer = ToolInitializer(context, PROJECTNAME) dirfin_grp = deepcopy(provhainaut_import_data.dirfincec) orgs, active_orgs, savedOrgsData = initializer.addOrgs([dirfin_grp]) initializer.data = initializer.getProfileData() for org in orgs: org_uid = org.UID() self._select_organization(org_uid) select_org_for_function(org_uid, 'financialprecontrollers') select_org_for_function(org_uid, 'financialcontrollers') select_org_for_function(org_uid, 'financialeditors') select_org_for_function(org_uid, 'financialmanagers') select_org_for_function(org_uid, 'financialreviewers') # clean forever cache on utils finance_group_uid _memos.clear()
def _createRHGroups(self): """ Create the RH groups. """ context = self.portal.portal_setup._getImportContext( 'Products.MeetingLiege:testing') initializer = ToolInitializer(context, PROJECTNAME) org_descriptors = (liege_import_data.rhrecr, liege_import_data.rhgestadmin) orgs, active_orgs, savedOrgsData = initializer.addOrgs( org_descriptors, defer_data=False) for org in orgs: org_uid = org.UID() self._select_organization(org_uid) self._addPrincipalToGroup('pmManager', '{0}_creators'.format(org_uid)) self._addPrincipalToGroup('pmManager', '{0}_reviewers'.format(org_uid)) # clean forever cache on utils rh_group_uids cleanForeverCache()
def _createFinanceGroups(self): """ Create the finance groups. """ context = self.portal.portal_setup._getImportContext( 'Products.MeetingLiege:testing') initializer = ToolInitializer(context, PROJECTNAME) org_descriptors = (liege_import_data.dfcompta, liege_import_data.dfcontrol, liege_import_data.dftresor) orgs, active_orgs, savedOrgsData = initializer.addOrgs( org_descriptors, defer_data=False) for org in orgs: org_uid = org.UID() self._select_organization(org_uid) if org.getId() in FINANCE_GROUP_IDS: select_org_for_function(org_uid, 'financialcontrollers') select_org_for_function(org_uid, 'financialmanagers') select_org_for_function(org_uid, 'financialreviewers') # clean forever cache on utils finance_group_uids cleanForeverCache()
def _setupPoliceGroup(self): '''Configure police group. - create 'bourgmestre' group as in charge of police groups; - create police/police_compta groups; - add 'pmManager' to the _creators group; - add some default categories.''' # due to complex setup to manage college and council, # sometimes this method is called twice... if org_id_to_uid(POLICE_GROUP_PREFIX, raise_on_error=False): return self.changeUser('siteadmin') context = self.portal.portal_setup._getImportContext('Products.MeetingCharleroi:testing') initializer = ToolInitializer(context, PROJECTNAME) # create bourgmestre first as it is a group in charge of police orgs orgs, active_orgs, savedOrgsData = initializer.addOrgs([charleroi_import_data.bourg_grp]) bourg_grp = orgs[0] for org in orgs: org_uid = org.UID() self._select_organization(org_uid) # groups_in_charge are organziation ids, we need organization uids police_grp = deepcopy(charleroi_import_data.police_grp) police_grp.groups_in_charge = [org_id_to_uid(group_in_charge_id) for group_in_charge_id in police_grp.groups_in_charge] police_compta_grp = deepcopy(charleroi_import_data.police_compta_grp) police_compta_grp.groups_in_charge = [org_id_to_uid(group_in_charge_id) for group_in_charge_id in police_compta_grp.groups_in_charge] org_descriptors = (police_grp, police_compta_grp) orgs, active_orgs, savedOrgsData = initializer.addOrgs(org_descriptors, defer_data=False) for org in orgs: org_uid = org.UID() self._select_organization(org_uid) police = orgs[0] police_compta = orgs[1] gic1 = self.create('organization', id='groupincharge1', title="Group in charge 1", acronym='GIC1') gic1_uid = gic1.UID() self._select_organization(gic1.UID()) gic2 = self.create('organization', id='groupincharge2', title="Group in charge 2", acronym='GIC2') gic2_uid = gic2.UID() self._select_organization(gic2.UID()) # police is added at the end of existing groups self.assertEqual(get_organizations(the_objects=False), [self.developers_uid, self.vendors_uid, bourg_grp.UID(), police.UID(), police_compta.UID(), gic1.UID(), gic2.UID()]) # set groupsInCharge for police groups police.groups_in_charge = (gic1_uid,) police_compta.groups_in_charge = (gic1_uid,) self.vendors.groups_in_charge = (gic1_uid,) self.developers.groups_in_charge = (gic2_uid,) # make 'pmManager' able to manage everything for 'vendors' and 'police' groupsTool = self.portal.portal_groups for org in (self.vendors, police, police_compta): org_uid = org.UID() for suffix in get_all_suffixes(org_uid): groupsTool.addPrincipalToGroup('pmManager', '{0}_{1}'.format(org_uid, suffix)) self._removeConfigObjectsFor(self.meetingConfig, folders=['recurringitems', 'itemtemplates', 'categories']) self._createCategories() self._createItemTemplates()