Conditions | 5 |
Paths | 8 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 5.675 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
35 | 7 | public function execute($user, $item, $params) |
|
36 | { |
||
37 | 7 | $class = Yii::$app->user->identityClass; |
|
38 | 7 | if (is_numeric($user) || is_int($user)) { |
|
39 | $user = $class::find()->id($user)->one(); |
||
40 | } |
||
41 | 7 | if (is_string($user)) { |
|
42 | $user = $class::find()->guid($user)->one(); |
||
43 | } |
||
44 | 7 | $organization = $params['organization']; |
|
45 | /* @var $organization Organization */// The Organization to be revoked. |
||
46 | // If current user is creator of organization, he is allowed to revoke it. |
||
47 | 7 | if ($user->isOrganizationCreator($organization)) { |
|
48 | 7 | return true; |
|
49 | } |
||
50 | return false; |
||
51 | } |
||
52 | } |
||
53 |