Pwirth has uploaded a new change for review. https://gerrit.wikimedia.org/r/268641
Change subject: Added a generic group store API backend ...................................................................... Added a generic group store API backend Change-Id: Ia02a8c980334e6cfc224dcf0b088ac018d57dcca --- M BlueSpiceFoundation.php M includes/AutoLoader.php A includes/api/BSApiGroupStore.php 3 files changed, 67 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceFoundation refs/changes/41/268641/1 diff --git a/BlueSpiceFoundation.php b/BlueSpiceFoundation.php index c36203d..e3c708b 100644 --- a/BlueSpiceFoundation.php +++ b/BlueSpiceFoundation.php @@ -68,6 +68,7 @@ $wgAPIModules['bs-filebackend-store'] = 'BSApiFileBackendStore'; $wgAPIModules['bs-user-store'] = 'BSApiUserStore'; +$wgAPIModules['bs-group-store'] = 'BSApiGroupStore'; //I18N MW1.23+ $wgMessagesDirs['BlueSpice'] = __DIR__ . '/i18n/core'; diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 8801ae0..5f27a8f 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -62,6 +62,7 @@ $GLOBALS['wgAutoloadClasses']['BSApiExtJSStoreBase'] = __DIR__."/api/BSApiExtJSStoreBase.php"; $GLOBALS['wgAutoloadClasses']['BSApiFileBackendStore'] = __DIR__."/api/BSApiFileBackendStore.php"; $GLOBALS['wgAutoloadClasses']['BSApiUserStore'] = __DIR__."/api/BSApiUserStore.php"; +$GLOBALS['wgAutoloadClasses']['BSApiGroupStore'] = __DIR__ . '/api/BSApiGroupStore.php'; //adapter $GLOBALS['wgAutoloadClasses']['BsExtensionMW'] = __DIR__."/ExtensionMW.class.php"; diff --git a/includes/api/BSApiGroupStore.php b/includes/api/BSApiGroupStore.php new file mode 100644 index 0000000..66e96b4 --- /dev/null +++ b/includes/api/BSApiGroupStore.php @@ -0,0 +1,65 @@ +<?php +/** + * This class serves as a backend for the group store. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * This file is part of BlueSpice for MediaWiki + * For further information visit http://www.blue-spice.org + * + * @author Patric Wirth <wi...@hallowelt.com> + * @package Bluespice_Foundation + * @copyright Copyright (C) 2015 Hallo Welt! - Medienwerkstatt GmbH, All rights reserved. + * @license http://www.gnu.org/copyleft/gpl.html GNU Public License v2 or later + * + * Example request parameters of an ExtJS store + */ +class BSApiGroupStore extends BSApiExtJSStoreBase { + /** + * @param string $sQuery Potential query provided by ExtJS component. + * This is some kind of preliminary filtering. Subclass has to decide if + * and how to process it + * @return array - Full list of of data objects. Filters, paging, sorting + * will be done by the base class + */ + protected function makeData( $sQuery = '' ) { + global $wgAdditionalGroups, $wgImplicitGroups; + + $aData = array(); + foreach ( BsGroupHelper::getAvailableGroups() as $sGroup ) { + if( in_array($sGroup, $wgImplicitGroups) ) { + continue; + } + $sDisplayName = $sGroup; + $oMsg = wfMessage( "group-$sGroup" ); + if( $oMsg->exists() ) { + $sDisplayName = $oMsg->plain()." ($sGroup)"; + } + + $aData[] = (object) array( + 'group_name' => $sGroup, + 'additional_group' => isset( $wgAdditionalGroups[$sGroup] ), + 'displayname' => $sDisplayName, + ); + } + return $aData; + } + + public function getRequiredPermissions() { + parent::getRequiredPermissions() + array( + 'wikiadmin' + ); + } +} \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/268641 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia02a8c980334e6cfc224dcf0b088ac018d57dcca Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation Gerrit-Branch: master Gerrit-Owner: Pwirth <wi...@hallowelt.biz> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits