From 889f95cd95d5b3c89d0fe7f48de3ede5ea02bfbf Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Fri, 22 May 2015 22:01:41 +0200 Subject: [PATCH] Integrate UserExtendedClipboardAction into UserClipboardAction --- CHANGELOG.md | 1 + com.woltlab.wcf/clipboardAction.xml | 4 +- .../action/UserClipboardAction.class.php | 42 ++++++++- .../UserExtendedClipboardAction.class.php | 92 ------------------- 4 files changed, 44 insertions(+), 95 deletions(-) delete mode 100644 wcfsetup/install/files/lib/system/clipboard/action/UserExtendedClipboardAction.class.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 46a5e31b5e..5bd41ca23d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,5 +9,6 @@ * `permissions` and `options` support for template listeners. * `wcf\data\TDatabaseObjectOptions` and `wcf\data\TDatabaseObjectPermissions` for database object-bound options and permissions validation. * `wcf\system\cache\builder\EventListenerCacheBuilder` returns `wcf\data\event\listener\EventListener` objects instead of data arrays. +* `wcf\system\clipboard\action\UserExtendedClipboardAction` removed. * `wcf\system\event\listener\PreParserAtUserListener` removed. diff --git a/com.woltlab.wcf/clipboardAction.xml b/com.woltlab.wcf/clipboardAction.xml index 57ccaa70bc..2addad9f27 100644 --- a/com.woltlab.wcf/clipboardAction.xml +++ b/com.woltlab.wcf/clipboardAction.xml @@ -26,7 +26,7 @@ - + 4 @@ -34,7 +34,7 @@ - + 5 diff --git a/wcfsetup/install/files/lib/system/clipboard/action/UserClipboardAction.class.php b/wcfsetup/install/files/lib/system/clipboard/action/UserClipboardAction.class.php index 5b3d743665..0c1ef8b141 100644 --- a/wcfsetup/install/files/lib/system/clipboard/action/UserClipboardAction.class.php +++ b/wcfsetup/install/files/lib/system/clipboard/action/UserClipboardAction.class.php @@ -25,7 +25,7 @@ class UserClipboardAction extends AbstractClipboardAction { /** * @see \wcf\system\clipboard\action\AbstractClipboardAction::$supportedActions */ - protected $supportedActions = array('assignToGroup', 'ban', 'delete', 'exportMailAddress', 'sendMail', 'sendNewPassword'); + protected $supportedActions = array('assignToGroup', 'ban', 'delete', 'enable', 'exportMailAddress', 'merge', 'sendMail', 'sendNewPassword'); /** * @see \wcf\system\clipboard\action\IClipboardAction::execute() @@ -53,6 +53,10 @@ class UserClipboardAction extends AbstractClipboardAction { $item->setURL(LinkHandler::getInstance()->getLink('UserEmailAddressExport')); break; + case 'merge': + $item->setURL(LinkHandler::getInstance()->getLink('UserMerge')); + break; + case 'sendMail': $item->setURL(LinkHandler::getInstance()->getLink('UserMail')); break; @@ -168,4 +172,40 @@ class UserClipboardAction extends AbstractClipboardAction { return $this->__validateAccessibleGroups(array_keys($this->objects)); } + + /** + * Returns the ids of the users which can be enabled. + * + * @return array + */ + protected function validateEnable() { + // check permissions + if (!WCF::getSession()->getPermission('admin.user.canEnableUser')) { + return array(); + } + + $userIDs = array(); + foreach ($this->objects as $user) { + if ($user->activationCode) $userIDs[] = $user->userID; + } + + return $userIDs; + } + + /** + * Returns the ids of the users which can be merge. + * + * @return array + */ + protected function validateMerge() { + // check permissions + if (!WCF::getSession()->getPermission('admin.user.canEditUser')) { + return array(); + } + + $userIDs = array_keys($this->objects); + if (count($userIDs) < 2) return array(); + + return $userIDs; + } } diff --git a/wcfsetup/install/files/lib/system/clipboard/action/UserExtendedClipboardAction.class.php b/wcfsetup/install/files/lib/system/clipboard/action/UserExtendedClipboardAction.class.php deleted file mode 100644 index 1820ba1a0d..0000000000 --- a/wcfsetup/install/files/lib/system/clipboard/action/UserExtendedClipboardAction.class.php +++ /dev/null @@ -1,92 +0,0 @@ - - * @package com.woltlab.wcf - * @subpackage system.clipboard.action - * @category Community Framework - */ -class UserExtendedClipboardAction extends AbstractClipboardAction { - /** - * @see \wcf\system\clipboard\action\AbstractClipboardAction::$supportedActions - */ - protected $supportedActions = array('merge', 'enable'); - - /** - * @see \wcf\system\clipboard\action\IClipboardAction::execute() - */ - public function execute(array $objects, ClipboardAction $action) { - $item = parent::execute($objects, $action); - - if ($item === null) { - return null; - } - - // handle actions - switch ($action->actionName) { - case 'merge': - $item->setURL(LinkHandler::getInstance()->getLink('UserMerge')); - break; - } - - return $item; - } - - /** - * @see \wcf\system\clipboard\action\IClipboardAction::getClassName() - */ - public function getClassName() { - return 'wcf\data\user\UserAction'; - } - - /** - * @see \wcf\system\clipboard\action\IClipboardAction::getTypeName() - */ - public function getTypeName() { - return 'com.woltlab.wcf.user'; - } - - /** - * Returns the ids of the users which can be enabled. - * - * @return array - */ - protected function validateEnable() { - // check permissions - if (!WCF::getSession()->getPermission('admin.user.canEnableUser')) { - return array(); - } - - $userIDs = array(); - foreach ($this->objects as $user) { - if ($user->activationCode) $userIDs[] = $user->userID; - } - - return $userIDs; - } - - /** - * Returns the ids of the users which can be merge. - * - * @return array - */ - protected function validateMerge() { - // check permissions - if (!WCF::getSession()->getPermission('admin.user.canEditUser')) { - return array(); - } - - $userIDs = array_keys($this->objects); - if (count($userIDs) < 2) return array(); - - return $userIDs; - } -} -- 2.20.1