@@ -1,3 +1,3 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace HexMakina\kadro\Auth; |
| 3 | -class AccessRefusedException extends \Exception{} |
|
| 3 | +class AccessRefusedException extends \Exception {} |
|
@@ -17,19 +17,19 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | public function load_operator($id = null) |
| 19 | 19 | { |
| 20 | - if(!is_null($operator_id = $id ?? $this->get('operator_id'))) // extraction failed but we have an fk |
|
| 20 | + if (!is_null($operator_id = $id ?? $this->get('operator_id'))) // extraction failed but we have an fk |
|
| 21 | 21 | $this->operator = Operator::exists($operator_id); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | public function operator() : ?OperatorInterface |
| 25 | 25 | { |
| 26 | - if(is_null($this->operator)) |
|
| 26 | + if (is_null($this->operator)) |
|
| 27 | 27 | { |
| 28 | 28 | $extract_attempt = $this->extract(new Operator(), true); |
| 29 | - if(!is_null($extract_attempt)) |
|
| 29 | + if (!is_null($extract_attempt)) |
|
| 30 | 30 | { |
| 31 | - foreach(['permission_names', 'permission_ids'] as $permission_marker) |
|
| 32 | - if(property_exists($this, $permission_marker)) |
|
| 31 | + foreach (['permission_names', 'permission_ids'] as $permission_marker) |
|
| 32 | + if (property_exists($this, $permission_marker)) |
|
| 33 | 33 | $extract_attempt->set($permission_marker, $this->$permission_marker); |
| 34 | 34 | |
| 35 | 35 | $this->operator = $extract_attempt; |
@@ -45,23 +45,23 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | public static function enhance_query_retrieve($Query, $filters, $options) |
| 47 | 47 | { |
| 48 | - $joined_alias = $Query->auto_join([ACL::table(),'ACL'], null, 'LEFT OUTER'); |
|
| 48 | + $joined_alias = $Query->auto_join([ACL::table(), 'ACL'], null, 'LEFT OUTER'); |
|
| 49 | 49 | $joined_alias = $Query->auto_join([Permission::table(), 'permission'], null, 'LEFT OUTER'); |
| 50 | 50 | |
| 51 | 51 | $permission_ids_and_names = []; |
| 52 | - $permission_ids_and_names []= sprintf('GROUP_CONCAT(DISTINCT %s.%s) as %s', $joined_alias, 'id', $joined_alias.'_ids'); |
|
| 53 | - $permission_ids_and_names []= sprintf('GROUP_CONCAT(DISTINCT %s.%s) as %s', $joined_alias, 'name', $joined_alias.'_names'); |
|
| 52 | + $permission_ids_and_names [] = sprintf('GROUP_CONCAT(DISTINCT %s.%s) as %s', $joined_alias, 'id', $joined_alias.'_ids'); |
|
| 53 | + $permission_ids_and_names [] = sprintf('GROUP_CONCAT(DISTINCT %s.%s) as %s', $joined_alias, 'name', $joined_alias.'_names'); |
|
| 54 | 54 | $Query->select_also($permission_ids_and_names); |
| 55 | 55 | |
| 56 | 56 | $Query->select_also(['operator.name as operator_name', 'operator.active as operator_active']); |
| 57 | 57 | |
| 58 | - if(isset($filters['username'])) |
|
| 58 | + if (isset($filters['username'])) |
|
| 59 | 59 | $Query->aw_eq('username', $filters['username'], 'operator'); |
| 60 | 60 | |
| 61 | - if(isset($filters['email'])) |
|
| 61 | + if (isset($filters['email'])) |
|
| 62 | 62 | $Query->aw_eq('email', $filters['email'], 'operator'); |
| 63 | 63 | |
| 64 | - if(isset($filters['active'])) |
|
| 64 | + if (isset($filters['active'])) |
|
| 65 | 65 | $Query->aw_eq('active', $filters['active'], 'operator'); |
| 66 | 66 | |
| 67 | 67 | return $Query; |