Code Duplication    Length = 11-11 lines in 2 locations

Classes/Domain/Model/Content.php 1 location

@@ 421-431 (lines=11) @@
418
     * @return array
419
     * @throws \Exception
420
     */
421
    protected function filterForBackendUser($fields)
422
    {
423
        if (!$this->getBackendUser()->isAdmin()) {
424
            foreach ($fields as $key => $fieldName) {
425
                if (Tca::table($this->dataType)->hasField($fieldName) && !Tca::table($this->dataType)->field($fieldName)->hasAccess()) {
426
                    unset($fields[$key]);
427
                }
428
            }
429
        }
430
        return $fields;
431
    }
432
433
    /**
434
     * Remove fields according to Grid configuration.

Classes/Tca/GridService.php 1 location

@@ 251-261 (lines=11) @@
248
     * @return array
249
     * @throws \Exception
250
     */
251
    protected function filterByBackendUser($fields)
252
    {
253
        if (!$this->getBackendUser()->isAdmin()) {
254
            foreach ($fields as $fieldName => $field) {
255
                if (Tca::table($this->tableName)->hasField($fieldName) && !Tca::table($this->tableName)->field($fieldName)->hasAccess()) {
256
                    unset($fields[$fieldName]);
257
                }
258
            }
259
        }
260
        return $fields;
261
    }
262
263
    /**
264
     * Remove fields according to Grid configuration.