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