public function save(ServiceMediawiki $service, HTTPRequest $request)
 {
     $this->assertUserIsProjectAdmin($service, $request);
     if ($request->isPost()) {
         $project = $request->getProject();
         $new_mapping_list = $this->getSelectedMappingsFromRequest($request, $project);
         $this->mapper->saveMapping($new_mapping_list, $project);
         $options = $this->manager->getDefaultOptions();
         if (!$this->requestIsRestore($request)) {
             foreach (array_keys($this->manager->getDefaultOptions()) as $key) {
                 $options[$key] = $request->get($key);
             }
         }
         $this->manager->saveOptions($project, $options);
         if (!$this->requestIsRestore($request)) {
             $selected_read_ugroup = $request->get('read_ugroups');
             if ($selected_read_ugroup) {
                 $override_collection = new PermissionsNormalizerOverrideCollection();
                 $normalized_ids = $this->permissions_normalizer->getNormalizedUGroupIds($project, $selected_read_ugroup, $override_collection);
                 if ($this->manager->saveReadAccessControl($project, $normalized_ids)) {
                     $override_collection->emitFeedback(MediawikiManager::READ_ACCESS);
                 }
             }
             $selected_write_ugroup = $request->get('write_ugroups');
             if ($selected_write_ugroup) {
                 $override_collection = new PermissionsNormalizerOverrideCollection();
                 $normalized_ids = $this->permissions_normalizer->getNormalizedUGroupIds($project, $selected_write_ugroup, $override_collection);
                 if ($this->manager->saveWriteAccessControl($project, $normalized_ids)) {
                     $override_collection->emitFeedback(MediawikiManager::WRITE_ACCESS);
                 }
             }
         }
         if ($this->requestIsRestore($request)) {
             $GLOBALS['Response']->addFeedback(Feedback::INFO, $GLOBALS['Language']->getText('plugin_mediawiki', 'options_restored'));
         } else {
             $GLOBALS['Response']->addFeedback(Feedback::INFO, $GLOBALS['Language']->getText('plugin_mediawiki', 'options_saved'));
         }
     }
     $GLOBALS['Response']->redirect(MEDIAWIKI_BASE_URL . '/forge_admin?' . http_build_query(array('group_id' => $request->get('group_id'))));
 }
 public function save(ServiceMediawiki $service, HTTPRequest $request)
 {
     $this->assertUserIsProjectAdmin($service, $request);
     if ($request->isPost()) {
         $project = $request->getProject();
         $new_mapping_list = $this->getSelectedMappingsFromRequest($request, $project);
         $this->mapper->saveMapping($new_mapping_list, $project);
         $options = $this->manager->getDefaultOptions();
         if (!$this->requestIsRestore($request)) {
             foreach (array_keys($this->manager->getDefaultOptions()) as $key) {
                 $options[$key] = $request->get($key);
             }
         }
         $this->manager->saveOptions($project, $options);
         if ($this->requestIsRestore($request)) {
             $GLOBALS['Response']->addFeedback(Feedback::INFO, $GLOBALS['Language']->getText('plugin_mediawiki', 'options_restored'));
         } else {
             $GLOBALS['Response']->addFeedback(Feedback::INFO, $GLOBALS['Language']->getText('plugin_mediawiki', 'options_saved'));
         }
     }
     $GLOBALS['Response']->redirect(MEDIAWIKI_BASE_URL . '/forge_admin?' . http_build_query(array('group_id' => $request->get('group_id'))));
 }