Exemplo n.º 1
0
 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')
Exemplo n.º 2
0
 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()
Exemplo n.º 3
0
 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
Exemplo n.º 4
0
 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
Exemplo n.º 5
0
 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()
Exemplo n.º 6
0
 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')
Exemplo n.º 7
0
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)
Exemplo n.º 8
0
 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'
Exemplo n.º 9
0
 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')
Exemplo n.º 10
0
 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')
Exemplo n.º 11
0
 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')
Exemplo n.º 12
0
 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])
Exemplo n.º 13
0
 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')
Exemplo n.º 14
0
 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')
Exemplo n.º 15
0
 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
Exemplo n.º 16
0
 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])
Exemplo n.º 17
0
 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')
Exemplo n.º 18
0
 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
Exemplo n.º 19
0
 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
Exemplo n.º 20
0
 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')
Exemplo n.º 21
0
 def init_acl(cls, registry):
     acl_reg = security.get_acl_registry(registry)
     acl_reg['%s:inherit' % cls.name] = acl_reg['inherit']