def _get_defaults(self): registration_managers = { p.principal for p in self.event.acl_entries if p.has_management_permission('registration', explicit=True) } event_session_settings = session_settings.get_all(self.event) coordinator_privs = { name: event_session_settings[val] for name, val in COORDINATOR_PRIV_SETTINGS.iteritems() if event_session_settings.get(val) } permissions = [[ serialize_principal(p.principal), list(get_principal_permissions(p, Event)) ] for p in self.event.acl_entries] permissions = [item for item in permissions if item[1]] return dict( { 'protection_mode': self.event.protection_mode, 'registration_managers': registration_managers, 'access_key': self.event.access_key, 'visibility': self.event.visibility, 'own_no_access_contact': self.event.own_no_access_contact, 'permissions': permissions }, **coordinator_privs)
def _get_defaults(self): permissions = [[ serialize_principal(p.principal), list(get_principal_permissions(p, Category)) ] for p in self.category.acl_entries] permissions = [item for item in permissions if item[1]] return FormDefaults(self.category, permissions=permissions)
def update_permissions(obj, form): event = obj if isinstance(obj, Event) else obj.event current_principal_permissions = {p.principal: get_principal_permissions(p, obj.__class__) for p in obj.acl_entries} current_principal_permissions = {k: v for k, v in current_principal_permissions.iteritems() if v} new_principal_permissions = { principal_from_fossil(fossil, allow_emails=True, allow_networks=True, event=event): set(permissions) for fossil, permissions in form.permissions.data } update_principals_permissions(obj, current_principal_permissions, new_principal_permissions)
def _get_defaults(self): permissions = [[ serialize_principal(p.principal), list(get_principal_permissions(p, Session)) ] for p in self.session.acl_entries] permissions = [item for item in permissions if item[1]] return { 'permissions': permissions, 'protection_mode': self.session.protection_mode }
def _get_defaults(self): registration_managers = {p.principal for p in self.event.acl_entries if p.has_management_permission('registration', explicit=True)} event_session_settings = session_settings.get_all(self.event) coordinator_privs = {name: event_session_settings[val] for name, val in COORDINATOR_PRIV_SETTINGS.iteritems() if event_session_settings.get(val)} permissions = [[serialize_principal(p.principal), list(get_principal_permissions(p, Event))] for p in self.event.acl_entries] permissions = [item for item in permissions if item[1]] return dict({'protection_mode': self.event.protection_mode, 'registration_managers': registration_managers, 'access_key': self.event.access_key, 'visibility': self.event.visibility, 'own_no_access_contact': self.event.own_no_access_contact, 'permissions': permissions}, **coordinator_privs)
def update_permissions(obj, form): event = obj if isinstance(obj, Event) else obj.event current_principal_permissions = { p.principal: get_principal_permissions(p, obj.__class__) for p in obj.acl_entries } current_principal_permissions = { k: v for k, v in current_principal_permissions.iteritems() if v } new_principal_permissions = { principal_from_fossil(fossil, allow_emails=True, allow_networks=True, event=event): set(permissions) for fossil, permissions in form.permissions.data } update_principals_permissions(obj, current_principal_permissions, new_principal_permissions)
def _get_defaults(self): permissions = [[serialize_principal(p.principal), list(get_principal_permissions(p, Contribution))] for p in self.contrib.acl_entries] permissions = [item for item in permissions if item[1]] return {'permissions': permissions, 'protection_mode': self.contrib.protection_mode}