mirror of
https://github.com/humhub/humhub.git
synced 2025-01-18 06:38:14 +01:00
Removed deprecated methods
This commit is contained in:
parent
a77a2a455a
commit
03fdf0267e
@ -58,3 +58,5 @@ HumHub Change Log (DEVELOP)
|
|||||||
- Enh: More generic approach to determine themed view files
|
- Enh: More generic approach to determine themed view files
|
||||||
- Enh: Always use ISO 639-1 alpha-2 (and ISO 3166-2) language codes
|
- Enh: Always use ISO 639-1 alpha-2 (and ISO 3166-2) language codes
|
||||||
- Enh: Update Yii version to 2.0.27
|
- 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
|
||||||
|
@ -56,7 +56,7 @@ If you're using any custom modules, please change the message directories accord
|
|||||||
|
|
||||||
The following deprecated method have been removed.
|
The following deprecated method have been removed.
|
||||||
|
|
||||||
**Content model**
|
**Content model -removed methods **
|
||||||
|
|
||||||
- canWrite()
|
- canWrite()
|
||||||
- canRead()
|
- canRead()
|
||||||
@ -64,7 +64,18 @@ The following deprecated method have been removed.
|
|||||||
- getSpace()
|
- getSpace()
|
||||||
- getUser()
|
- 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
|
Migrate from 1.2 to 1.3
|
||||||
-----------------------
|
-----------------------
|
||||||
|
@ -160,17 +160,6 @@ class Notification extends \humhub\components\ActiveRecord
|
|||||||
return $this->hasOne(User::class, ['id' => 'originator_user_id']);
|
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
|
* Returns polymorphic relation linked with this notification
|
||||||
*
|
*
|
||||||
|
@ -354,31 +354,6 @@ class Space extends ContentContainerActiveRecord implements Searchable
|
|||||||
return false;
|
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.
|
* Returns an array of informations used by search subsystem.
|
||||||
* Function is defined in interface ISearchable
|
* Function is defined in interface ISearchable
|
||||||
|
@ -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
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
@ -8,28 +8,32 @@
|
|||||||
|
|
||||||
namespace humhub\modules\space\widgets;
|
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\base\Widget;
|
||||||
use yii\helpers\Html;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SpaceInviteButtonWidget
|
* InviteButton class
|
||||||
*
|
*
|
||||||
* @author luke
|
* @author luke
|
||||||
* @package humhub.modules_core.space.widgets
|
|
||||||
* @since 0.11
|
* @since 0.11
|
||||||
*/
|
*/
|
||||||
class InviteButton extends Widget
|
class InviteButton extends Widget
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var Space
|
||||||
|
*/
|
||||||
public $space;
|
public $space;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
if (!$this->space->canInvite()) {
|
if (!$this->space->getPermissionManager()->can(new InviteUsers())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('inviteButton', ['space' => $this->space]);
|
return $this->render('inviteButton', ['space' => $this->space]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
namespace humhub\modules\user\controllers;
|
namespace humhub\modules\user\controllers;
|
||||||
|
|
||||||
|
use humhub\modules\user\Module;
|
||||||
use Yii;
|
use Yii;
|
||||||
use yii\web\Controller;
|
use yii\web\Controller;
|
||||||
use yii\web\HttpException;
|
use yii\web\HttpException;
|
||||||
@ -20,7 +21,7 @@ use humhub\widgets\ModalClose;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* InviteController for new user invites
|
* InviteController for new user invites
|
||||||
*
|
*
|
||||||
* @since 1.1
|
* @since 1.1
|
||||||
*/
|
*/
|
||||||
class InviteController extends Controller
|
class InviteController extends Controller
|
||||||
@ -40,7 +41,7 @@ class InviteController extends Controller
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Invite form and processing action
|
* Invite form and processing action
|
||||||
*
|
*
|
||||||
* @return string the action result
|
* @return string the action result
|
||||||
* @throws \yii\web\HttpException
|
* @throws \yii\web\HttpException
|
||||||
*/
|
*/
|
||||||
@ -56,7 +57,7 @@ class InviteController extends Controller
|
|||||||
foreach ($model->getEmails() as $email) {
|
foreach ($model->getEmails() as $email) {
|
||||||
$this->createInvite($email);
|
$this->createInvite($email);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ModalClose::widget([
|
return ModalClose::widget([
|
||||||
'success' => Yii::t('UserModule.base', 'User has been invited.')
|
'success' => Yii::t('UserModule.base', 'User has been invited.')
|
||||||
]);
|
]);
|
||||||
@ -67,7 +68,7 @@ class InviteController extends Controller
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and sends an e-mail invite
|
* Creates and sends an e-mail invite
|
||||||
*
|
*
|
||||||
* @param email $email
|
* @param email $email
|
||||||
*/
|
*/
|
||||||
protected function createInvite($email)
|
protected function createInvite($email)
|
||||||
@ -76,25 +77,29 @@ class InviteController extends Controller
|
|||||||
$userInvite->email = $email;
|
$userInvite->email = $email;
|
||||||
$userInvite->source = Invite::SOURCE_INVITE;
|
$userInvite->source = Invite::SOURCE_INVITE;
|
||||||
$userInvite->user_originator_id = Yii::$app->user->getIdentity()->id;
|
$userInvite->user_originator_id = Yii::$app->user->getIdentity()->id;
|
||||||
|
|
||||||
$existingInvite = Invite::findOne(['email' => $email]);
|
$existingInvite = Invite::findOne(['email' => $email]);
|
||||||
if ($existingInvite !== null) {
|
if ($existingInvite !== null) {
|
||||||
$userInvite->token = $existingInvite->token;
|
$userInvite->token = $existingInvite->token;
|
||||||
$existingInvite->delete();
|
$existingInvite->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
$userInvite->save();
|
$userInvite->save();
|
||||||
$userInvite->sendInviteMail();
|
$userInvite->sendInviteMail();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if current user can invite new members
|
* Checks if current user can invite new members
|
||||||
*
|
*
|
||||||
* @return boolean can invite new members
|
* @return boolean can invite new members
|
||||||
*/
|
*/
|
||||||
protected function canInvite()
|
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()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user