def __acl__(self): poll = find_interface(self, IPoll) state = poll.get_workflow_state() acl = get_acl_registry() if state == 'ongoing': return acl.get_acl('Vote:ongoing') return acl.get_acl('Vote:closed')
def __acl__(self): acl_reg = get_acl_registry() wf = get_context_wf(self) if wf: state = wf.state in wf.states and wf.state or wf.initial_state return acl_reg.get_acl("%s:%s" % (wf.name, state)) return acl_reg.default()
def __acl__(self): aclreg = get_acl_registry() acl = [] if self.allow_self_registration: acl.append((security.Allow, security.Everyone, security.REGISTER)) acl.extend(aclreg.get_acl('Root:default')) return acl
def acl_panel(context, request, va, **kw): roles_registry = security.get_roles_registry(request.registry) response = { 'acl_registry': security.get_acl_registry(request.registry), 'role_titles': dict([(x, x.title) for x in roles_registry]), } return render('arche:templates/sysinfo/acl.pt', response, request = request)
def init_acl(cls, registry): acl_reg = security.get_acl_registry(registry) priv_name = "%s:private" % cls.name acl_reg[priv_name] = 'private' rev_name = "%s:review" % cls.name acl_reg[rev_name] = 'review' pub_name = "%s:public" % cls.name acl_reg[pub_name] = 'public'
def __acl__(self): meeting = find_interface(self, IMeeting) acl = get_acl_registry() if meeting.get_workflow_state() == 'closed': return acl.get_acl('DiscussionPost:closed') ai = find_interface(self, IAgendaItem) ai_state = ai.get_workflow_state() #If ai is private, use private if ai_state == 'private': return acl.get_acl('DiscussionPost:private') return acl.get_acl('DiscussionPost:open')
def __acl__(self): acl = get_acl_registry() #If ai is private, use private ai = find_interface(self, IAgendaItem) ai_state = ai.get_workflow_state() if ai_state == 'private': return acl.get_acl('Poll:private') state = self.get_workflow_state() #As default - don't traverse to parent acl_name = 'Poll:%s' % state if acl_name in acl: return acl.get_acl(acl_name) return acl.get_acl('Poll:private')
def init_acl(cls, registry): acl_reg = security.get_acl_registry(registry) open_name = "%s:open" % cls.name acl_open = acl_reg.new_acl(open_name) acl_open.add(security.ROLE_ADMIN, security.ALL_PERMISSIONS) acl_open.add(security.ROLE_EDITOR, [security.PERM_VIEW, security.PERM_EDIT, "Add SurveySection"]) acl_open.add(security.ROLE_VIEWER, [security.PERM_VIEW]) acl_open.add(security.Everyone, [permissions.PARTICIPATE_SURVEY]) closed_name = "%s:closed" % cls.name acl_closed = acl_reg.new_acl(closed_name) acl_closed.add(security.ROLE_ADMIN, security.ALL_PERMISSIONS) acl_closed.add(security.ROLE_EDITOR, [security.PERM_VIEW, security.PERM_EDIT, "Add SurveySection"]) acl_closed.add(security.ROLE_VIEWER, [security.PERM_VIEW])
def __acl__(self): ai = find_interface(self, IAgendaItem) ai_state = ai.get_workflow_state() acl = get_acl_registry() #If ai is private, use private if ai_state == 'private': return acl.get_acl('Proposal:private') if ai_state == 'closed': return acl.get_acl('Proposal:closed') state = self.get_workflow_state() acl_name = "Proposal:%s" % state if acl_name in acl: return acl.get_acl(acl_name) return acl.get_acl('Proposal:locked')
def __acl__(self): acl_entries = [] if self.allow_self_registration: acl_entries.append((security.Allow, security.Everyone, security.PERM_REGISTER)) acl_reg = get_acl_registry() wf = get_context_wf(self) if wf: state = wf.state in wf.states and wf.state or wf.initial_state acl_entries.extend(acl_reg.get_acl("%s:%s" % (wf.name, state))) elif self.type_name in acl_reg: acl_entries.extend( acl_reg.get_acl(self.type_name) ) else: acl_entries.append(security.DENY_ALL) return acl_entries
def init_acl(cls, registry): acl_reg = security.get_acl_registry(registry) priv_name = "%s:private" % cls.name acl_reg[priv_name] = security.ACLEntry() acl_reg[priv_name].add(security.ROLE_ADMIN, security.ALL_PERMISSIONS) acl_reg[priv_name].add(security.ROLE_OWNER, [security.PERM_VIEW, security.PERM_EDIT, security.PERM_DELETE]) acl_reg[priv_name].add(security.ROLE_EDITOR, [security.PERM_VIEW, security.PERM_EDIT, security.PERM_DELETE]) acl_reg[priv_name].add(security.ROLE_VIEWER, [security.PERM_VIEW]) pub_name = "%s:public" % cls.name acl_reg[pub_name] = security.ACLEntry() acl_reg[pub_name].add(security.ROLE_ADMIN, security.ALL_PERMISSIONS) acl_reg[pub_name].add(security.ROLE_OWNER, [security.PERM_VIEW, security.PERM_EDIT, security.PERM_DELETE]) acl_reg[pub_name].add(security.ROLE_EDITOR, [security.PERM_VIEW, security.PERM_EDIT, security.PERM_DELETE]) acl_reg[pub_name].add(security.ROLE_VIEWER, [security.PERM_VIEW]) acl_reg[pub_name].add(security.Everyone, [security.PERM_VIEW])
def __acl__(self): """ Return ACL lists according to the priority: - If a workflow exist and the state exist, check '<workflow_name>:<workflow_state_id>' - If the type name exist in the registry, return that - Return 'default' """ acl_reg = get_acl_registry() wf = self.workflow if wf: state = wf.state in wf.states and wf.state or wf.initial_state wf_state = "%s:%s" % (wf.name, state) if wf_state in acl_reg: return acl_reg.get_acl(wf_state) if self.type_name in acl_reg: return acl_reg.get_acl(self.type_name) return acl_reg.get_acl('default')
def __acl__(self): acl = get_acl_registry() state = self.get_workflow_state() if state == 'closed': #Check if the meeting is closed, if not discussion should be allowed + #it should be allowed to change the workflow back if self.__parent__.get_workflow_state() == 'closed': return acl.get_acl('AgendaItem:closed_meeting') return acl.get_acl('AgendaItem:closed_ai') if state == 'private': return acl.get_acl('AgendaItem:private') perms = [] if self.get_field_value('proposal_block', False) == True: perms.append((Deny, security.ROLE_PROPOSE, security.ADD_PROPOSAL)) if self.get_field_value('discussion_block', False) == True: perms.append((Deny, security.ROLE_DISCUSS, security.ADD_DISCUSSION_POST)) perms.extend(self.__parent__.__acl__) return perms
def __acl__(self): acl = get_acl_registry() state = self.get_workflow_state() if state == 'closed': #Check if the meeting is closed, if not discussion should be allowed + #it should be allowed to change the workflow back if self.__parent__.get_workflow_state() == 'closed': return acl.get_acl('AgendaItem:closed_meeting') return acl.get_acl('AgendaItem:closed_ai') if state == 'private': return acl.get_acl('AgendaItem:private') perms = [] if self.get_field_value('proposal_block', False) == True: perms.append((Deny, security.ROLE_PROPOSE, security.ADD_PROPOSAL)) if self.get_field_value('discussion_block', False) == True: perms.append( (Deny, security.ROLE_DISCUSS, security.ADD_DISCUSSION_POST)) perms.extend(self.__parent__.__acl__) return perms
def __acl__(self): acl = get_acl_registry() if self.get_workflow_state() == 'closed': return acl.get_acl('Meeting:closed') return acl.get_acl('Meeting:default')
def init_acl(cls, registry): acl_reg = security.get_acl_registry(registry) acl_reg['%s:inherit' % cls.name] = acl_reg['inherit']