mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Implemented account deletion. Not all cases covered with tests [skip ci]
This commit is contained in:
@ -8,7 +8,7 @@ use Webmozart\Assert\Assert;
|
||||
use Yii;
|
||||
use yii\rbac\Rule;
|
||||
|
||||
class AccountOwner extends Rule {
|
||||
final class AccountOwner extends Rule {
|
||||
|
||||
public $name = 'account_owner';
|
||||
|
||||
@ -43,7 +43,11 @@ class AccountOwner extends Rule {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($account->status !== Account::STATUS_ACTIVE) {
|
||||
$allowDeleted = $params['allowDeleted'] ?? false;
|
||||
if ($account->status !== Account::STATUS_ACTIVE
|
||||
// if deleted accounts are allowed, but the passed one is not in deleted state
|
||||
&& (!$allowDeleted || $account->status !== Account::STATUS_DELETED)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user