def canView(self): # Permissions to view acords based on ODT definition file # TODO: add if is obert /restricted to ... estatSessio = utils.session_wf_state(self) roles = utils.getUserRoles(self, self.context, api.user.get_current().id) if 'Manager' in roles: return True elif estatSessio == 'planificada' and utils.checkhasRol( ['OG1-Secretari', 'OG2-Editor'], roles): return True elif estatSessio == 'convocada' and utils.checkhasRol( ['OG1-Secretari', 'OG2-Editor', 'OG3-Membre', 'OG5-Convidat'], roles): return True elif estatSessio == 'realitzada' and utils.checkhasRol( ['OG1-Secretari', 'OG2-Editor', 'OG3-Membre', 'OG5-Convidat'], roles): return True elif estatSessio == 'tancada' and utils.checkhasRol( ['OG1-Secretari', 'OG2-Editor', 'OG3-Membre', 'OG5-Convidat'], roles): return True elif estatSessio == 'en_correccio' and utils.checkhasRol( ['OG1-Secretari', 'OG2-Editor', 'OG3-Membre', 'OG5-Convidat'], roles): return True else: raise Unauthorized
def render(self): estatSessio = utils.session_wf_state(self) if estatSessio not in ['realitzada', 'tancada', 'en_correccio']: sendRemoveVoteEmail(self.context) parent = self.context.aq_parent parent.manage_delObjects([self.context.getId()]) transaction.commit() addEntryLog(self.context.__parent__.__parent__, None, _(u'Eliminada votacio esmena'), self.context.__parent__.absolute_url())
def canViewPunt(self, item): # Permissions to view PUNTS self.context = item roles = utils.getUserRoles(self, self.context, api.user.get_current().id) if 'Manager' in roles: return True estatSessio = utils.session_wf_state(self) organ_tipus = self.context.organType if organ_tipus == 'open_organ': if estatSessio == 'planificada' and utils.checkhasRol(['OG1-Secretari', 'OG2-Editor'], roles): return True elif estatSessio == 'convocada': return True elif estatSessio == 'realitzada': return True elif estatSessio == 'tancada': return True elif estatSessio == 'en_correccio': return True else: return False if organ_tipus == 'restricted_to_members_organ': if estatSessio == 'planificada' and utils.checkhasRol(['OG1-Secretari', 'OG2-Editor'], roles): return True elif estatSessio == 'convocada' and utils.checkhasRol(['OG1-Secretari', 'OG2-Editor', 'OG3-Membre', 'OG5-Convidat'], roles): return True elif estatSessio == 'realitzada' and utils.checkhasRol(['OG1-Secretari', 'OG2-Editor', 'OG3-Membre', 'OG5-Convidat'], roles): return True elif estatSessio == 'tancada' and utils.checkhasRol(['OG1-Secretari', 'OG2-Editor', 'OG3-Membre', 'OG5-Convidat'], roles): return True elif estatSessio == 'en_correccio' and utils.checkhasRol(['OG1-Secretari', 'OG2-Editor', 'OG3-Membre', 'OG5-Convidat'], roles): return True else: return False if organ_tipus == 'restricted_to_affected_organ': if estatSessio == 'planificada' and utils.checkhasRol(['OG1-Secretari', 'OG2-Editor'], roles): return True elif estatSessio == 'convocada' and utils.checkhasRol(['OG1-Secretari', 'OG2-Editor', 'OG3-Membre', 'OG5-Convidat'], roles): return True elif estatSessio == 'realitzada' and utils.checkhasRol(['OG1-Secretari', 'OG2-Editor', 'OG3-Membre', 'OG4-Afectat', 'OG5-Convidat'], roles): return True elif estatSessio == 'tancada' and utils.checkhasRol(['OG1-Secretari', 'OG2-Editor', 'OG3-Membre', 'OG4-Afectat', 'OG5-Convidat'], roles): return True elif estatSessio == 'en_correccio' and utils.checkhasRol(['OG1-Secretari', 'OG2-Editor', 'OG3-Membre', 'OG4-Afectat', 'OG5-Convidat'], roles): return True else: return False
def render(self): estatSessio = utils.session_wf_state(self) if estatSessio not in ['realitzada', 'tancada', 'en_correccio']: sendRemoveVoteEmail(self.context) self.context.estatVotacio = None self.context.tipusVotacio = None self.context.infoVotacio = '{}' self.context.horaIniciVotacio = None self.context.horaFiVotacio = None self.context.reindexObject() transaction.commit() addEntryLog(self.context.__parent__, None, _(u'Eliminada votacio acord'), self.context.absolute_url())
def canViewVotacionsInside(self): roles = utils.getUserRoles(self, self.context, api.user.get_current().id) estatSessio = utils.session_wf_state(self) if estatSessio == 'planificada' and utils.checkhasRol( ['OG1-Secretari', 'OG2-Editor'], roles): return True elif estatSessio in [ 'convocada', 'realitzada', 'tancada', 'en_correccio' ] and utils.checkhasRol(['OG1-Secretari', 'OG2-Editor', 'OG3-Membre'], roles): return True else: return False
def canView(self): # Permissions to view VOTACIOACORD # If manager Show all roles = utils.getUserRoles(self, self.context, api.user.get_current().id) if 'Manager' in roles: return True estatSessio = utils.session_wf_state(self) if estatSessio == 'planificada' and utils.checkhasRol( ['OG1-Secretari', 'OG2-Editor'], roles): return True elif estatSessio in [ 'convocada', 'realitzada', 'tancada', 'en_correccio' ] and utils.checkhasRol(['OG1-Secretari', 'OG2-Editor', 'OG3-Membre'], roles): return True else: raise Unauthorized
def canView(self): # Permissions to view audio roles = utils.getUserRoles(self, self.context, api.user.get_current().id) if 'Manager' in roles: return True estatSessio = utils.session_wf_state(self) organ_tipus = self.context.organType if estatSessio == 'planificada' and utils.checkhasRol(['OG1-Secretari', 'OG2-Editor'], roles): return True elif estatSessio == 'convocada' and utils.checkhasRol(['OG1-Secretari', 'OG2-Editor', 'OG3-Membre', 'OG5-Convidat'], roles): return True elif estatSessio == 'realitzada' and utils.checkhasRol(['OG1-Secretari', 'OG2-Editor', 'OG3-Membre', 'OG5-Convidat'], roles): return True elif organ_tipus == 'open_organ' and estatSessio == 'tancada' and utils.checkhasRol(['OG1-Secretari', 'OG2-Editor', 'OG3-Membre', 'OG4-Afectat', 'OG5-Convidat'], roles): return True elif organ_tipus != 'open_organ' and estatSessio == 'tancada' and utils.checkhasRol(['OG1-Secretari', 'OG2-Editor', 'OG3-Membre', 'OG5-Convidat'], roles): return True elif estatSessio == 'en_correccio' and utils.checkhasRol(['OG1-Secretari', 'OG2-Editor', 'OG3-Membre', 'OG5-Convidat'], roles): return True else: raise Unauthorized
def canView(self): # Permissions to view ACORDS. Poden estar a 1 i 2 nivells # If manager Show all roles = utils.getUserRoles(self, self.context, api.user.get_current().id) if 'Manager' in roles: return True estatSessio = utils.session_wf_state(self) organ_tipus = self.context.organType if organ_tipus == 'open_organ': if estatSessio == 'planificada' and utils.checkhasRol( ['OG1-Secretari', 'OG2-Editor'], roles): return True elif estatSessio == 'convocada': return True elif estatSessio == 'realitzada': return True elif estatSessio == 'tancada': return True elif estatSessio == 'en_correccio': return True else: raise Unauthorized if organ_tipus == 'restricted_to_members_organ': if estatSessio == 'planificada' and utils.checkhasRol( ['OG1-Secretari', 'OG2-Editor'], roles): return True elif estatSessio == 'convocada' and utils.checkhasRol( ['OG1-Secretari', 'OG2-Editor', 'OG3-Membre', 'OG5-Convidat'], roles): return True elif estatSessio == 'realitzada' and utils.checkhasRol( ['OG1-Secretari', 'OG2-Editor', 'OG3-Membre', 'OG5-Convidat'], roles): return True elif estatSessio == 'tancada' and utils.checkhasRol( ['OG1-Secretari', 'OG2-Editor', 'OG3-Membre', 'OG5-Convidat'], roles): return True elif estatSessio == 'en_correccio' and utils.checkhasRol( ['OG1-Secretari', 'OG2-Editor', 'OG3-Membre', 'OG5-Convidat'], roles): return True else: raise Unauthorized if organ_tipus == 'restricted_to_affected_organ': if estatSessio == 'planificada' and utils.checkhasRol( ['OG1-Secretari', 'OG2-Editor'], roles): return True elif estatSessio == 'convocada' and utils.checkhasRol( ['OG1-Secretari', 'OG2-Editor', 'OG3-Membre', 'OG5-Convidat'], roles): return True elif estatSessio == 'realitzada' and utils.checkhasRol([ 'OG1-Secretari', 'OG2-Editor', 'OG3-Membre', 'OG4-Afectat', 'OG5-Convidat' ], roles): return True elif estatSessio == 'tancada' and utils.checkhasRol([ 'OG1-Secretari', 'OG2-Editor', 'OG3-Membre', 'OG4-Afectat', 'OG5-Convidat' ], roles): return True elif estatSessio == 'en_correccio' and utils.checkhasRol([ 'OG1-Secretari', 'OG2-Editor', 'OG3-Membre', 'OG4-Afectat', 'OG5-Convidat' ], roles): return True else: raise Unauthorized