def _create_coordinator_priv_fields(cls): for name, title in sorted(COORDINATOR_PRIV_TITLES.iteritems(), key=itemgetter(1)): setattr( cls, name, BooleanField(title, widget=SwitchWidget(), description=COORDINATOR_PRIV_DESCS[name])) cls.priv_fields.add(name)
def update_session_coordinator_privs(event, data): changes = {} for priv, enabled in data.iteritems(): setting = COORDINATOR_PRIV_SETTINGS[priv] if session_settings.get(event, setting) == enabled: continue session_settings.set(event, setting, enabled) changes[priv] = (not enabled, enabled) db.session.flush() logger.info('Session coordinator privs of event %r updated with %r by %r', event, data, session.user) if changes: log_fields = {priv: orig_string(title) for priv, title in COORDINATOR_PRIV_TITLES.iteritems()} event.log(EventLogRealm.management, EventLogKind.change, 'Sessions', 'Coordinator privileges updated', session.user, data={'Changes': make_diff_log(changes, log_fields)})
def update_session_coordinator_privs(event, data): changes = {} for priv, enabled in data.iteritems(): setting = COORDINATOR_PRIV_SETTINGS[priv] if session_settings.get(event, setting) == enabled: continue session_settings.set(event, setting, enabled) changes[priv] = (not enabled, enabled) db.session.flush() logger.info('Session coordinator privs of event %r updated with %r by %r', event, data, session.user) if changes: log_fields = {priv: orig_string(title) for priv, title in COORDINATOR_PRIV_TITLES.iteritems()} event.log(EventLogRealm.management, EventLogKind.change, 'Sessions', 'Coordinator privileges updated', session.user, data={'Changes': make_diff_log(changes, log_fields)})
def _create_coordinator_priv_fields(cls): for name, title in sorted(COORDINATOR_PRIV_TITLES.iteritems(), key=itemgetter(1)): setattr(cls, name, BooleanField(title, widget=SwitchWidget(), description=COORDINATOR_PRIV_DESCS[name])) cls.priv_fields.add(name)