1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40:08 +00:00
Tims-Chat/file/lib/data/suspension/SuspensionAction.class.php

52 lines
1.3 KiB
PHP
Raw Normal View History

2012-05-19 19:25:50 +00:00
<?php
2013-01-19 19:36:40 +00:00
namespace chat\data\suspension;
2013-06-22 16:43:38 +00:00
use \wcf\system\WCF;
2012-05-19 19:25:50 +00:00
/**
* Executes chat-suspension-related actions.
*
* @author Tim Düsterhus
2013-01-19 19:36:40 +00:00
* @copyright 2010-2013 Tim Düsterhus
2012-05-19 19:25:50 +00:00
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
2013-01-19 19:36:40 +00:00
* @package be.bastelstu.chat
* @subpackage data.suspension
2012-05-19 19:25:50 +00:00
*/
2013-01-19 19:36:40 +00:00
class SuspensionAction extends \wcf\data\AbstractDatabaseObjectAction {
2012-05-19 19:25:50 +00:00
/**
* @see \wcf\data\AbstractDatabaseObjectAction::$className
*/
2013-01-19 19:36:40 +00:00
protected $className = '\chat\data\suspension\SuspensionEditor';
2012-05-19 19:25:50 +00:00
/**
* @see \wcf\data\AbstractDatabaseObjectAction::$requireACP
*/
protected $requireACP = array('revoke');
2013-06-22 16:43:38 +00:00
/**
* Validates permissions and parameters
*/
public function validateRevoke() {
WCF::getSession()->checkPermissions((array) 'admin.chat.canManageSuspensions');
$this->parameters['revoker'] = WCF::getUser()->userID;
}
2013-06-22 12:40:54 +00:00
/**
* Revokes suspensions.
*/
public function revoke() {
2013-09-13 20:35:30 +00:00
// TODO: ignore revokes if suspension already is revoked
2013-06-22 12:40:54 +00:00
if (!isset($this->parameters['revoker'])) {
$this->parameters['revoker'] = null;
}
$objectAction = new self($this->objectIDs, 'update', array(
'data' => array(
2013-06-22 14:35:48 +00:00
'expires' => TIME_NOW,
2013-06-22 12:40:54 +00:00
'revoker' => $this->parameters['revoker']
)
));
$objectAction->executeAction();
2012-05-19 19:25:50 +00:00
}
}