Beispiel #1
0
 def _process_PUT(self):
     feature = get_feature_definition(request.view_args['feature'])
     if set_feature_enabled(self.event, feature.name, True):
         flash(_('Feature enabled: {feature}').format(feature=feature.friendly_name), 'success')
         logger.info("Feature '{}' for event {} was enabled by {}".format(feature, self.event, session.user))
         self.event.log(EventLogRealm.management, EventLogKind.positive, 'Features',
                        'Enabled {}'.format(feature.friendly_name), session.user)
     return jsonify_data(enabled=True, event_menu=self.render_event_menu())
Beispiel #2
0
 def _process_DELETE(self):
     feature = get_feature_definition(request.view_args['feature'])
     if set_feature_enabled(self.event, feature.name, False):
         flash(_('Feature disabled: {feature}').format(feature=feature.friendly_name), 'warning')
         logger.info("Feature '{}' for event {} was disabled by {}".format(feature, self.event, session.user))
         self.event.log(EventLogRealm.management, EventLogKind.negative, 'Features',
                        'Disabled {}'.format(feature.friendly_name), session.user)
     return jsonify_data(enabled=False, event_menu=self.render_event_menu())
Beispiel #3
0
 def _process_DELETE(self):
     prev = get_enabled_features(self.event)
     feature = get_feature_definition(request.view_args['feature'])
     changed = set()
     if set_feature_enabled(self.event, feature.name, False):
         current = get_enabled_features(self.event)
         changed = prev - current
         flash(ngettext('Feature disabled: {features}', 'Features disabled: {features}', len(changed))
               .format(features=self._format_feature_names(changed)), 'warning')
         logger.info("Feature '%s' for event %s disabled by %s", feature, self.event, session.user)
         self.event.log(EventLogRealm.management, EventLogKind.negative, 'Features',
                        'Disabled {}'.format(feature.friendly_name), session.user)
     return jsonify_data(enabled=False, event_menu=self.render_event_menu(), changed=list(changed))
Beispiel #4
0
 def _process_PUT(self):
     prev = get_enabled_features(self.event)
     feature = get_feature_definition(request.view_args['feature'])
     changed = set()
     if set_feature_enabled(self.event, feature.name, True):
         current = get_enabled_features(self.event)
         changed = current - prev
         flash(ngettext('Feature enabled: {features}', 'Features enabled: {features}', len(changed))
               .format(features=self._format_feature_names(changed)), 'success')
         logger.info("Feature '%s' for event %s enabled by %s", feature, self.event, session.user)
         self.event.log(EventLogRealm.management, EventLogKind.positive, 'Features',
                        'Enabled {}'.format(feature.friendly_name), session.user)
     return jsonify_data(enabled=True, event_menu=self.render_event_menu(), changed=list(changed))
Beispiel #5
0
 def _process_DELETE(self):
     prev = get_enabled_features(self.event)
     feature = get_feature_definition(request.view_args['feature'])
     changed = set()
     if set_feature_enabled(self.event, feature.name, False):
         current = get_enabled_features(self.event)
         changed = prev - current
         flash(ngettext('Feature disabled: {features}', 'Features disabled: {features}', len(changed))
               .format(features=format_feature_names(changed)), 'warning')
         logger.info("Feature '%s' for event %s disabled by %s", feature.name, self.event, session.user)
         self.event.log(EventLogRealm.management, EventLogKind.negative, 'Features',
                        f'Disabled {feature.friendly_name}', session.user)
     return jsonify_data(enabled=False, event_menu=self.render_event_menu(), changed=list(changed))
Beispiel #6
0
 def _process_PUT(self):
     prev = get_enabled_features(self.event)
     feature = get_feature_definition(request.view_args['feature'])
     if feature.name in get_disallowed_features(self.event):
         raise Forbidden('Feature not available')
     changed = set()
     if set_feature_enabled(self.event, feature.name, True):
         current = get_enabled_features(self.event)
         changed = current - prev
         flash(ngettext('Feature enabled: {features}', 'Features enabled: {features}', len(changed))
               .format(features=format_feature_names(changed)), 'success')
         logger.info("Feature '%s' for event %s enabled by %s", feature.name, self.event, session.user)
         self.event.log(EventLogRealm.management, EventLogKind.positive, 'Features',
                        f'Enabled {feature.friendly_name}', session.user)
     return jsonify_data(enabled=True, event_menu=self.render_event_menu(), changed=list(changed))
Beispiel #7
0
 def _process_PUT(self):
     prev = get_enabled_features(self.event)
     feature = get_feature_definition(request.view_args['feature'])
     changed = set()
     if set_feature_enabled(self.event, feature.name, True):
         current = get_enabled_features(self.event)
         changed = current - prev
         flash(
             ngettext('Feature enabled: {features}',
                      'Features enabled: {features}', len(changed)).format(
                          features=self._format_feature_names(changed)),
             'success')
         logger.info("Feature '{}' for event {} was enabled by {}".format(
             feature, self.event, session.user))
         self.event.log(EventLogRealm.management, EventLogKind.positive,
                        'Features',
                        'Enabled {}'.format(feature.friendly_name),
                        session.user)
     return jsonify_data(enabled=True,
                         event_menu=self.render_event_menu(),
                         changed=list(changed))