AltDoc::makeEditForm_accessCheck()   B
last analyzed

Complexity

Conditions 5
Paths 4

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 8.8571
c 0
b 0
f 0
cc 5
eloc 8
nc 4
nop 2
1
<?php
2
3
namespace AOE\Languagevisibility\Hooks;
4
5
	/***************************************************************
6
 * Copyright notice
7
 *
8
 * (c) 2016 AOE GmbH <[email protected]>
9
 * All rights reserved
10
 *
11
 * This script is part of the TYPO3 project. The TYPO3 project is
12
 * free software; you can redistribute it and/or modify
13
 * it under the terms of the GNU General Public License as published by
14
 * the Free Software Foundation; either version 2 of the License, or
15
 * (at your option) any later version.
16
 *
17
 * The GNU General Public License can be found at
18
 * http://www.gnu.org/copyleft/gpl.html.
19
 *
20
 * This script is distributed in the hope that it will be useful,
21
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 * GNU General Public License for more details.
24
 *
25
 * This copyright notice MUST APPEAR in all copies of the script!
26
 ***************************************************************/
27
28
use AOE\Languagevisibility\Services\BeServices;
29
30
/**
31
 * Class/Function which manipulates the item-array for the  listing (see piFlexform).
32
 *
33
 * @author	Fabrizio Brance
34
 * @author	Timo Schmidt
35
 */
36
class AltDoc {
37
38
	/**
39
	 * @param array $params
40
	 * @param SC_alt_doc $ref
41
	 * @return bool
42
	 */
43
	public function makeEditForm_accessCheck(array $params, SC_alt_doc &$ref) {
0 ignored issues
show
Unused Code introduced by
The parameter $ref is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
44
		if ($params['hasAccess']) {
45
			return TRUE;
46
		}
47
48
			// user wants to edit/create page record but has no access to default language
49
		$hasAccess = FALSE;
50
		if ($params['table'] === 'pages' && !$GLOBALS['BE_USER']->checkLanguageAccess(0)) {
51
			if (BeServices::hasUserAccessToPageRecord((int) $params['uid'], $params['cmd'])) {
52
				$hasAccess = TRUE;
53
			}
54
		}
55
		return $hasAccess;
56
	}
57
}
58