@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | { |
20 | 20 | public function getConfig(): array |
21 | 21 | { |
22 | - $groupEntityValidator = function (array $params, Group $group, EntityValidatorInterface $defaultValidator, array $config, ContainerInterface $container) { |
|
22 | + $groupEntityValidator = function(array $params, Group $group, EntityValidatorInterface $defaultValidator, array $config, ContainerInterface $container) { |
|
23 | 23 | $validationResult = $defaultValidator->validate($group, $config); |
24 | 24 | |
25 | 25 | if (!$group->getRefName()) { |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | return $validationResult; |
47 | 47 | }; |
48 | 48 | |
49 | - $mapEntity = function (array $params, Group $group, DataMapperInterface $defaultMapper, ContainerInterface $container) { |
|
49 | + $mapEntity = function(array $params, Group $group, DataMapperInterface $defaultMapper, ContainerInterface $container) { |
|
50 | 50 | $allowedFieldsToEdit = ['name', 'refName', 'permissions']; |
51 | 51 | $params = \array_intersect_key($params, \array_flip($allowedFieldsToEdit)); |
52 | 52 | $defaultMapper->mapData($params, $group); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | ], |
82 | 82 | 'hydration' => [ |
83 | 83 | 'groups' => [ |
84 | - 'list' => function (Group $group) { |
|
84 | + 'list' => function(Group $group) { |
|
85 | 85 | return [ |
86 | 86 | 'id' => $group->getId(), |
87 | 87 | 'name' => $group->getName(), |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | 'edit-group' => ['main-form'], |
99 | 99 | ], |
100 | 100 | ], |
101 | - 'format_new_entity_values' => function (array $params, array $config, NewValuesFactoryInterface $defaultImpl, ContainerInterface $container) { |
|
101 | + 'format_new_entity_values' => function(array $params, array $config, NewValuesFactoryInterface $defaultImpl, ContainerInterface $container) { |
|
102 | 102 | return [ |
103 | 103 | 'refName' => null, |
104 | 104 | ]; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | ], |
34 | 34 | 'hydration' => [ |
35 | 35 | 'groups' => [ |
36 | - 'list' => function (Permission $permission) { |
|
36 | + 'list' => function(Permission $permission) { |
|
37 | 37 | $users = []; |
38 | 38 | foreach ($permission->getUsers() as $user) { |
39 | 39 | $users[] = $user->getId(); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | 'list', |
61 | 61 | ], |
62 | 62 | ], |
63 | - 'map_data_on_update' => function (array $params, Permission $permission, DataMapperInterface $defaultMapper, ContainerInterface $container) { |
|
63 | + 'map_data_on_update' => function(array $params, Permission $permission, DataMapperInterface $defaultMapper, ContainerInterface $container) { |
|
64 | 64 | $allowedFieldsToEdit = ['users', 'groups']; |
65 | 65 | $params = \array_intersect_key($params, \array_flip($allowedFieldsToEdit)); |
66 | 66 | $defaultMapper->mapData($params, $permission); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | 'actions' => [ |
37 | 37 | 'create' => ModeraBackendSecurityBundle::ROLE_MANAGE_USER_ACCOUNTS, |
38 | 38 | 'remove' => ModeraBackendSecurityBundle::ROLE_MANAGE_USER_ACCOUNTS, |
39 | - 'update' => function (AuthorizationCheckerInterface $ac, array $params) { |
|
39 | + 'update' => function(AuthorizationCheckerInterface $ac, array $params) { |
|
40 | 40 | if (isset($params['record']) && isset($params['record']['permissions'])) { |
41 | 41 | if (!$ac->isGranted(ModeraBackendSecurityBundle::ROLE_MANAGE_PERMISSIONS)) { |
42 | 42 | return false; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | ; |
59 | 59 | } |
60 | 60 | }, |
61 | - 'batchUpdate' => function (AuthorizationCheckerInterface $ac, array $params) { |
|
61 | + 'batchUpdate' => function(AuthorizationCheckerInterface $ac, array $params) { |
|
62 | 62 | if (isset($params['record']) && isset($params['record']['permissions'])) { |
63 | 63 | if (!$ac->isGranted(ModeraBackendSecurityBundle::ROLE_MANAGE_PERMISSIONS)) { |
64 | 64 | return false; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | return $ac->isGranted(ModeraBackendSecurityBundle::ROLE_MANAGE_USER_PROFILES); |
79 | 79 | }, |
80 | - 'get' => function (AuthorizationCheckerInterface $ac, array $params) { |
|
80 | + 'get' => function(AuthorizationCheckerInterface $ac, array $params) { |
|
81 | 81 | $userId = null; |
82 | 82 | if (isset($params['filter'])) { |
83 | 83 | foreach (new Filters($params['filter']) as $filter) { |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | ], |
107 | 107 | 'hydration' => [ |
108 | 108 | 'groups' => [ |
109 | - 'main-form' => function (User $user) { |
|
109 | + 'main-form' => function(User $user) { |
|
110 | 110 | $meta = []; |
111 | 111 | if ( |
112 | 112 | $this->isGranted(ModeraBackendSecurityBundle::ROLE_MANAGE_USER_PROFILES) |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | 'meta' => $meta, |
127 | 127 | ]; |
128 | 128 | }, |
129 | - 'list' => function (User $user) { |
|
129 | + 'list' => function(User $user) { |
|
130 | 130 | $groups = []; |
131 | 131 | foreach ($user->getGroups() as $group) { |
132 | 132 | $groups[] = $group->getName(); |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | 'meta' => $meta, |
162 | 162 | ]; |
163 | 163 | }, |
164 | - 'compact-list' => function (User $user) { |
|
164 | + 'compact-list' => function(User $user) { |
|
165 | 165 | $groups = []; |
166 | 166 | foreach ($user->getGroups() as $group) { |
167 | 167 | $groups[] = $group->getId(); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | 'modera-backend-security-group-groupusers' => HydrationProfile::create(false)->useGroups(['compact-list']), |
193 | 193 | ], |
194 | 194 | ], |
195 | - 'map_data_on_create' => function (array $params, User $user, DataMapperInterface $defaultMapper, ContainerInterface $container) { |
|
195 | + 'map_data_on_create' => function(array $params, User $user, DataMapperInterface $defaultMapper, ContainerInterface $container) { |
|
196 | 196 | $defaultMapper->mapData($params, $user); |
197 | 197 | |
198 | 198 | if (isset($params['plainPassword']) && $params['plainPassword']) { |
@@ -211,13 +211,13 @@ discard block |
||
211 | 211 | throw new BadPasswordException($e->getErrors()[0], 0, $e); |
212 | 212 | } |
213 | 213 | }, |
214 | - 'map_data_on_update' => function (array $params, User $user, DataMapperInterface $defaultMapper, ContainerInterface $container) { |
|
214 | + 'map_data_on_update' => function(array $params, User $user, DataMapperInterface $defaultMapper, ContainerInterface $container) { |
|
215 | 215 | $ignoreMapping = ['active', 'plainPassword', 'sendPassword']; |
216 | 216 | $params = \array_intersect_key($params, \array_flip($this->getAllowedFieldsToEdit($user))); |
217 | 217 | $params = \array_diff_key($params, \array_flip($ignoreMapping)); |
218 | 218 | $defaultMapper->mapData($params, $user); |
219 | 219 | }, |
220 | - 'update_entity_handler' => function (User $user, array $params, PersistenceHandlerInterface $defaultHandler, ContainerInterface $container) { |
|
220 | + 'update_entity_handler' => function(User $user, array $params, PersistenceHandlerInterface $defaultHandler, ContainerInterface $container) { |
|
221 | 221 | $params = $params['record']; |
222 | 222 | |
223 | 223 | if (isset($params['active'])) { |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | |
257 | 257 | return $defaultHandler->update($user); |
258 | 258 | }, |
259 | - 'updated_entity_validator' => function (array $params, User $user, EntityValidatorInterface $validator, array $config, ContainerInterface $container) { |
|
259 | + 'updated_entity_validator' => function(array $params, User $user, EntityValidatorInterface $validator, array $config, ContainerInterface $container) { |
|
260 | 260 | if (!isset($params['record'])) { |
261 | 261 | $result = new ValidationResult(); |
262 | 262 | $result->addGeneralError('Bad request.'); |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | |
302 | 302 | return $result; |
303 | 303 | }, |
304 | - 'remove_entities_handler' => function ($entities, $params, $defaultHandler, ContainerInterface $container) { |
|
304 | + 'remove_entities_handler' => function($entities, $params, $defaultHandler, ContainerInterface $container) { |
|
305 | 305 | $operationResult = new OperationResult(); |
306 | 306 | |
307 | 307 | /** @var User[] $entities */ |