Failed Conditions
Branch newinternal (bd75e4)
by Simon
03:48
created

SecurityConfiguration::setCommunity()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Waca\Security;
4
5
/**
6
 * Class SecurityConfiguration
7
 * @package  Waca
8
 * @category Security-Critical
9
 */
10
final class SecurityConfiguration
11
{
12
	const ALLOW = "allow";
13
	const DENY = "deny";
14
	private $admin = "default";
15
	private $user = "default";
16
	private $checkuser = "default";
17
	private $community = "default";
18
	private $suspended = "default";
19
	private $declined = "default";
20
	private $new = "default";
21
	private $requireIdentified;
22
23
	/**
24
	 * Sets whether a checkuser is able to gain access.
25
	 *
26
	 * This is private because it's DANGEROUS. Checkusers are not mutually-exclusive with other rights. As such, a
27
	 * suspended checkuser who tries to access a page which allows checkusers will be granted access to the page, UNLESS
28
	 * that page is also set to DENY (note, not default) New/Declined/Suspended users. I have no problem with this
29
	 * method being used, but please ONLY use it in this class in static methods of Security. Nowhere else.
30
	 *
31
	 * @param string $checkuser
32
	 *
33
	 * @return SecurityConfiguration
34
	 * @category Security-Critical
35
	 */
36
	public function setCheckuser($checkuser)
37
	{
38
		$this->checkuser = $checkuser;
39
40
		return $this;
41
	}
42
43
44
45
	/**
46
	 * Returns if a user is required to be identified.
47
	 *
48
	 * @return boolean
49
	 */
50 32
	public function requiresIdentifiedUser()
51
	{
52 32
		return $this->requireIdentified;
53
	}
54
55
	/**
56
	 * @return string
57
	 */
58 32
	public function getAdmin()
59
	{
60 32
		return $this->admin;
61
	}
62
63
	/**
64
	 * @param string $admin
65
	 *
66
	 * @return SecurityConfiguration
67
	 * @category Security-Critical
68
	 */
69 4
	public function setAdmin($admin)
70
	{
71 4
		$this->admin = $admin;
72
73 4
		return $this;
74
	}
75
76
	/**
77
	 * @return string
78
	 */
79 29
	public function getUser()
80
	{
81 29
		return $this->user;
82
	}
83
84
	/**
85
	 * @param string $user
86
	 *
87
	 * @return SecurityConfiguration
88
	 * @category Security-Critical
89
	 */
90 3
	public function setUser($user)
91
	{
92 3
		$this->user = $user;
93
94 3
		return $this;
95
	}
96
97
	/**
98
	 * @return string
99
	 */
100 10
	public function getCheckuser()
101
	{
102 10
		return $this->checkuser;
103
	}
104
105
	/**
106
	 * @return string
107
	 */
108 26
	public function getCommunity()
109
	{
110 26
		return $this->community;
111
	}
112
113
	/**
114
	 * @param string $community
115
	 *
116
	 * @return SecurityConfiguration
117
	 * @category Security-Critical
118
	 */
119 4
	public function setCommunity($community)
120
	{
121 4
		$this->community = $community;
122
123 4
		return $this;
124
	}
125
126
	/**
127
	 * @return string
128
	 */
129 22
	public function getSuspended()
130
	{
131 22
		return $this->suspended;
132
	}
133
134
	/**
135
	 * @param string $suspended
136
	 *
137
	 * @return SecurityConfiguration
138
	 * @category Security-Critical
139
	 */
140 4
	public function setSuspended($suspended)
141
	{
142 4
		$this->suspended = $suspended;
143
144 4
		return $this;
145
	}
146
147
	/**
148
	 * @return string
149
	 */
150 18
	public function getDeclined()
151
	{
152 18
		return $this->declined;
153
	}
154
155
	/**
156
	 * @param string $declined
157
	 *
158
	 * @return SecurityConfiguration
159
	 * @category Security-Critical
160
	 */
161 4
	public function setDeclined($declined)
162
	{
163 4
		$this->declined = $declined;
164
165 4
		return $this;
166
	}
167
168
	/**
169
	 * @return string
170
	 */
171 14
	public function getNew()
172
	{
173 14
		return $this->new;
174
	}
175
176
	/**
177
	 * @param string $new
178
	 *
179
	 * @return SecurityConfiguration
180
	 * @category Security-Critical
181
	 */
182 10
	public function setNew($new)
183
	{
184 10
		$this->new = $new;
185
186 10
		return $this;
187
	}
188
189
	/**
190
	 * @param boolean $requireIdentified
191
	 */
192
	public function setRequireIdentified($requireIdentified)
193
	{
194
		$this->requireIdentified = $requireIdentified;
195
	}
196
}