| 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 |
||
| 35 | 9 | public function execute($user, $item, $params) |
|
| 36 | { |
||
| 37 | 9 | $class = Yii::$app->user->identityClass; |
|
| 38 | 9 | if (is_numeric($user) || is_int($user)) { |
|
| 39 | $user = $class::find()->id($user)->one(); |
||
| 40 | } |
||
| 41 | 9 | if (is_string($user)) { |
|
| 42 | $user = $class::find()->guid($user)->one(); |
||
| 43 | } |
||
| 44 | 9 | $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 | 9 | if ($user->isOrganizationCreator($organization)) { |
|
| 48 | 9 | return true; |
|
| 49 | } |
||
| 50 | return false; |
||
| 51 | } |
||
| 52 | } |
||
| 53 |