def chamber_id(self): """Vocabularies in the forms get the chamber id from the context, this property returns the id of the chamber the currently logged in user is a member of """ chamber = utils.get_user_chamber(utils.get_login_user()) return chamber.group_id
def __init__(self, context): self.context = context chamber = utils.get_user_chamber(utils.get_login_user()) if chamber: self.object_type = chamber.type self.oid = chamber.group_id else: self.object_type = None self.oid = None
def can_schedule(type_key, workflow): """Determine if the current user can schedule this document type. i.e. if they have the global workflow permission to schedule a document. """ allow = False schedulable_states = get_schedulable_states(type_key) scheduled_states = get_scheduled_states(type_key) if schedulable_states and scheduled_states: transitions = workflow.get_transitions_from(schedulable_states[0]) transitions = [ trans for trans in transitions if trans.destination == scheduled_states[0] ] if transitions: allow = checkPermission( transitions[0].permission, get_user_chamber(get_login_user())) return allow
def can_schedule(type_key, workflow): """Determine if the current user can schedule this document type. i.e. if they have the global workflow permission to schedule a document. """ allow = False schedulable_states = get_schedulable_states(type_key) scheduled_states = get_scheduled_states(type_key) if schedulable_states and scheduled_states: transitions = workflow.get_transitions_from(schedulable_states[0]) transitions = [ trans for trans in transitions if trans.destination == scheduled_states[0] ] if transitions: allow = checkPermission(transitions[0].permission, get_user_chamber(get_login_user())) return allow
def get_body_css_class(self): # add custom css classes to the list below #!+SUB_TYPE chamber_conceptual_name chamber_type = "default" user = utils.get_login_user() if user: # IBungeniAuthenticatedSkin chamber = utils.get_user_chamber(user) #!+SUB_TYPE #if chamber and chamber.conceptual_name: # chamber_conceptual_name = chamber.conceptual_name if chamber and chamber.sub_type: chamber_type = chamber.sub_type classes = [ "yui-skin-sam", "section-bungeni-%s" % get_section_name(), #!+SUB_TYPE "chamber-%s" % chamber_conceptual_name "chamber-%s" % chamber_type ] return " ".join(classes)