Removed deprecated methods

This commit is contained in:
Lucas Bartholemy 2019-09-23 17:03:20 +02:00
parent a77a2a455a
commit 03fdf0267e
7 changed files with 38 additions and 73 deletions

View File

@ -58,3 +58,5 @@ HumHub Change Log (DEVELOP)
- Enh: More generic approach to determine themed view files
- Enh: Always use ISO 639-1 alpha-2 (and ISO 3166-2) language codes
- Enh: Update Yii version to 2.0.27
- Enh: Reorganized translation method categories to reduce language files
- Enh: Removed deprecated methods/classes since v1.1 - see migration guide for details

View File

@ -56,7 +56,7 @@ If you're using any custom modules, please change the message directories accord
The following deprecated method have been removed.
**Content model**
**Content model -removed methods **
- canWrite()
- canRead()
@ -64,7 +64,18 @@ The following deprecated method have been removed.
- getSpace()
- getUser()
**Removed class**
- humhub\modules\space\modules\manage\widgets\Menu
**Space class - removed methods**
- canInvite()
- canShare()
**Notification class - removed methods**
- getSpace()
Migrate from 1.2 to 1.3
-----------------------

View File

@ -160,17 +160,6 @@ class Notification extends \humhub\components\ActiveRecord
return $this->hasOne(User::class, ['id' => 'originator_user_id']);
}
/**
* Returns space of this notification
*
* @return \yii\db\ActiveQuery
* @deprecated since version 1.1
*/
public function getSpace()
{
return $this->hasOne(Space::class, ['id' => 'space_id']);
}
/**
* Returns polymorphic relation linked with this notification
*

View File

@ -354,31 +354,6 @@ class Space extends ContentContainerActiveRecord implements Searchable
return false;
}
/**
* Checks if given user can invite people to this workspace
* Note: use directly permission instead
*
* @return boolean
* @deprecated since version 1.1
*/
public function canInvite()
{
return $this->getPermissionManager()->can(new InviteUsers());
}
/**
* Checks if given user can share content.
* Shared Content is public and is visible also for non members of the space.
* Note: use directly permission instead
*
* @return boolean
* @deprecated since version 1.1
*/
public function canShare()
{
return $this->getPermissionManager()->can(new CreatePublicContent());
}
/**
* Returns an array of informations used by search subsystem.
* Function is defined in interface ISearchable

View File

@ -1,21 +0,0 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2016 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\modules\space\modules\manage\widgets;
/**
* Menu compatibility
*
* @see \humhub\modules\space\widgets\HeaderControlsMenu
* @deprecated since version 1.1
* @author Luke
*/
class Menu extends \humhub\modules\space\widgets\HeaderControlsMenu
{
}

View File

@ -8,25 +8,29 @@
namespace humhub\modules\space\widgets;
use Yii;
use humhub\modules\space\models\Space;
use humhub\modules\space\permissions\InviteUsers;
use yii\base\Widget;
use yii\helpers\Html;
/**
* SpaceInviteButtonWidget
* InviteButton class
*
* @author luke
* @package humhub.modules_core.space.widgets
* @since 0.11
*/
class InviteButton extends Widget
{
/**
* @var Space
*/
public $space;
/**
* @inheritDoc
*/
public function run()
{
if (!$this->space->canInvite()) {
if (!$this->space->getPermissionManager()->can(new InviteUsers())) {
return;
}

View File

@ -8,6 +8,7 @@
namespace humhub\modules\user\controllers;
use humhub\modules\user\Module;
use Yii;
use yii\web\Controller;
use yii\web\HttpException;
@ -94,7 +95,11 @@ class InviteController extends Controller
*/
protected function canInvite()
{
return Yii::$app->getModule('user')->settings->get('auth.internalUsersCanInvite') || Yii::$app->user->can([new ManageUsers(), new ManageGroups()]);
/** @var Module $module */
$module = Yii::$app->getModule('user');
return $module->settings->get('auth.internalUsersCanInvite') ||
Yii::$app->user->can([new ManageUsers(), new ManageGroups()]);
}
}