Completed
Push — 7LTS_compatible ( 3cba02...531c8c )
by Tomas Norre
02:29
created

BeUser::allowCutCopyMoveDelete()   A

Complexity

Conditions 4
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 11
rs 9.2
cc 4
eloc 7
nc 2
nop 0
1
<?php
2
3
namespace AOE\Languagevisibility;
4
5
/***************************************************************
6
 * Copyright notice
7
 *
8
 * (c) 2014 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
/**
29
 * @author	Daniel Pötzinger
30
 *
31
 * Class tx_languagevisibility_beUser
32
 */
33
class BeUser {
34
35
	private $beUser;
36
37
	/**
38
	 * Constructor
39
	 */
40
	public function __construct() {
41
		$this->beUser = $GLOBALS['BE_USER'];
42
	}
43
44
	/**
45
	 * This Method determines if the option allow_movecutdelete_foroverlays has been
46
	 * set. It
47
	 *
48
	 * @return bool
49
	 */
50
	public function allowCutCopyMoveDelete() {
51
		$res = FALSE;
52
		if (is_array($this->beUser->userGroups)) {
53
			foreach ( $this->beUser->userGroups as $group ) {
54
				if ($group['tx_languagevisibility_allow_movecutdelete_foroverlays']) {
55
					$res = TRUE;
56
				}
57
			}
58
		}
59
		return $res;
60
	}
61
62
	/**
63
	 * @return mixed
64
	 */
65
	public function isAdmin() {
66
		return $this->beUser->isAdmin();
67
	}
68
69
	/**
70
	 * This method returns the userId of the current backend user.
71
	 *
72
	 * @return int userId of the backend user
73
	 */
74
	public function getUid() {
75
		return $this->beUser->user['uid'];
76
	}
77
}
78