Failed Conditions
Push — dependabot/npm_and_yarn/sass-1... ( 173e70...4078c3 )
by
unknown
14:54 queued 09:32
created
includes/Security/ISecurityManager.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -12,29 +12,29 @@
 block discarded – undo
12 12
 
13 13
 interface ISecurityManager
14 14
 {
15
-    public const ALLOWED = 1;
16
-    public const ERROR_NOT_IDENTIFIED = 2;
17
-    public const ERROR_DENIED = 3;
15
+	public const ALLOWED = 1;
16
+	public const ERROR_NOT_IDENTIFIED = 2;
17
+	public const ERROR_DENIED = 3;
18 18
 
19
-    /**
20
-     * Tests if a user is allowed to perform an action.
21
-     *
22
-     * This method should form a hard, deterministic security barrier, and only return true if it is absolutely sure
23
-     * that a user should have access to something.
24
-     *
25
-     * @param string $page
26
-     * @param string $route
27
-     * @param User   $user
28
-     *
29
-     * @return int
30
-     *
31
-     * @category Security-Critical
32
-     */
33
-    public function allows(string $page, string $route, User $user): int;
19
+	/**
20
+	 * Tests if a user is allowed to perform an action.
21
+	 *
22
+	 * This method should form a hard, deterministic security barrier, and only return true if it is absolutely sure
23
+	 * that a user should have access to something.
24
+	 *
25
+	 * @param string $page
26
+	 * @param string $route
27
+	 * @param User   $user
28
+	 *
29
+	 * @return int
30
+	 *
31
+	 * @category Security-Critical
32
+	 */
33
+	public function allows(string $page, string $route, User $user): int;
34 34
 
35
-    public function getActiveRoles(User $user, ?array &$activeRoles, ?array &$inactiveRoles);
35
+	public function getActiveRoles(User $user, ?array &$activeRoles, ?array &$inactiveRoles);
36 36
 
37
-    public function getCachedActiveRoles(User $user, ?array &$activeRoles, ?array &$inactiveRoles): void;
37
+	public function getCachedActiveRoles(User $user, ?array &$activeRoles, ?array &$inactiveRoles): void;
38 38
 
39
-    public function getAvailableRoles(): array;
39
+	public function getAvailableRoles(): array;
40 40
 }
41 41
\ No newline at end of file
Please login to merge, or discard this patch.
includes/Security/UserAccessLoader.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -15,37 +15,37 @@
 block discarded – undo
15 15
 
16 16
 final class UserAccessLoader implements IUserAccessLoader
17 17
 {
18
-    public function loadRolesForUser(User $user): array
19
-    {
20
-        $domain = Domain::getCurrent($user->getDatabase());
21
-        $userRoles = UserRole::getForUser($user->getId(), $user->getDatabase(), $domain->getId());
18
+	public function loadRolesForUser(User $user): array
19
+	{
20
+		$domain = Domain::getCurrent($user->getDatabase());
21
+		$userRoles = UserRole::getForUser($user->getId(), $user->getDatabase(), $domain->getId());
22 22
 
23
-        return array_map(fn(UserRole $r): string => $r->getRole(), $userRoles);
24
-    }
23
+		return array_map(fn(UserRole $r): string => $r->getRole(), $userRoles);
24
+	}
25 25
 
26
-    public function loadDomainsForUser(User $user): array
27
-    {
28
-        $database = $user->getDatabase();
26
+	public function loadDomainsForUser(User $user): array
27
+	{
28
+		$database = $user->getDatabase();
29 29
 
30
-        $statement = $database->prepare(<<<'SQL'
30
+		$statement = $database->prepare(<<<'SQL'
31 31
             SELECT d.* 
32 32
             FROM domain d
33 33
             INNER JOIN userdomain ud on d.id = ud.domain
34 34
             WHERE ud.user = :user
35 35
             AND d.enabled = 1
36 36
 SQL
37
-        );
38
-        $statement->execute([
39
-            ':user' => $user->getId()
40
-        ]);
37
+		);
38
+		$statement->execute([
39
+			':user' => $user->getId()
40
+		]);
41 41
 
42
-        $resultObjects = $statement->fetchAll(PDO::FETCH_CLASS, Domain::class);
42
+		$resultObjects = $statement->fetchAll(PDO::FETCH_CLASS, Domain::class);
43 43
 
44
-        /** @var Domain $t */
45
-        foreach ($resultObjects as $t) {
46
-            $t->setDatabase($database);
47
-        }
44
+		/** @var Domain $t */
45
+		foreach ($resultObjects as $t) {
46
+			$t->setDatabase($database);
47
+		}
48 48
 
49
-        return $resultObjects;
50
-    }
49
+		return $resultObjects;
50
+	}
51 51
 }
52 52
\ No newline at end of file
Please login to merge, or discard this patch.
includes/Security/IDomainAccessManager.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@
 block discarded – undo
13 13
 
14 14
 interface IDomainAccessManager
15 15
 {
16
-    public function switchToDefaultDomain(User $user): void;
16
+	public function switchToDefaultDomain(User $user): void;
17 17
 
18
-    public function switchDomain(User $user, Domain $newDomain): void;
18
+	public function switchDomain(User $user, Domain $newDomain): void;
19 19
 
20
-    /**
21
-     * @param User $user
22
-     *
23
-     * @return Domain[]
24
-     */
25
-    public function getAllowedDomains(User $user): array;
20
+	/**
21
+	 * @param User $user
22
+	 *
23
+	 * @return Domain[]
24
+	 */
25
+	public function getAllowedDomains(User $user): array;
26 26
 }
27 27
\ No newline at end of file
Please login to merge, or discard this patch.
includes/Security/RoleConfigurationBase.php 1 patch
Indentation   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -10,135 +10,135 @@
 block discarded – undo
10 10
 
11 11
 abstract class RoleConfigurationBase
12 12
 {
13
-    const ACCESS_ALLOW = 1;
14
-    const ACCESS_DENY = -1;
15
-    const ACCESS_DEFAULT = 0;
16
-    const MAIN = 'main';
17
-    const ALL = '*';
18
-
19
-    protected array $roleConfig;
20
-    protected array $identificationExempt;
21
-
22
-    protected function __construct(array $roleConfig, array $identificationExempt)
23
-    {
24
-        $this->roleConfig = $roleConfig;
25
-        $this->identificationExempt = $identificationExempt;
26
-    }
27
-
28
-    /**
29
-     * Takes an array of role names and flattens the values to a single
30
-     * resultant role configuration.
31
-     *
32
-     * @param string[] $activeRoles
33
-     * @category Security-Critical
34
-     */
35
-    public function getResultantRole(array $activeRoles): array
36
-    {
37
-        $result = array();
38
-
39
-        $roleConfig = $this->getApplicableRoles($activeRoles);
40
-
41
-        // Iterate over every page in every role
42
-        foreach ($roleConfig as $role) {
43
-            foreach ($role as $page => $pageRights) {
44
-                // Create holder in result for this page
45
-                if (!isset($result[$page])) {
46
-                    $result[$page] = array();
47
-                }
48
-
49
-                foreach ($pageRights as $action => $permission) {
50
-                    // Deny takes precedence, so if it's set, don't change it.
51
-                    if (isset($result[$page][$action])) {
52
-                        if ($result[$page][$action] === RoleConfigurationBase::ACCESS_DENY) {
53
-                            continue;
54
-                        }
55
-                    }
56
-
57
-                    if ($permission === RoleConfigurationBase::ACCESS_DEFAULT) {
58
-                        // Configured to do precisely nothing.
59
-                        continue;
60
-                    }
61
-
62
-                    $result[$page][$action] = $permission;
63
-                }
64
-            }
65
-        }
66
-
67
-        return $result;
68
-    }
69
-
70
-    /**
71
-     * Returns a set of all roles which are available to be set.
72
-     *
73
-     * Hidden roles and implicit roles are excluded.
74
-     */
75
-    public function getAvailableRoles(): array
76
-    {
77
-        // remove the implicit roles
78
-        $possible = array_diff(array_keys($this->roleConfig), array('public', 'loggedIn', 'user'));
79
-
80
-        $actual = array();
81
-
82
-        foreach ($possible as $role) {
83
-            if (!isset($this->roleConfig[$role]['_hidden'])) {
84
-                $actual[$role] = array(
85
-                    'description' => $this->roleConfig[$role]['_description'],
86
-                    'editableBy'  => $this->roleConfig[$role]['_editableBy'],
87
-                    'globalOnly'  => isset($this->roleConfig[$role]['_globalOnly']) && $this->roleConfig[$role]['_globalOnly'],
88
-                );
89
-            }
90
-        }
91
-
92
-        return $actual;
93
-    }
94
-
95
-    /**
96
-     * Returns a boolean for whether the provided role requires identification
97
-     * before being used by a user.
98
-     *
99
-     * @category Security-Critical
100
-     */
101
-    public function roleNeedsIdentification(string $role): bool
102
-    {
103
-        if (in_array($role, $this->identificationExempt)) {
104
-            return false;
105
-        }
106
-
107
-        return true;
108
-    }
109
-
110
-    /**
111
-     * Takes an array of role names, and returns all the relevant roles for that
112
-     * set, including any child roles found recursively.
113
-     *
114
-     * @param array $roles The names of roles to start searching with
115
-     */
116
-    private function getApplicableRoles(array $roles): array
117
-    {
118
-        $available = array();
119
-
120
-        foreach ($roles as $role) {
121
-            if (!isset($this->roleConfig[$role])) {
122
-                // wat
123
-                continue;
124
-            }
125
-
126
-            $available[$role] = $this->roleConfig[$role];
127
-
128
-            if (isset($available[$role]['_childRoles'])) {
129
-                $childRoles = $this->getApplicableRoles($available[$role]['_childRoles']);
130
-                $available = array_merge($available, $childRoles);
131
-
132
-                unset($available[$role]['_childRoles']);
133
-            }
134
-
135
-            foreach (array('_hidden', '_editableBy', '_description') as $item) {
136
-                if (isset($available[$role][$item])) {
137
-                    unset($available[$role][$item]);
138
-                }
139
-            }
140
-        }
141
-
142
-        return $available;
143
-    }
13
+	const ACCESS_ALLOW = 1;
14
+	const ACCESS_DENY = -1;
15
+	const ACCESS_DEFAULT = 0;
16
+	const MAIN = 'main';
17
+	const ALL = '*';
18
+
19
+	protected array $roleConfig;
20
+	protected array $identificationExempt;
21
+
22
+	protected function __construct(array $roleConfig, array $identificationExempt)
23
+	{
24
+		$this->roleConfig = $roleConfig;
25
+		$this->identificationExempt = $identificationExempt;
26
+	}
27
+
28
+	/**
29
+	 * Takes an array of role names and flattens the values to a single
30
+	 * resultant role configuration.
31
+	 *
32
+	 * @param string[] $activeRoles
33
+	 * @category Security-Critical
34
+	 */
35
+	public function getResultantRole(array $activeRoles): array
36
+	{
37
+		$result = array();
38
+
39
+		$roleConfig = $this->getApplicableRoles($activeRoles);
40
+
41
+		// Iterate over every page in every role
42
+		foreach ($roleConfig as $role) {
43
+			foreach ($role as $page => $pageRights) {
44
+				// Create holder in result for this page
45
+				if (!isset($result[$page])) {
46
+					$result[$page] = array();
47
+				}
48
+
49
+				foreach ($pageRights as $action => $permission) {
50
+					// Deny takes precedence, so if it's set, don't change it.
51
+					if (isset($result[$page][$action])) {
52
+						if ($result[$page][$action] === RoleConfigurationBase::ACCESS_DENY) {
53
+							continue;
54
+						}
55
+					}
56
+
57
+					if ($permission === RoleConfigurationBase::ACCESS_DEFAULT) {
58
+						// Configured to do precisely nothing.
59
+						continue;
60
+					}
61
+
62
+					$result[$page][$action] = $permission;
63
+				}
64
+			}
65
+		}
66
+
67
+		return $result;
68
+	}
69
+
70
+	/**
71
+	 * Returns a set of all roles which are available to be set.
72
+	 *
73
+	 * Hidden roles and implicit roles are excluded.
74
+	 */
75
+	public function getAvailableRoles(): array
76
+	{
77
+		// remove the implicit roles
78
+		$possible = array_diff(array_keys($this->roleConfig), array('public', 'loggedIn', 'user'));
79
+
80
+		$actual = array();
81
+
82
+		foreach ($possible as $role) {
83
+			if (!isset($this->roleConfig[$role]['_hidden'])) {
84
+				$actual[$role] = array(
85
+					'description' => $this->roleConfig[$role]['_description'],
86
+					'editableBy'  => $this->roleConfig[$role]['_editableBy'],
87
+					'globalOnly'  => isset($this->roleConfig[$role]['_globalOnly']) && $this->roleConfig[$role]['_globalOnly'],
88
+				);
89
+			}
90
+		}
91
+
92
+		return $actual;
93
+	}
94
+
95
+	/**
96
+	 * Returns a boolean for whether the provided role requires identification
97
+	 * before being used by a user.
98
+	 *
99
+	 * @category Security-Critical
100
+	 */
101
+	public function roleNeedsIdentification(string $role): bool
102
+	{
103
+		if (in_array($role, $this->identificationExempt)) {
104
+			return false;
105
+		}
106
+
107
+		return true;
108
+	}
109
+
110
+	/**
111
+	 * Takes an array of role names, and returns all the relevant roles for that
112
+	 * set, including any child roles found recursively.
113
+	 *
114
+	 * @param array $roles The names of roles to start searching with
115
+	 */
116
+	private function getApplicableRoles(array $roles): array
117
+	{
118
+		$available = array();
119
+
120
+		foreach ($roles as $role) {
121
+			if (!isset($this->roleConfig[$role])) {
122
+				// wat
123
+				continue;
124
+			}
125
+
126
+			$available[$role] = $this->roleConfig[$role];
127
+
128
+			if (isset($available[$role]['_childRoles'])) {
129
+				$childRoles = $this->getApplicableRoles($available[$role]['_childRoles']);
130
+				$available = array_merge($available, $childRoles);
131
+
132
+				unset($available[$role]['_childRoles']);
133
+			}
134
+
135
+			foreach (array('_hidden', '_editableBy', '_description') as $item) {
136
+				if (isset($available[$role][$item])) {
137
+					unset($available[$role][$item]);
138
+				}
139
+			}
140
+		}
141
+
142
+		return $available;
143
+	}
144 144
 }
145 145
\ No newline at end of file
Please login to merge, or discard this patch.
includes/Security/RoleConfiguration.php 1 patch
Indentation   +404 added lines, -404 removed lines patch added patch discarded remove patch
@@ -58,423 +58,423 @@
 block discarded – undo
58 58
 
59 59
 final class RoleConfiguration extends RoleConfigurationBase
60 60
 {
61
-    /**
62
-     * A map of roles to rights
63
-     *
64
-     * For example:
65
-     *
66
-     * array(
67
-     *   'myRole' => array(
68
-     *       PageMyPage::class => array(
69
-     *           'edit' => self::ACCESS_ALLOW,
70
-     *           'create' => self::ACCESS_DENY,
71
-     *       )
72
-     *   )
73
-     * )
74
-     *
75
-     * Note that DENY takes precedence over everything else when roles are combined, followed by ALLOW, followed by
76
-     * DEFAULT. Thus, if you have the following ([A]llow, [D]eny, [-] (default)) grants in different roles, this should
77
-     * be the expected result:
78
-     *
79
-     * - (-,-,-) = - (default because nothing to explicitly say allowed or denied equates to a denial)
80
-     * - (A,-,-) = A
81
-     * - (D,-,-) = D
82
-     * - (A,D,-) = D (deny takes precedence over allow)
83
-     * - (A,A,A) = A (repetition has no effect)
84
-     *
85
-     * The public role is special, and is applied to all users automatically. Avoid using deny on this role.
86
-     *
87
-     * @var array
88
-     * @category Security-Critical
89
-     */
90
-    private static array $productionRoleConfig = array(
91
-        'public'            => array(
92
-            /*
61
+	/**
62
+	 * A map of roles to rights
63
+	 *
64
+	 * For example:
65
+	 *
66
+	 * array(
67
+	 *   'myRole' => array(
68
+	 *       PageMyPage::class => array(
69
+	 *           'edit' => self::ACCESS_ALLOW,
70
+	 *           'create' => self::ACCESS_DENY,
71
+	 *       )
72
+	 *   )
73
+	 * )
74
+	 *
75
+	 * Note that DENY takes precedence over everything else when roles are combined, followed by ALLOW, followed by
76
+	 * DEFAULT. Thus, if you have the following ([A]llow, [D]eny, [-] (default)) grants in different roles, this should
77
+	 * be the expected result:
78
+	 *
79
+	 * - (-,-,-) = - (default because nothing to explicitly say allowed or denied equates to a denial)
80
+	 * - (A,-,-) = A
81
+	 * - (D,-,-) = D
82
+	 * - (A,D,-) = D (deny takes precedence over allow)
83
+	 * - (A,A,A) = A (repetition has no effect)
84
+	 *
85
+	 * The public role is special, and is applied to all users automatically. Avoid using deny on this role.
86
+	 *
87
+	 * @var array
88
+	 * @category Security-Critical
89
+	 */
90
+	private static array $productionRoleConfig = array(
91
+		'public'            => array(
92
+			/*
93 93
              * THIS ROLE IS GRANTED TO ALL LOGGED *OUT* USERS IMPLICITLY.
94 94
              *
95 95
              * USERS IN THIS ROLE DO NOT HAVE TO BE IDENTIFIED TO GET THE RIGHTS CONFERRED HERE.
96 96
              * DO NOT ADD ANY SECURITY-SENSITIVE RIGHTS HERE.
97 97
              */
98
-            '_childRoles'   => array(
99
-                'publicStats',
100
-            ),
101
-            PageTeam::class => array(
102
-                self::MAIN => self::ACCESS_ALLOW,
103
-            ),
104
-            PageXffDemo::class        => array(
105
-                self::MAIN  => self::ACCESS_ALLOW,
106
-            ),
107
-            PagePrivacy::class => array(
108
-                self::MAIN => self::ACCESS_ALLOW,
109
-            )
110
-        ),
111
-        'loggedIn'          => array(
112
-            /*
98
+			'_childRoles'   => array(
99
+				'publicStats',
100
+			),
101
+			PageTeam::class => array(
102
+				self::MAIN => self::ACCESS_ALLOW,
103
+			),
104
+			PageXffDemo::class        => array(
105
+				self::MAIN  => self::ACCESS_ALLOW,
106
+			),
107
+			PagePrivacy::class => array(
108
+				self::MAIN => self::ACCESS_ALLOW,
109
+			)
110
+		),
111
+		'loggedIn'          => array(
112
+			/*
113 113
              * THIS ROLE IS GRANTED TO ALL LOGGED-IN USERS IMPLICITLY.
114 114
              *
115 115
              * USERS IN THIS ROLE DO NOT HAVE TO BE IDENTIFIED TO GET THE RIGHTS CONFERRED HERE.
116 116
              * DO NOT ADD ANY SECURITY-SENSITIVE RIGHTS HERE.
117 117
              */
118
-            '_childRoles'             => array(
119
-                'public',
120
-            ),
121
-            PagePreferences::class    => array(
122
-                self::MAIN => self::ACCESS_ALLOW,
123
-                'refreshOAuth' => self::ACCESS_ALLOW,
124
-            ),
125
-            PageChangePassword::class => array(
126
-                self::MAIN => self::ACCESS_ALLOW,
127
-            ),
128
-            PageMultiFactor::class    => array(
129
-                self::MAIN          => self::ACCESS_ALLOW,
130
-                'scratch'           => self::ACCESS_ALLOW,
131
-                'enableYubikeyOtp'  => self::ACCESS_ALLOW,
132
-                'enableTotp'        => self::ACCESS_ALLOW,
133
-                // allow a user to disable this even when they're not allowed to enable it
134
-                'disableYubikeyOtp' => self::ACCESS_ALLOW,
135
-                'disableTotp'       => self::ACCESS_ALLOW,
136
-            ),
137
-            PageOAuth::class          => array(
138
-                'attach' => self::ACCESS_ALLOW,
139
-                'detach' => self::ACCESS_ALLOW,
140
-            ),
141
-            PageDomainSwitch::class   => array(
142
-                self::MAIN => self::ACCESS_ALLOW
143
-            ),
144
-            PageUserReactivate::class => array(
145
-                self::MAIN => self::ACCESS_ALLOW,
146
-            ),
147
-            'UserData'                => array(
148
-                'accountLogSelf' => self::ACCESS_ALLOW,
149
-            ),
150
-        ),
151
-        'user'              => array(
152
-            /*
118
+			'_childRoles'             => array(
119
+				'public',
120
+			),
121
+			PagePreferences::class    => array(
122
+				self::MAIN => self::ACCESS_ALLOW,
123
+				'refreshOAuth' => self::ACCESS_ALLOW,
124
+			),
125
+			PageChangePassword::class => array(
126
+				self::MAIN => self::ACCESS_ALLOW,
127
+			),
128
+			PageMultiFactor::class    => array(
129
+				self::MAIN          => self::ACCESS_ALLOW,
130
+				'scratch'           => self::ACCESS_ALLOW,
131
+				'enableYubikeyOtp'  => self::ACCESS_ALLOW,
132
+				'enableTotp'        => self::ACCESS_ALLOW,
133
+				// allow a user to disable this even when they're not allowed to enable it
134
+				'disableYubikeyOtp' => self::ACCESS_ALLOW,
135
+				'disableTotp'       => self::ACCESS_ALLOW,
136
+			),
137
+			PageOAuth::class          => array(
138
+				'attach' => self::ACCESS_ALLOW,
139
+				'detach' => self::ACCESS_ALLOW,
140
+			),
141
+			PageDomainSwitch::class   => array(
142
+				self::MAIN => self::ACCESS_ALLOW
143
+			),
144
+			PageUserReactivate::class => array(
145
+				self::MAIN => self::ACCESS_ALLOW,
146
+			),
147
+			'UserData'                => array(
148
+				'accountLogSelf' => self::ACCESS_ALLOW,
149
+			),
150
+		),
151
+		'user'              => array(
152
+			/*
153 153
              * THIS ROLE IS GRANTED TO APPROVED AND IDENTIFIED LOGGED-IN USERS IMPLICITLY.
154 154
              */
155
-            '_childRoles'                        => array(
156
-                'internalStats',
157
-            ),
158
-            PageUserReactivate::class => array(
159
-                // only non-approved users should be able to access this
160
-                self::MAIN => self::ACCESS_DENY,
161
-            ),
162
-            PageMain::class                      => array(
163
-                self::MAIN => self::ACCESS_ALLOW,
164
-            ),
165
-            PageBan::class                       => array(
166
-                self::MAIN => self::ACCESS_ALLOW,
167
-                'show'     => self::ACCESS_ALLOW,
168
-            ),
169
-            'BanVisibility'             => array(
170
-                'user' => self::ACCESS_ALLOW,
171
-            ),
172
-            'BanType'                   => array(
173
-                'ip' => self::ACCESS_ALLOW,
174
-                'name' => self::ACCESS_ALLOW,
175
-            ),
176
-            PageEditComment::class               => array(
177
-                self::MAIN => self::ACCESS_ALLOW,
178
-            ),
179
-            PageEmailManagement::class           => array(
180
-                self::MAIN => self::ACCESS_ALLOW,
181
-                'view'     => self::ACCESS_ALLOW,
182
-            ),
183
-            PageExpandedRequestList::class       => array(
184
-                self::MAIN => self::ACCESS_ALLOW,
185
-            ),
186
-            PageLog::class                       => array(
187
-                self::MAIN => self::ACCESS_ALLOW,
188
-            ),
189
-            PageSearch::class                    => array(
190
-                self::MAIN => self::ACCESS_ALLOW,
191
-                'byName'   => self::ACCESS_ALLOW,
192
-                'byEmail'  => self::ACCESS_ALLOW,
193
-                'byIp'     => self::ACCESS_ALLOW,
194
-                'allowNonConfirmed' => self::ACCESS_ALLOW,
195
-            ),
196
-            PageWelcomeTemplateManagement::class => array(
197
-                self::MAIN => self::ACCESS_ALLOW,
198
-                'select'   => self::ACCESS_ALLOW,
199
-                'view'     => self::ACCESS_ALLOW,
200
-            ),
201
-            PageViewRequest::class               => array(
202
-                self::MAIN       => self::ACCESS_ALLOW,
203
-                'seeAllRequests' => self::ACCESS_ALLOW,
204
-            ),
205
-            'RequestData'                        => array(
206
-                'seePrivateDataWhenReserved' => self::ACCESS_ALLOW,
207
-                'seePrivateDataWithHash'     => self::ACCESS_ALLOW,
208
-                'seeRelatedRequests'         => self::ACCESS_ALLOW,
209
-            ),
210
-            PageCustomClose::class               => array(
211
-                self::MAIN => self::ACCESS_ALLOW,
212
-            ),
213
-            PageComment::class                   => array(
214
-                self::MAIN => self::ACCESS_ALLOW,
215
-            ),
216
-            PageFlagComment::class               => array(
217
-                self::MAIN => self::ACCESS_ALLOW,
218
-            ),
219
-            PageCloseRequest::class              => array(
220
-                self::MAIN => self::ACCESS_ALLOW,
221
-            ),
222
-            PageCreateRequest::class             => array(
223
-                self::MAIN => self::ACCESS_ALLOW,
224
-            ),
225
-            PageDeferRequest::class              => array(
226
-                self::MAIN => self::ACCESS_ALLOW,
227
-            ),
228
-            PageDropRequest::class               => array(
229
-                self::MAIN => self::ACCESS_ALLOW,
230
-            ),
231
-            PageReservation::class               => array(
232
-                self::MAIN => self::ACCESS_ALLOW,
233
-            ),
234
-            PageSendToUser::class                => array(
235
-                self::MAIN => self::ACCESS_ALLOW,
236
-            ),
237
-            PageBreakReservation::class          => array(
238
-                self::MAIN => self::ACCESS_ALLOW,
239
-            ),
240
-            PageJobQueue::class                  => array(
241
-                self::MAIN    => self::ACCESS_ALLOW,
242
-                'view'        => self::ACCESS_ALLOW,
243
-                'all'         => self::ACCESS_ALLOW,
244
-                'acknowledge' => self::ACCESS_ALLOW,
245
-                'cancel'      => self::ACCESS_ALLOW
246
-            ),
247
-            PageDomainManagement::class          => array(
248
-                self::MAIN => self::ACCESS_ALLOW,
249
-            ),
250
-            PageRequestFormManagement::class     => array(
251
-                self::MAIN => self::ACCESS_ALLOW,
252
-                'view'     => self::ACCESS_ALLOW,
253
-                'preview'  => self::ACCESS_ALLOW,
254
-            ),
255
-            'RequestCreation'                    => array(
256
-                PreferenceManager::CREATION_MANUAL => self::ACCESS_ALLOW,
257
-                PreferenceManager::CREATION_OAUTH  => self::ACCESS_ALLOW,
258
-            ),
259
-            'GlobalInfo'                         => array(
260
-                'viewSiteNotice' => self::ACCESS_ALLOW,
261
-                'viewOnlineUsers' => self::ACCESS_ALLOW,
262
-            ),
263
-        ),
264
-        'admin'             => array(
265
-            '_description'                       => 'A tool administrator.',
266
-            '_editableBy'                        => array('admin', 'toolRoot'),
267
-            '_childRoles'                        => array(
268
-                'user',
269
-                'requestAdminTools',
270
-            ),
271
-            PageEmailManagement::class           => array(
272
-                'edit'   => self::ACCESS_ALLOW,
273
-                'create' => self::ACCESS_ALLOW,
274
-            ),
275
-            PageSiteNotice::class                => array(
276
-                self::MAIN => self::ACCESS_ALLOW,
277
-            ),
278
-            PageUserManagement::class            => array(
279
-                self::MAIN   => self::ACCESS_ALLOW,
280
-                'approve'    => self::ACCESS_ALLOW,
281
-                'deactivate' => self::ACCESS_ALLOW,
282
-                'rename'     => self::ACCESS_ALLOW,
283
-                'editUser'   => self::ACCESS_ALLOW,
284
-                'editRoles'  => self::ACCESS_ALLOW,
285
-            ),
286
-            PageSearch::class                    => array(
287
-                'byComment' => self::ACCESS_ALLOW,
288
-            ),
289
-            PageManuallyConfirm::class               => array(
290
-                self::MAIN => self::ACCESS_ALLOW,
291
-            ),
292
-            PageWelcomeTemplateManagement::class => array(
293
-                'edit'   => self::ACCESS_ALLOW,
294
-                'delete' => self::ACCESS_ALLOW,
295
-                'add'    => self::ACCESS_ALLOW,
296
-            ),
297
-            PageJobQueue::class                  => array(
298
-                'acknowledge' => self::ACCESS_ALLOW,
299
-                'requeue'     => self::ACCESS_ALLOW,
300
-                'cancel'      => self::ACCESS_ALLOW,
301
-            ),
302
-            'RequestData'               => array(
303
-                'reopenClearedRequest'  => self::ACCESS_ALLOW,
304
-            ),
305
-            PageQueueManagement::class           => array(
306
-                self::MAIN => self::ACCESS_ALLOW,
307
-                'edit'     => self::ACCESS_ALLOW,
308
-                'create'   => self::ACCESS_ALLOW,
309
-            ),
310
-            PageRequestFormManagement::class     => array(
311
-                'edit'     => self::ACCESS_ALLOW,
312
-                'create'   => self::ACCESS_ALLOW,
313
-            ),
314
-            PageDomainManagement::class          => array(
315
-                'edit'     => self::ACCESS_ALLOW,
316
-            ),
317
-            'UserData'                           => array(
318
-                'accountLog' => self::ACCESS_ALLOW,
319
-            ),
320
-        ),
321
-        'checkuser'         => array(
322
-            '_description'            => 'A user with CheckUser access',
323
-            '_editableBy'             => array('checkuser', 'steward', 'toolRoot'),
324
-            '_childRoles'             => array(
325
-                'user',
326
-                'requestAdminTools',
327
-            ),
328
-            PageUserManagement::class => array(
329
-                self::MAIN   => self::ACCESS_ALLOW,
330
-                'deactivate' => self::ACCESS_ALLOW,
331
-                'editRoles'  => self::ACCESS_ALLOW,
332
-            ),
333
-            'RequestData'             => array(
334
-                'seeUserAgentData'      => self::ACCESS_ALLOW,
335
-                'seeCheckuserComments'  => self::ACCESS_ALLOW,
336
-                'createLocalAccount'    => self::ACCESS_ALLOW,
337
-            ),
338
-            'BanType'                   => array(
339
-                'useragent' => self::ACCESS_ALLOW,
340
-            ),
341
-            'BanVisibility'             => array(
342
-                'checkuser' => self::ACCESS_ALLOW,
343
-            ),
344
-            'UserData'                           => array(
345
-                'accountLog' => self::ACCESS_ALLOW,
346
-            ),
347
-        ),
348
-        'steward'         => array(
349
-            '_description'  => 'A user with Steward access',
350
-            '_editableBy'   => array('steward', 'toolRoot'),
351
-            '_globalOnly'   => true,
352
-            '_childRoles'   => array(
353
-                'user',
354
-                'checkuser',
355
-            ),
356
-            'BanType'                   => array(
357
-                'ip-largerange' => self::ACCESS_ALLOW,
358
-                'global'        => self::ACCESS_ALLOW,
359
-            ),
360
-        ),
361
-        'toolRoot'          => array(
362
-            '_description' => 'A user with shell access to the servers running the tool',
363
-            '_editableBy'  => array('toolRoot'),
364
-            '_globalOnly'  => true,
365
-            '_childRoles'  => array(
366
-                'admin',
367
-            ),
368
-            'BanType'                   => array(
369
-                'ip-largerange' => self::ACCESS_ALLOW,
370
-                'global'        => self::ACCESS_ALLOW,
371
-            ),
372
-            PageDomainManagement::class => array(
373
-                self::MAIN => self::ACCESS_ALLOW,
374
-                'editAll'  => self::ACCESS_ALLOW,
375
-                'edit'     => self::ACCESS_ALLOW,
376
-                'create'   => self::ACCESS_ALLOW,
377
-            ),
378
-            PageErrorLogViewer::class => array(
379
-                self::MAIN      => self::ACCESS_ALLOW,
380
-                'view'          => self::ACCESS_ALLOW,
381
-                'remove'        => self::ACCESS_ALLOW,
382
-            ),
383
-        ),
384
-        'botCreation'       => array(
385
-            '_hidden'         => true,
386
-            '_description'    => 'A user allowed to use the bot to perform account creations',
387
-            '_editableBy'     => array('admin', 'toolRoot'),
388
-            '_childRoles'     => array(),
389
-            'RequestCreation' => array(
390
-                PreferenceManager::CREATION_BOT => self::ACCESS_ALLOW,
391
-            ),
392
-        ),
155
+			'_childRoles'                        => array(
156
+				'internalStats',
157
+			),
158
+			PageUserReactivate::class => array(
159
+				// only non-approved users should be able to access this
160
+				self::MAIN => self::ACCESS_DENY,
161
+			),
162
+			PageMain::class                      => array(
163
+				self::MAIN => self::ACCESS_ALLOW,
164
+			),
165
+			PageBan::class                       => array(
166
+				self::MAIN => self::ACCESS_ALLOW,
167
+				'show'     => self::ACCESS_ALLOW,
168
+			),
169
+			'BanVisibility'             => array(
170
+				'user' => self::ACCESS_ALLOW,
171
+			),
172
+			'BanType'                   => array(
173
+				'ip' => self::ACCESS_ALLOW,
174
+				'name' => self::ACCESS_ALLOW,
175
+			),
176
+			PageEditComment::class               => array(
177
+				self::MAIN => self::ACCESS_ALLOW,
178
+			),
179
+			PageEmailManagement::class           => array(
180
+				self::MAIN => self::ACCESS_ALLOW,
181
+				'view'     => self::ACCESS_ALLOW,
182
+			),
183
+			PageExpandedRequestList::class       => array(
184
+				self::MAIN => self::ACCESS_ALLOW,
185
+			),
186
+			PageLog::class                       => array(
187
+				self::MAIN => self::ACCESS_ALLOW,
188
+			),
189
+			PageSearch::class                    => array(
190
+				self::MAIN => self::ACCESS_ALLOW,
191
+				'byName'   => self::ACCESS_ALLOW,
192
+				'byEmail'  => self::ACCESS_ALLOW,
193
+				'byIp'     => self::ACCESS_ALLOW,
194
+				'allowNonConfirmed' => self::ACCESS_ALLOW,
195
+			),
196
+			PageWelcomeTemplateManagement::class => array(
197
+				self::MAIN => self::ACCESS_ALLOW,
198
+				'select'   => self::ACCESS_ALLOW,
199
+				'view'     => self::ACCESS_ALLOW,
200
+			),
201
+			PageViewRequest::class               => array(
202
+				self::MAIN       => self::ACCESS_ALLOW,
203
+				'seeAllRequests' => self::ACCESS_ALLOW,
204
+			),
205
+			'RequestData'                        => array(
206
+				'seePrivateDataWhenReserved' => self::ACCESS_ALLOW,
207
+				'seePrivateDataWithHash'     => self::ACCESS_ALLOW,
208
+				'seeRelatedRequests'         => self::ACCESS_ALLOW,
209
+			),
210
+			PageCustomClose::class               => array(
211
+				self::MAIN => self::ACCESS_ALLOW,
212
+			),
213
+			PageComment::class                   => array(
214
+				self::MAIN => self::ACCESS_ALLOW,
215
+			),
216
+			PageFlagComment::class               => array(
217
+				self::MAIN => self::ACCESS_ALLOW,
218
+			),
219
+			PageCloseRequest::class              => array(
220
+				self::MAIN => self::ACCESS_ALLOW,
221
+			),
222
+			PageCreateRequest::class             => array(
223
+				self::MAIN => self::ACCESS_ALLOW,
224
+			),
225
+			PageDeferRequest::class              => array(
226
+				self::MAIN => self::ACCESS_ALLOW,
227
+			),
228
+			PageDropRequest::class               => array(
229
+				self::MAIN => self::ACCESS_ALLOW,
230
+			),
231
+			PageReservation::class               => array(
232
+				self::MAIN => self::ACCESS_ALLOW,
233
+			),
234
+			PageSendToUser::class                => array(
235
+				self::MAIN => self::ACCESS_ALLOW,
236
+			),
237
+			PageBreakReservation::class          => array(
238
+				self::MAIN => self::ACCESS_ALLOW,
239
+			),
240
+			PageJobQueue::class                  => array(
241
+				self::MAIN    => self::ACCESS_ALLOW,
242
+				'view'        => self::ACCESS_ALLOW,
243
+				'all'         => self::ACCESS_ALLOW,
244
+				'acknowledge' => self::ACCESS_ALLOW,
245
+				'cancel'      => self::ACCESS_ALLOW
246
+			),
247
+			PageDomainManagement::class          => array(
248
+				self::MAIN => self::ACCESS_ALLOW,
249
+			),
250
+			PageRequestFormManagement::class     => array(
251
+				self::MAIN => self::ACCESS_ALLOW,
252
+				'view'     => self::ACCESS_ALLOW,
253
+				'preview'  => self::ACCESS_ALLOW,
254
+			),
255
+			'RequestCreation'                    => array(
256
+				PreferenceManager::CREATION_MANUAL => self::ACCESS_ALLOW,
257
+				PreferenceManager::CREATION_OAUTH  => self::ACCESS_ALLOW,
258
+			),
259
+			'GlobalInfo'                         => array(
260
+				'viewSiteNotice' => self::ACCESS_ALLOW,
261
+				'viewOnlineUsers' => self::ACCESS_ALLOW,
262
+			),
263
+		),
264
+		'admin'             => array(
265
+			'_description'                       => 'A tool administrator.',
266
+			'_editableBy'                        => array('admin', 'toolRoot'),
267
+			'_childRoles'                        => array(
268
+				'user',
269
+				'requestAdminTools',
270
+			),
271
+			PageEmailManagement::class           => array(
272
+				'edit'   => self::ACCESS_ALLOW,
273
+				'create' => self::ACCESS_ALLOW,
274
+			),
275
+			PageSiteNotice::class                => array(
276
+				self::MAIN => self::ACCESS_ALLOW,
277
+			),
278
+			PageUserManagement::class            => array(
279
+				self::MAIN   => self::ACCESS_ALLOW,
280
+				'approve'    => self::ACCESS_ALLOW,
281
+				'deactivate' => self::ACCESS_ALLOW,
282
+				'rename'     => self::ACCESS_ALLOW,
283
+				'editUser'   => self::ACCESS_ALLOW,
284
+				'editRoles'  => self::ACCESS_ALLOW,
285
+			),
286
+			PageSearch::class                    => array(
287
+				'byComment' => self::ACCESS_ALLOW,
288
+			),
289
+			PageManuallyConfirm::class               => array(
290
+				self::MAIN => self::ACCESS_ALLOW,
291
+			),
292
+			PageWelcomeTemplateManagement::class => array(
293
+				'edit'   => self::ACCESS_ALLOW,
294
+				'delete' => self::ACCESS_ALLOW,
295
+				'add'    => self::ACCESS_ALLOW,
296
+			),
297
+			PageJobQueue::class                  => array(
298
+				'acknowledge' => self::ACCESS_ALLOW,
299
+				'requeue'     => self::ACCESS_ALLOW,
300
+				'cancel'      => self::ACCESS_ALLOW,
301
+			),
302
+			'RequestData'               => array(
303
+				'reopenClearedRequest'  => self::ACCESS_ALLOW,
304
+			),
305
+			PageQueueManagement::class           => array(
306
+				self::MAIN => self::ACCESS_ALLOW,
307
+				'edit'     => self::ACCESS_ALLOW,
308
+				'create'   => self::ACCESS_ALLOW,
309
+			),
310
+			PageRequestFormManagement::class     => array(
311
+				'edit'     => self::ACCESS_ALLOW,
312
+				'create'   => self::ACCESS_ALLOW,
313
+			),
314
+			PageDomainManagement::class          => array(
315
+				'edit'     => self::ACCESS_ALLOW,
316
+			),
317
+			'UserData'                           => array(
318
+				'accountLog' => self::ACCESS_ALLOW,
319
+			),
320
+		),
321
+		'checkuser'         => array(
322
+			'_description'            => 'A user with CheckUser access',
323
+			'_editableBy'             => array('checkuser', 'steward', 'toolRoot'),
324
+			'_childRoles'             => array(
325
+				'user',
326
+				'requestAdminTools',
327
+			),
328
+			PageUserManagement::class => array(
329
+				self::MAIN   => self::ACCESS_ALLOW,
330
+				'deactivate' => self::ACCESS_ALLOW,
331
+				'editRoles'  => self::ACCESS_ALLOW,
332
+			),
333
+			'RequestData'             => array(
334
+				'seeUserAgentData'      => self::ACCESS_ALLOW,
335
+				'seeCheckuserComments'  => self::ACCESS_ALLOW,
336
+				'createLocalAccount'    => self::ACCESS_ALLOW,
337
+			),
338
+			'BanType'                   => array(
339
+				'useragent' => self::ACCESS_ALLOW,
340
+			),
341
+			'BanVisibility'             => array(
342
+				'checkuser' => self::ACCESS_ALLOW,
343
+			),
344
+			'UserData'                           => array(
345
+				'accountLog' => self::ACCESS_ALLOW,
346
+			),
347
+		),
348
+		'steward'         => array(
349
+			'_description'  => 'A user with Steward access',
350
+			'_editableBy'   => array('steward', 'toolRoot'),
351
+			'_globalOnly'   => true,
352
+			'_childRoles'   => array(
353
+				'user',
354
+				'checkuser',
355
+			),
356
+			'BanType'                   => array(
357
+				'ip-largerange' => self::ACCESS_ALLOW,
358
+				'global'        => self::ACCESS_ALLOW,
359
+			),
360
+		),
361
+		'toolRoot'          => array(
362
+			'_description' => 'A user with shell access to the servers running the tool',
363
+			'_editableBy'  => array('toolRoot'),
364
+			'_globalOnly'  => true,
365
+			'_childRoles'  => array(
366
+				'admin',
367
+			),
368
+			'BanType'                   => array(
369
+				'ip-largerange' => self::ACCESS_ALLOW,
370
+				'global'        => self::ACCESS_ALLOW,
371
+			),
372
+			PageDomainManagement::class => array(
373
+				self::MAIN => self::ACCESS_ALLOW,
374
+				'editAll'  => self::ACCESS_ALLOW,
375
+				'edit'     => self::ACCESS_ALLOW,
376
+				'create'   => self::ACCESS_ALLOW,
377
+			),
378
+			PageErrorLogViewer::class => array(
379
+				self::MAIN      => self::ACCESS_ALLOW,
380
+				'view'          => self::ACCESS_ALLOW,
381
+				'remove'        => self::ACCESS_ALLOW,
382
+			),
383
+		),
384
+		'botCreation'       => array(
385
+			'_hidden'         => true,
386
+			'_description'    => 'A user allowed to use the bot to perform account creations',
387
+			'_editableBy'     => array('admin', 'toolRoot'),
388
+			'_childRoles'     => array(),
389
+			'RequestCreation' => array(
390
+				PreferenceManager::CREATION_BOT => self::ACCESS_ALLOW,
391
+			),
392
+		),
393 393
 
394
-        // Child roles go below this point
395
-        'publicStats'       => array(
396
-            '_hidden'               => true,
397
-            StatsUsers::class       => array(
398
-                self::MAIN => self::ACCESS_ALLOW,
399
-                'detail'   => self::ACCESS_ALLOW,
400
-            ),
401
-            StatsTopCreators::class => array(
402
-                self::MAIN => self::ACCESS_ALLOW,
403
-            ),
404
-            StatsMonthlyStats::class     => array(
405
-                self::MAIN => self::ACCESS_ALLOW,
406
-            ),
407
-        ),
408
-        'internalStats'     => array(
409
-            '_hidden'                    => true,
410
-            StatsMain::class             => array(
411
-                self::MAIN => self::ACCESS_ALLOW,
412
-            ),
413
-            StatsFastCloses::class       => array(
414
-                self::MAIN => self::ACCESS_ALLOW,
415
-            ),
416
-            StatsInactiveUsers::class    => array(
417
-                self::MAIN => self::ACCESS_ALLOW,
418
-            ),
419
-            StatsReservedRequests::class => array(
420
-                self::MAIN => self::ACCESS_ALLOW,
421
-            ),
422
-            StatsTemplateStats::class    => array(
423
-                self::MAIN => self::ACCESS_ALLOW,
424
-            ),
425
-        ),
426
-        'requestAdminTools' => array(
427
-            '_hidden'                   => true,
428
-            PageBan::class              => array(
429
-                self::MAIN => self::ACCESS_ALLOW,
430
-                'set'      => self::ACCESS_ALLOW,
431
-                'remove'   => self::ACCESS_ALLOW,
432
-                'replace'  => self::ACCESS_ALLOW,
433
-            ),
434
-            'BanType'                   => array(
435
-                'ip' => self::ACCESS_ALLOW,
436
-                'email' => self::ACCESS_ALLOW,
437
-                'name' => self::ACCESS_ALLOW,
438
-            ),
439
-            'BanVisibility'             => array(
440
-                'user' => self::ACCESS_ALLOW,
441
-                'admin' => self::ACCESS_ALLOW,
442
-            ),
443
-            PageEditComment::class      => array(
444
-                'editOthers' => self::ACCESS_ALLOW,
445
-            ),
446
-            PageBreakReservation::class => array(
447
-                'force' => self::ACCESS_ALLOW,
448
-            ),
449
-            PageCustomClose::class      => array(
450
-                'skipCcMailingList' => self::ACCESS_ALLOW,
451
-            ),
452
-            PageFlagComment::class      => array(
453
-                'unflag'   => self::ACCESS_ALLOW,
454
-            ),
455
-            PageListFlaggedComments::class => array(
456
-                self::MAIN => self::ACCESS_ALLOW,
457
-            ),
458
-            'RequestData'               => array(
459
-                'reopenOldRequest'      => self::ACCESS_ALLOW,
460
-                'alwaysSeePrivateData'  => self::ACCESS_ALLOW,
461
-                'alwaysSeeHash'         => self::ACCESS_ALLOW,
462
-                'seeRestrictedComments' => self::ACCESS_ALLOW,
463
-            ),
464
-        ),
465
-    );
394
+		// Child roles go below this point
395
+		'publicStats'       => array(
396
+			'_hidden'               => true,
397
+			StatsUsers::class       => array(
398
+				self::MAIN => self::ACCESS_ALLOW,
399
+				'detail'   => self::ACCESS_ALLOW,
400
+			),
401
+			StatsTopCreators::class => array(
402
+				self::MAIN => self::ACCESS_ALLOW,
403
+			),
404
+			StatsMonthlyStats::class     => array(
405
+				self::MAIN => self::ACCESS_ALLOW,
406
+			),
407
+		),
408
+		'internalStats'     => array(
409
+			'_hidden'                    => true,
410
+			StatsMain::class             => array(
411
+				self::MAIN => self::ACCESS_ALLOW,
412
+			),
413
+			StatsFastCloses::class       => array(
414
+				self::MAIN => self::ACCESS_ALLOW,
415
+			),
416
+			StatsInactiveUsers::class    => array(
417
+				self::MAIN => self::ACCESS_ALLOW,
418
+			),
419
+			StatsReservedRequests::class => array(
420
+				self::MAIN => self::ACCESS_ALLOW,
421
+			),
422
+			StatsTemplateStats::class    => array(
423
+				self::MAIN => self::ACCESS_ALLOW,
424
+			),
425
+		),
426
+		'requestAdminTools' => array(
427
+			'_hidden'                   => true,
428
+			PageBan::class              => array(
429
+				self::MAIN => self::ACCESS_ALLOW,
430
+				'set'      => self::ACCESS_ALLOW,
431
+				'remove'   => self::ACCESS_ALLOW,
432
+				'replace'  => self::ACCESS_ALLOW,
433
+			),
434
+			'BanType'                   => array(
435
+				'ip' => self::ACCESS_ALLOW,
436
+				'email' => self::ACCESS_ALLOW,
437
+				'name' => self::ACCESS_ALLOW,
438
+			),
439
+			'BanVisibility'             => array(
440
+				'user' => self::ACCESS_ALLOW,
441
+				'admin' => self::ACCESS_ALLOW,
442
+			),
443
+			PageEditComment::class      => array(
444
+				'editOthers' => self::ACCESS_ALLOW,
445
+			),
446
+			PageBreakReservation::class => array(
447
+				'force' => self::ACCESS_ALLOW,
448
+			),
449
+			PageCustomClose::class      => array(
450
+				'skipCcMailingList' => self::ACCESS_ALLOW,
451
+			),
452
+			PageFlagComment::class      => array(
453
+				'unflag'   => self::ACCESS_ALLOW,
454
+			),
455
+			PageListFlaggedComments::class => array(
456
+				self::MAIN => self::ACCESS_ALLOW,
457
+			),
458
+			'RequestData'               => array(
459
+				'reopenOldRequest'      => self::ACCESS_ALLOW,
460
+				'alwaysSeePrivateData'  => self::ACCESS_ALLOW,
461
+				'alwaysSeeHash'         => self::ACCESS_ALLOW,
462
+				'seeRestrictedComments' => self::ACCESS_ALLOW,
463
+			),
464
+		),
465
+	);
466 466
 
467
-    /** @var array
468
-     * List of roles which are *exempt* from the identification requirements
469
-     *
470
-     * Think twice about adding roles to this list.
471
-     *
472
-     * @category Security-Critical
473
-     */
474
-    private static array $productionIdentificationExempt = array('public', 'loggedIn');
467
+	/** @var array
468
+	 * List of roles which are *exempt* from the identification requirements
469
+	 *
470
+	 * Think twice about adding roles to this list.
471
+	 *
472
+	 * @category Security-Critical
473
+	 */
474
+	private static array $productionIdentificationExempt = array('public', 'loggedIn');
475 475
 
476
-    public function __construct()
477
-    {
478
-        parent::__construct(self::$productionRoleConfig, self::$productionIdentificationExempt);
479
-    }
476
+	public function __construct()
477
+	{
478
+		parent::__construct(self::$productionRoleConfig, self::$productionIdentificationExempt);
479
+	}
480 480
 }
Please login to merge, or discard this patch.
includes/Security/DomainAccessManager.php 1 patch
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -18,69 +18,69 @@
 block discarded – undo
18 18
 
19 19
 class DomainAccessManager implements IDomainAccessManager
20 20
 {
21
-    private IUserAccessLoader $userAccessLoader;
21
+	private IUserAccessLoader $userAccessLoader;
22 22
 
23
-    public function __construct(IUserAccessLoader $userAccessLoader)
24
-    {
25
-        $this->userAccessLoader = $userAccessLoader;
26
-    }
23
+	public function __construct(IUserAccessLoader $userAccessLoader)
24
+	{
25
+		$this->userAccessLoader = $userAccessLoader;
26
+	}
27 27
 
28
-    /**
29
-     * Returns the domains the user is a member of.
30
-     *
31
-     * Note - this *does not* determine the access rights that a user has in any
32
-     * specific domain. Permissions checks still need to be performed.
33
-     *
34
-     * @param User $user
35
-     *
36
-     * @return Domain[]
37
-     */
38
-    public function getAllowedDomains(User $user): array
39
-    {
40
-        if ($user->isCommunityUser()) {
41
-            return [];
42
-        }
28
+	/**
29
+	 * Returns the domains the user is a member of.
30
+	 *
31
+	 * Note - this *does not* determine the access rights that a user has in any
32
+	 * specific domain. Permissions checks still need to be performed.
33
+	 *
34
+	 * @param User $user
35
+	 *
36
+	 * @return Domain[]
37
+	 */
38
+	public function getAllowedDomains(User $user): array
39
+	{
40
+		if ($user->isCommunityUser()) {
41
+			return [];
42
+		}
43 43
 
44
-        return $this->userAccessLoader->loadDomainsForUser($user);
45
-    }
44
+		return $this->userAccessLoader->loadDomainsForUser($user);
45
+	}
46 46
 
47
-    public function switchDomain(User $user, Domain $newDomain): void
48
-    {
49
-        $mapToId = function(DataObject $object) {
50
-            return $object->getId();
51
-        };
47
+	public function switchDomain(User $user, Domain $newDomain): void
48
+	{
49
+		$mapToId = function(DataObject $object) {
50
+			return $object->getId();
51
+		};
52 52
 
53
-        $allowed = in_array($newDomain->getId(), array_map($mapToId, $this->getAllowedDomains($user)));
53
+		$allowed = in_array($newDomain->getId(), array_map($mapToId, $this->getAllowedDomains($user)));
54 54
 
55
-        if ($allowed) {
56
-            WebRequest::setActiveDomain($newDomain);
57
-        }
58
-        else {
59
-            throw new DomainSwitchNotAllowedException();
60
-        }
61
-    }
55
+		if ($allowed) {
56
+			WebRequest::setActiveDomain($newDomain);
57
+		}
58
+		else {
59
+			throw new DomainSwitchNotAllowedException();
60
+		}
61
+	}
62 62
 
63
-    public function switchToDefaultDomain(User $user): void
64
-    {
65
-        $domains = $this->getAllowedDomains($user);
66
-        $preferenceManager = new PreferenceManager($user->getDatabase(), $user->getId(), null);
67
-        $defaultDomainPreference = $preferenceManager->getPreference(PreferenceManager::PREF_DEFAULT_DOMAIN);
63
+	public function switchToDefaultDomain(User $user): void
64
+	{
65
+		$domains = $this->getAllowedDomains($user);
66
+		$preferenceManager = new PreferenceManager($user->getDatabase(), $user->getId(), null);
67
+		$defaultDomainPreference = $preferenceManager->getPreference(PreferenceManager::PREF_DEFAULT_DOMAIN);
68 68
 
69
-        $chosenDomain = null;
70
-        foreach ($domains as $d) {
71
-            if ($d->getId() == $defaultDomainPreference) {
72
-                $chosenDomain = $d;
73
-                break;
74
-            }
75
-        }
69
+		$chosenDomain = null;
70
+		foreach ($domains as $d) {
71
+			if ($d->getId() == $defaultDomainPreference) {
72
+				$chosenDomain = $d;
73
+				break;
74
+			}
75
+		}
76 76
 
77
-        if ($chosenDomain !== null) {
78
-            WebRequest::setActiveDomain($chosenDomain);
79
-            return;
80
-        }
77
+		if ($chosenDomain !== null) {
78
+			WebRequest::setActiveDomain($chosenDomain);
79
+			return;
80
+		}
81 81
 
82
-        if (count($domains) > 0) {
83
-            WebRequest::setActiveDomain($domains[0]);
84
-        }
85
-    }
82
+		if (count($domains) > 0) {
83
+			WebRequest::setActiveDomain($domains[0]);
84
+		}
85
+	}
86 86
 }
87 87
\ No newline at end of file
Please login to merge, or discard this patch.
includes/DataObjects/User.php 1 patch
Indentation   +399 added lines, -399 removed lines patch added patch discarded remove patch
@@ -22,153 +22,153 @@  discard block
 block discarded – undo
22 22
  */
23 23
 class User extends DataObject
24 24
 {
25
-    const STATUS_ACTIVE = 'Active';
26
-    const STATUS_DEACTIVATED = 'Deactivated';
27
-    const STATUS_NEW = 'New';
28
-
29
-    private static CommunityUser $community;
30
-
31
-    private $username;
32
-    private $email;
33
-    private $status = self::STATUS_NEW;
34
-    private $onwikiname;
35
-    private $lastactive = "0000-00-00 00:00:00";
36
-    private $forcelogout = 0;
37
-    private $forceidentified = null;
38
-    private $confirmationdiff = 0;
39
-    /** @var User Cache variable of the current user - it's never going to change in the middle of a request. */
40
-    private static $currentUser;
41
-    #region Object load methods
42
-
43
-    /**
44
-     * Gets the currently logged in user
45
-     *
46
-     * @param PdoDatabase $database
47
-     *
48
-     * @return User|CommunityUser
49
-     */
50
-    public static function getCurrent(PdoDatabase $database)
51
-    {
52
-        if (self::$currentUser === null) {
53
-            $sessionId = WebRequest::getSessionUserId();
54
-
55
-            if ($sessionId !== null) {
56
-                /** @var User $user */
57
-                $user = self::getById($sessionId, $database);
58
-
59
-                if ($user === false) {
60
-                    self::$currentUser = new CommunityUser();
61
-                }
62
-                else {
63
-                    self::$currentUser = $user;
64
-                }
65
-            }
66
-            else {
67
-                $anonymousCoward = new CommunityUser();
68
-
69
-                self::$currentUser = $anonymousCoward;
70
-            }
71
-        }
72
-
73
-        return self::$currentUser;
74
-    }
75
-
76
-    /**
77
-     * Gets a user by their user ID
78
-     *
79
-     * Pass -1 to get the community user.
80
-     *
81
-     * @param int|null    $id
82
-     * @param PdoDatabase $database
83
-     *
84
-     * @return User|false
85
-     */
86
-    public static function getById($id, PdoDatabase $database)
87
-    {
88
-        if ($id === null || $id == -1) {
89
-            return new CommunityUser();
90
-        }
91
-
92
-        /** @var User|false $user */
93
-        $user = parent::getById($id, $database);
94
-
95
-        return $user;
96
-    }
97
-
98
-    public static function getCommunity(): CommunityUser
99
-    {
100
-        if (!isset(self::$community)) {
101
-            self::$community = new CommunityUser();
102
-        }
103
-
104
-        return self::$community;
105
-    }
106
-
107
-    /**
108
-     * Gets a user by their username
109
-     *
110
-     * @param  string      $username
111
-     * @param  PdoDatabase $database
112
-     *
113
-     * @return CommunityUser|User|false
114
-     */
115
-    public static function getByUsername($username, PdoDatabase $database)
116
-    {
117
-        if ($username === self::getCommunity()->getUsername()) {
118
-            return new CommunityUser();
119
-        }
120
-
121
-        $statement = $database->prepare("SELECT * FROM user WHERE username = :id LIMIT 1;");
122
-        $statement->bindValue(":id", $username);
123
-
124
-        $statement->execute();
125
-
126
-        $resultObject = $statement->fetchObject(get_called_class());
127
-
128
-        if ($resultObject != false) {
129
-            $resultObject->setDatabase($database);
130
-        }
131
-
132
-        return $resultObject;
133
-    }
134
-
135
-    /**
136
-     * Gets a user by their on-wiki username.
137
-     *
138
-     * @param string      $username
139
-     * @param PdoDatabase $database
140
-     *
141
-     * @return User|false
142
-     */
143
-    public static function getByOnWikiUsername($username, PdoDatabase $database)
144
-    {
145
-        $statement = $database->prepare("SELECT * FROM user WHERE onwikiname = :id LIMIT 1;");
146
-        $statement->bindValue(":id", $username);
147
-        $statement->execute();
148
-
149
-        $resultObject = $statement->fetchObject(get_called_class());
150
-
151
-        if ($resultObject != false) {
152
-            $resultObject->setDatabase($database);
153
-
154
-            return $resultObject;
155
-        }
156
-
157
-        return false;
158
-    }
159
-
160
-    #endregion
161
-
162
-    /**
163
-     * Saves the current object
164
-     *
165
-     * @throws Exception
166
-     */
167
-    public function save()
168
-    {
169
-        if ($this->isNew()) {
170
-            // insert
171
-            $statement = $this->dbObject->prepare(<<<SQL
25
+	const STATUS_ACTIVE = 'Active';
26
+	const STATUS_DEACTIVATED = 'Deactivated';
27
+	const STATUS_NEW = 'New';
28
+
29
+	private static CommunityUser $community;
30
+
31
+	private $username;
32
+	private $email;
33
+	private $status = self::STATUS_NEW;
34
+	private $onwikiname;
35
+	private $lastactive = "0000-00-00 00:00:00";
36
+	private $forcelogout = 0;
37
+	private $forceidentified = null;
38
+	private $confirmationdiff = 0;
39
+	/** @var User Cache variable of the current user - it's never going to change in the middle of a request. */
40
+	private static $currentUser;
41
+	#region Object load methods
42
+
43
+	/**
44
+	 * Gets the currently logged in user
45
+	 *
46
+	 * @param PdoDatabase $database
47
+	 *
48
+	 * @return User|CommunityUser
49
+	 */
50
+	public static function getCurrent(PdoDatabase $database)
51
+	{
52
+		if (self::$currentUser === null) {
53
+			$sessionId = WebRequest::getSessionUserId();
54
+
55
+			if ($sessionId !== null) {
56
+				/** @var User $user */
57
+				$user = self::getById($sessionId, $database);
58
+
59
+				if ($user === false) {
60
+					self::$currentUser = new CommunityUser();
61
+				}
62
+				else {
63
+					self::$currentUser = $user;
64
+				}
65
+			}
66
+			else {
67
+				$anonymousCoward = new CommunityUser();
68
+
69
+				self::$currentUser = $anonymousCoward;
70
+			}
71
+		}
72
+
73
+		return self::$currentUser;
74
+	}
75
+
76
+	/**
77
+	 * Gets a user by their user ID
78
+	 *
79
+	 * Pass -1 to get the community user.
80
+	 *
81
+	 * @param int|null    $id
82
+	 * @param PdoDatabase $database
83
+	 *
84
+	 * @return User|false
85
+	 */
86
+	public static function getById($id, PdoDatabase $database)
87
+	{
88
+		if ($id === null || $id == -1) {
89
+			return new CommunityUser();
90
+		}
91
+
92
+		/** @var User|false $user */
93
+		$user = parent::getById($id, $database);
94
+
95
+		return $user;
96
+	}
97
+
98
+	public static function getCommunity(): CommunityUser
99
+	{
100
+		if (!isset(self::$community)) {
101
+			self::$community = new CommunityUser();
102
+		}
103
+
104
+		return self::$community;
105
+	}
106
+
107
+	/**
108
+	 * Gets a user by their username
109
+	 *
110
+	 * @param  string      $username
111
+	 * @param  PdoDatabase $database
112
+	 *
113
+	 * @return CommunityUser|User|false
114
+	 */
115
+	public static function getByUsername($username, PdoDatabase $database)
116
+	{
117
+		if ($username === self::getCommunity()->getUsername()) {
118
+			return new CommunityUser();
119
+		}
120
+
121
+		$statement = $database->prepare("SELECT * FROM user WHERE username = :id LIMIT 1;");
122
+		$statement->bindValue(":id", $username);
123
+
124
+		$statement->execute();
125
+
126
+		$resultObject = $statement->fetchObject(get_called_class());
127
+
128
+		if ($resultObject != false) {
129
+			$resultObject->setDatabase($database);
130
+		}
131
+
132
+		return $resultObject;
133
+	}
134
+
135
+	/**
136
+	 * Gets a user by their on-wiki username.
137
+	 *
138
+	 * @param string      $username
139
+	 * @param PdoDatabase $database
140
+	 *
141
+	 * @return User|false
142
+	 */
143
+	public static function getByOnWikiUsername($username, PdoDatabase $database)
144
+	{
145
+		$statement = $database->prepare("SELECT * FROM user WHERE onwikiname = :id LIMIT 1;");
146
+		$statement->bindValue(":id", $username);
147
+		$statement->execute();
148
+
149
+		$resultObject = $statement->fetchObject(get_called_class());
150
+
151
+		if ($resultObject != false) {
152
+			$resultObject->setDatabase($database);
153
+
154
+			return $resultObject;
155
+		}
156
+
157
+		return false;
158
+	}
159
+
160
+	#endregion
161
+
162
+	/**
163
+	 * Saves the current object
164
+	 *
165
+	 * @throws Exception
166
+	 */
167
+	public function save()
168
+	{
169
+		if ($this->isNew()) {
170
+			// insert
171
+			$statement = $this->dbObject->prepare(<<<SQL
172 172
 				INSERT INTO `user` ( 
173 173
 					username, email, status, onwikiname, 
174 174
 					lastactive, forcelogout, forceidentified,
@@ -179,25 +179,25 @@  discard block
 block discarded – undo
179 179
 					:confirmationdiff
180 180
 				);
181 181
 SQL
182
-            );
183
-            $statement->bindValue(":username", $this->username);
184
-            $statement->bindValue(":email", $this->email);
185
-            $statement->bindValue(":status", $this->status);
186
-            $statement->bindValue(":onwikiname", $this->onwikiname);
187
-            $statement->bindValue(":lastactive", $this->lastactive);
188
-            $statement->bindValue(":forcelogout", $this->forcelogout);
189
-            $statement->bindValue(":confirmationdiff", $this->confirmationdiff);
190
-
191
-            if ($statement->execute()) {
192
-                $this->id = (int)$this->dbObject->lastInsertId();
193
-            }
194
-            else {
195
-                throw new Exception($statement->errorInfo());
196
-            }
197
-        }
198
-        else {
199
-            // update
200
-            $statement = $this->dbObject->prepare(<<<SQL
182
+			);
183
+			$statement->bindValue(":username", $this->username);
184
+			$statement->bindValue(":email", $this->email);
185
+			$statement->bindValue(":status", $this->status);
186
+			$statement->bindValue(":onwikiname", $this->onwikiname);
187
+			$statement->bindValue(":lastactive", $this->lastactive);
188
+			$statement->bindValue(":forcelogout", $this->forcelogout);
189
+			$statement->bindValue(":confirmationdiff", $this->confirmationdiff);
190
+
191
+			if ($statement->execute()) {
192
+				$this->id = (int)$this->dbObject->lastInsertId();
193
+			}
194
+			else {
195
+				throw new Exception($statement->errorInfo());
196
+			}
197
+		}
198
+		else {
199
+			// update
200
+			$statement = $this->dbObject->prepare(<<<SQL
201 201
 				UPDATE `user` SET 
202 202
 					username = :username, email = :email, 
203 203
 					status = :status,
@@ -208,233 +208,233 @@  discard block
 block discarded – undo
208 208
                     updateversion = updateversion + 1
209 209
 				WHERE id = :id AND updateversion = :updateversion;
210 210
 SQL
211
-            );
212
-
213
-            $statement->bindValue(':id', $this->id);
214
-            $statement->bindValue(':updateversion', $this->updateversion);
215
-
216
-            $statement->bindValue(':username', $this->username);
217
-            $statement->bindValue(':email', $this->email);
218
-            $statement->bindValue(':status', $this->status);
219
-            $statement->bindValue(':onwikiname', $this->onwikiname);
220
-            $statement->bindValue(':lastactive', $this->lastactive);
221
-            $statement->bindValue(':forcelogout', $this->forcelogout);
222
-            $statement->bindValue(':confirmationdiff', $this->confirmationdiff);
223
-
224
-            if (!$statement->execute()) {
225
-                throw new Exception($statement->errorInfo());
226
-            }
227
-
228
-            if ($statement->rowCount() !== 1) {
229
-                throw new OptimisticLockFailedException();
230
-            }
231
-
232
-            $this->updateversion++;
233
-        }
234
-    }
235
-
236
-    #region properties
237
-
238
-    /**
239
-     * Gets the tool username
240
-     * @return string
241
-     */
242
-    public function getUsername()
243
-    {
244
-        return $this->username;
245
-    }
246
-
247
-    /**
248
-     * Sets the tool username
249
-     *
250
-     * @param string $username
251
-     */
252
-    public function setUsername($username)
253
-    {
254
-        $this->username = $username;
255
-
256
-        // If this isn't a brand new user, then it's a rename, force the logout
257
-        if (!$this->isNew()) {
258
-            $this->forcelogout = 1;
259
-        }
260
-    }
261
-
262
-    /**
263
-     * Gets the user's email address
264
-     * @return string
265
-     */
266
-    public function getEmail()
267
-    {
268
-        return $this->email;
269
-    }
270
-
271
-    /**
272
-     * Sets the user's email address
273
-     *
274
-     * @param string $email
275
-     */
276
-    public function setEmail($email)
277
-    {
278
-        $this->email = $email;
279
-    }
280
-
281
-    /**
282
-     * Gets the status (Active, New, Deactivated, etc) of the user.
283
-     * @return string
284
-     */
285
-    public function getStatus()
286
-    {
287
-        return $this->status;
288
-    }
289
-
290
-    /**
291
-     * @param string $status
292
-     */
293
-    public function setStatus($status)
294
-    {
295
-        $this->status = $status;
296
-    }
297
-
298
-    /**
299
-     * Gets the user's on-wiki name
300
-     * @return string
301
-     */
302
-    public function getOnWikiName()
303
-    {
304
-        return $this->onwikiname;
305
-    }
306
-
307
-    /**
308
-     * Sets the user's on-wiki name
309
-     *
310
-     * This can have interesting side-effects with OAuth.
311
-     *
312
-     * @param string $onWikiName
313
-     */
314
-    public function setOnWikiName($onWikiName)
315
-    {
316
-        $this->onwikiname = $onWikiName;
317
-    }
318
-
319
-    /**
320
-     * Gets the last activity date for the user
321
-     *
322
-     * @return string
323
-     * @todo This should probably return an instance of DateTime
324
-     */
325
-    public function getLastActive()
326
-    {
327
-        return $this->lastactive;
328
-    }
329
-
330
-    /**
331
-     * Gets the user's forced logout status
332
-     *
333
-     * @return bool
334
-     */
335
-    public function getForceLogout()
336
-    {
337
-        return $this->forcelogout == 1;
338
-    }
339
-
340
-    /**
341
-     * Sets the user's forced logout status
342
-     *
343
-     * @param bool $forceLogout
344
-     */
345
-    public function setForceLogout($forceLogout)
346
-    {
347
-        $this->forcelogout = $forceLogout ? 1 : 0;
348
-    }
349
-
350
-    /**
351
-     * Gets the user's confirmation diff. Unused if OAuth is in use.
352
-     * @return int the diff ID
353
-     */
354
-    public function getConfirmationDiff()
355
-    {
356
-        return $this->confirmationdiff;
357
-    }
358
-
359
-    /**
360
-     * Sets the user's confirmation diff.
361
-     *
362
-     * @param int $confirmationDiff
363
-     */
364
-    public function setConfirmationDiff($confirmationDiff)
365
-    {
366
-        $this->confirmationdiff = $confirmationDiff;
367
-    }
368
-
369
-    #endregion
370
-
371
-    #region user access checks
372
-
373
-    public function isActive()
374
-    {
375
-        return $this->status == self::STATUS_ACTIVE;
376
-    }
377
-
378
-    /**
379
-     * DO NOT USE FOR TESTING IDENTIFICATION STATUS.
380
-     *
381
-     * This only returns any overrides in the database for identification status,
382
-     * and is thus not suitable on its own to determine if a user is identified.
383
-     *
384
-     * Most (all?) users should have a null value here; this is only here as an
385
-     * emergency override in case things go horribly, horribly wrong. For
386
-     * example, when WMF completely change the layout of the ID noticeboard.
387
-     */
388
-    public function getForceIdentified(): ?bool
389
-    {
390
-        if ($this->forceidentified === null) {
391
-            return null;
392
-        }
393
-
394
-        return $this->forceidentified === 1;
395
-    }
396
-
397
-    /**
398
-     * Tests if the user is new
399
-     * @return bool
400
-     * @category Security-Critical
401
-     */
402
-    public function isNewUser()
403
-    {
404
-        return $this->status == self::STATUS_NEW;
405
-    }
406
-
407
-    /**
408
-     * Tests if the user has been deactivated and is unable to access the tool
409
-     * @return bool
410
-     * @category Security-Critical
411
-     */
412
-    public function isDeactivated(): bool
413
-    {
414
-        return $this->status == self::STATUS_DEACTIVATED;
415
-    }
416
-
417
-    /**
418
-     * Tests if the user is the community user
419
-     *
420
-     * @todo     decide if this means logged out. I think it usually does.
421
-     * @return bool
422
-     * @category Security-Critical
423
-     */
424
-    public function isCommunityUser()
425
-    {
426
-        return false;
427
-    }
428
-
429
-    #endregion 
430
-
431
-    /**
432
-     * Gets the approval date of the user
433
-     * @return DateTime|false
434
-     */
435
-    public function getApprovalDate()
436
-    {
437
-        $query = $this->dbObject->prepare(<<<SQL
211
+			);
212
+
213
+			$statement->bindValue(':id', $this->id);
214
+			$statement->bindValue(':updateversion', $this->updateversion);
215
+
216
+			$statement->bindValue(':username', $this->username);
217
+			$statement->bindValue(':email', $this->email);
218
+			$statement->bindValue(':status', $this->status);
219
+			$statement->bindValue(':onwikiname', $this->onwikiname);
220
+			$statement->bindValue(':lastactive', $this->lastactive);
221
+			$statement->bindValue(':forcelogout', $this->forcelogout);
222
+			$statement->bindValue(':confirmationdiff', $this->confirmationdiff);
223
+
224
+			if (!$statement->execute()) {
225
+				throw new Exception($statement->errorInfo());
226
+			}
227
+
228
+			if ($statement->rowCount() !== 1) {
229
+				throw new OptimisticLockFailedException();
230
+			}
231
+
232
+			$this->updateversion++;
233
+		}
234
+	}
235
+
236
+	#region properties
237
+
238
+	/**
239
+	 * Gets the tool username
240
+	 * @return string
241
+	 */
242
+	public function getUsername()
243
+	{
244
+		return $this->username;
245
+	}
246
+
247
+	/**
248
+	 * Sets the tool username
249
+	 *
250
+	 * @param string $username
251
+	 */
252
+	public function setUsername($username)
253
+	{
254
+		$this->username = $username;
255
+
256
+		// If this isn't a brand new user, then it's a rename, force the logout
257
+		if (!$this->isNew()) {
258
+			$this->forcelogout = 1;
259
+		}
260
+	}
261
+
262
+	/**
263
+	 * Gets the user's email address
264
+	 * @return string
265
+	 */
266
+	public function getEmail()
267
+	{
268
+		return $this->email;
269
+	}
270
+
271
+	/**
272
+	 * Sets the user's email address
273
+	 *
274
+	 * @param string $email
275
+	 */
276
+	public function setEmail($email)
277
+	{
278
+		$this->email = $email;
279
+	}
280
+
281
+	/**
282
+	 * Gets the status (Active, New, Deactivated, etc) of the user.
283
+	 * @return string
284
+	 */
285
+	public function getStatus()
286
+	{
287
+		return $this->status;
288
+	}
289
+
290
+	/**
291
+	 * @param string $status
292
+	 */
293
+	public function setStatus($status)
294
+	{
295
+		$this->status = $status;
296
+	}
297
+
298
+	/**
299
+	 * Gets the user's on-wiki name
300
+	 * @return string
301
+	 */
302
+	public function getOnWikiName()
303
+	{
304
+		return $this->onwikiname;
305
+	}
306
+
307
+	/**
308
+	 * Sets the user's on-wiki name
309
+	 *
310
+	 * This can have interesting side-effects with OAuth.
311
+	 *
312
+	 * @param string $onWikiName
313
+	 */
314
+	public function setOnWikiName($onWikiName)
315
+	{
316
+		$this->onwikiname = $onWikiName;
317
+	}
318
+
319
+	/**
320
+	 * Gets the last activity date for the user
321
+	 *
322
+	 * @return string
323
+	 * @todo This should probably return an instance of DateTime
324
+	 */
325
+	public function getLastActive()
326
+	{
327
+		return $this->lastactive;
328
+	}
329
+
330
+	/**
331
+	 * Gets the user's forced logout status
332
+	 *
333
+	 * @return bool
334
+	 */
335
+	public function getForceLogout()
336
+	{
337
+		return $this->forcelogout == 1;
338
+	}
339
+
340
+	/**
341
+	 * Sets the user's forced logout status
342
+	 *
343
+	 * @param bool $forceLogout
344
+	 */
345
+	public function setForceLogout($forceLogout)
346
+	{
347
+		$this->forcelogout = $forceLogout ? 1 : 0;
348
+	}
349
+
350
+	/**
351
+	 * Gets the user's confirmation diff. Unused if OAuth is in use.
352
+	 * @return int the diff ID
353
+	 */
354
+	public function getConfirmationDiff()
355
+	{
356
+		return $this->confirmationdiff;
357
+	}
358
+
359
+	/**
360
+	 * Sets the user's confirmation diff.
361
+	 *
362
+	 * @param int $confirmationDiff
363
+	 */
364
+	public function setConfirmationDiff($confirmationDiff)
365
+	{
366
+		$this->confirmationdiff = $confirmationDiff;
367
+	}
368
+
369
+	#endregion
370
+
371
+	#region user access checks
372
+
373
+	public function isActive()
374
+	{
375
+		return $this->status == self::STATUS_ACTIVE;
376
+	}
377
+
378
+	/**
379
+	 * DO NOT USE FOR TESTING IDENTIFICATION STATUS.
380
+	 *
381
+	 * This only returns any overrides in the database for identification status,
382
+	 * and is thus not suitable on its own to determine if a user is identified.
383
+	 *
384
+	 * Most (all?) users should have a null value here; this is only here as an
385
+	 * emergency override in case things go horribly, horribly wrong. For
386
+	 * example, when WMF completely change the layout of the ID noticeboard.
387
+	 */
388
+	public function getForceIdentified(): ?bool
389
+	{
390
+		if ($this->forceidentified === null) {
391
+			return null;
392
+		}
393
+
394
+		return $this->forceidentified === 1;
395
+	}
396
+
397
+	/**
398
+	 * Tests if the user is new
399
+	 * @return bool
400
+	 * @category Security-Critical
401
+	 */
402
+	public function isNewUser()
403
+	{
404
+		return $this->status == self::STATUS_NEW;
405
+	}
406
+
407
+	/**
408
+	 * Tests if the user has been deactivated and is unable to access the tool
409
+	 * @return bool
410
+	 * @category Security-Critical
411
+	 */
412
+	public function isDeactivated(): bool
413
+	{
414
+		return $this->status == self::STATUS_DEACTIVATED;
415
+	}
416
+
417
+	/**
418
+	 * Tests if the user is the community user
419
+	 *
420
+	 * @todo     decide if this means logged out. I think it usually does.
421
+	 * @return bool
422
+	 * @category Security-Critical
423
+	 */
424
+	public function isCommunityUser()
425
+	{
426
+		return false;
427
+	}
428
+
429
+	#endregion 
430
+
431
+	/**
432
+	 * Gets the approval date of the user
433
+	 * @return DateTime|false
434
+	 */
435
+	public function getApprovalDate()
436
+	{
437
+		$query = $this->dbObject->prepare(<<<SQL
438 438
 			SELECT timestamp 
439 439
 			FROM log 
440 440
 			WHERE objectid = :userid
@@ -443,12 +443,12 @@  discard block
 block discarded – undo
443 443
 			ORDER BY id DESC 
444 444
 			LIMIT 1;
445 445
 SQL
446
-        );
447
-        $query->execute(array(":userid" => $this->id));
446
+		);
447
+		$query->execute(array(":userid" => $this->id));
448 448
 
449
-        $data = DateTime::createFromFormat("Y-m-d H:i:s", $query->fetchColumn());
450
-        $query->closeCursor();
449
+		$data = DateTime::createFromFormat("Y-m-d H:i:s", $query->fetchColumn());
450
+		$query->closeCursor();
451 451
 
452
-        return $data;
453
-    }
452
+		return $data;
453
+	}
454 454
 }
Please login to merge, or discard this patch.
includes/DataObjects/CommunityUser.php 1 patch
Indentation   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -17,120 +17,120 @@
 block discarded – undo
17 17
  */
18 18
 class CommunityUser extends User
19 19
 {
20
-    public function getId()
21
-    {
22
-        return -1;
23
-    }
24
-
25
-    public function save()
26
-    {
27
-        // Do nothing
28
-    }
29
-
30
-    #region properties
31
-
32
-    /**
33
-     * @return string
34
-     */
35
-    public function getUsername()
36
-    {
37
-        return '[Community]';
38
-    }
39
-
40
-    public function setUsername($username)
41
-    {
42
-    }
43
-
44
-    /**
45
-     * @return string
46
-     */
47
-    public function getEmail()
48
-    {
49
-        global $cDataClearEmail;
50
-
51
-        return $cDataClearEmail;
52
-    }
53
-
54
-    public function setEmail($email)
55
-    {
56
-    }
57
-
58
-    public function getStatus()
59
-    {
60
-        return "Community";
61
-    }
62
-
63
-    public function getOnWikiName()
64
-    {
65
-        return "127.0.0.1";
66
-    }
67
-
68
-    public function setOnWikiName($onWikiName)
69
-    {
70
-    }
71
-
72
-    public function getLastActive()
73
-    {
74
-        $now = new DateTime();
75
-
76
-        return $now->format("Y-m-d H:i:s");
77
-    }
78
-
79
-    public function getForceLogout()
80
-    {
81
-        return true;
82
-    }
83
-
84
-    public function setForceLogout($forceLogout)
85
-    {
86
-    }
87
-
88
-    /**
89
-     * @param string $status
90
-     */
91
-    public function setStatus($status)
92
-    {
93
-    }
94
-
95
-    public function getConfirmationDiff()
96
-    {
97
-        return null;
98
-    }
99
-
100
-    public function setConfirmationDiff($confirmationDiff)
101
-    {
102
-    }
103
-
104
-
105
-    public function setUseAlternateSkin($useAlternate)
106
-    {
107
-    }
108
-
109
-    #endregion
110
-
111
-    #region user access checks
112
-
113
-    public function isNewUser()
114
-    {
115
-        return false;
116
-    }
117
-
118
-    public function isDeactivated(): bool
119
-    {
120
-        return false;
121
-    }
122
-
123
-    public function isCommunityUser()
124
-    {
125
-        return true;
126
-    }
127
-
128
-    #endregion
20
+	public function getId()
21
+	{
22
+		return -1;
23
+	}
24
+
25
+	public function save()
26
+	{
27
+		// Do nothing
28
+	}
29
+
30
+	#region properties
31
+
32
+	/**
33
+	 * @return string
34
+	 */
35
+	public function getUsername()
36
+	{
37
+		return '[Community]';
38
+	}
39
+
40
+	public function setUsername($username)
41
+	{
42
+	}
43
+
44
+	/**
45
+	 * @return string
46
+	 */
47
+	public function getEmail()
48
+	{
49
+		global $cDataClearEmail;
50
+
51
+		return $cDataClearEmail;
52
+	}
53
+
54
+	public function setEmail($email)
55
+	{
56
+	}
57
+
58
+	public function getStatus()
59
+	{
60
+		return "Community";
61
+	}
62
+
63
+	public function getOnWikiName()
64
+	{
65
+		return "127.0.0.1";
66
+	}
67
+
68
+	public function setOnWikiName($onWikiName)
69
+	{
70
+	}
71
+
72
+	public function getLastActive()
73
+	{
74
+		$now = new DateTime();
75
+
76
+		return $now->format("Y-m-d H:i:s");
77
+	}
78
+
79
+	public function getForceLogout()
80
+	{
81
+		return true;
82
+	}
83
+
84
+	public function setForceLogout($forceLogout)
85
+	{
86
+	}
87
+
88
+	/**
89
+	 * @param string $status
90
+	 */
91
+	public function setStatus($status)
92
+	{
93
+	}
94
+
95
+	public function getConfirmationDiff()
96
+	{
97
+		return null;
98
+	}
99
+
100
+	public function setConfirmationDiff($confirmationDiff)
101
+	{
102
+	}
103
+
104
+
105
+	public function setUseAlternateSkin($useAlternate)
106
+	{
107
+	}
108
+
109
+	#endregion
110
+
111
+	#region user access checks
112
+
113
+	public function isNewUser()
114
+	{
115
+		return false;
116
+	}
117
+
118
+	public function isDeactivated(): bool
119
+	{
120
+		return false;
121
+	}
122
+
123
+	public function isCommunityUser()
124
+	{
125
+		return true;
126
+	}
127
+
128
+	#endregion
129 129
 
130
-    public function getApprovalDate()
131
-    {
132
-        $data = DateTime::createFromFormat("Y-m-d H:i:s", "1970-01-01 00:00:00");
133
-
134
-        return $data;
135
-    }
130
+	public function getApprovalDate()
131
+	{
132
+		$data = DateTime::createFromFormat("Y-m-d H:i:s", "1970-01-01 00:00:00");
133
+
134
+		return $data;
135
+	}
136 136
 }
Please login to merge, or discard this patch.
includes/DataObjects/Domain.php 1 patch
Indentation   +286 added lines, -286 removed lines patch added patch discarded remove patch
@@ -18,94 +18,94 @@  discard block
 block discarded – undo
18 18
 
19 19
 class Domain extends DataObject
20 20
 {
21
-    /** @var string */
22
-    private $shortname;
23
-    /** @var string */
24
-    private $longname;
25
-    /** @var string */
26
-    private $wikiarticlepath;
27
-    /** @var string */
28
-    private $wikiapipath;
29
-    /** @var int */
30
-    private $enabled = 0;
31
-    /** @var int|null */
32
-    private $defaultclose;
33
-    /** @var string */
34
-    private $defaultlanguage = 'en';
35
-    /** @var string */
36
-    private $emailreplyaddress;
37
-    /** @var string|null */
38
-    private $notificationtarget;
39
-    /** @var string */
40
-    private $localdocumentation;
41
-
42
-    /** @var Domain Cache variable of the current domain */
43
-    private static $currentDomain;
44
-
45
-    public static function getCurrent(PdoDatabase $database)
46
-    {
47
-        if (self::$currentDomain === null) {
48
-            $sessionDomain = WebRequest::getSessionDomain();
49
-
50
-            if ($sessionDomain !== null) {
51
-                /** @var Domain $domain */
52
-                $domain = self::getById($sessionDomain, $database);
53
-
54
-                if ($domain === false) {
55
-                    self::$currentDomain = self::getById(1, $database); // FIXME: #594 User::getCurrent($database)->getDefaultDomain();
56
-                }
57
-                else {
58
-                    self::$currentDomain = $domain;
59
-                }
60
-            }
61
-            else {
62
-                self::$currentDomain = self::getById(1, $database); // FIXME: #594 User::getCurrent($database)->getDefaultDomain();
63
-            }
64
-        }
65
-
66
-        return self::$currentDomain;
67
-    }
68
-
69
-    public static function getByShortName(string $shortName, PdoDatabase $database)
70
-    {
71
-        $statement = $database->prepare(<<<SQL
21
+	/** @var string */
22
+	private $shortname;
23
+	/** @var string */
24
+	private $longname;
25
+	/** @var string */
26
+	private $wikiarticlepath;
27
+	/** @var string */
28
+	private $wikiapipath;
29
+	/** @var int */
30
+	private $enabled = 0;
31
+	/** @var int|null */
32
+	private $defaultclose;
33
+	/** @var string */
34
+	private $defaultlanguage = 'en';
35
+	/** @var string */
36
+	private $emailreplyaddress;
37
+	/** @var string|null */
38
+	private $notificationtarget;
39
+	/** @var string */
40
+	private $localdocumentation;
41
+
42
+	/** @var Domain Cache variable of the current domain */
43
+	private static $currentDomain;
44
+
45
+	public static function getCurrent(PdoDatabase $database)
46
+	{
47
+		if (self::$currentDomain === null) {
48
+			$sessionDomain = WebRequest::getSessionDomain();
49
+
50
+			if ($sessionDomain !== null) {
51
+				/** @var Domain $domain */
52
+				$domain = self::getById($sessionDomain, $database);
53
+
54
+				if ($domain === false) {
55
+					self::$currentDomain = self::getById(1, $database); // FIXME: #594 User::getCurrent($database)->getDefaultDomain();
56
+				}
57
+				else {
58
+					self::$currentDomain = $domain;
59
+				}
60
+			}
61
+			else {
62
+				self::$currentDomain = self::getById(1, $database); // FIXME: #594 User::getCurrent($database)->getDefaultDomain();
63
+			}
64
+		}
65
+
66
+		return self::$currentDomain;
67
+	}
68
+
69
+	public static function getByShortName(string $shortName, PdoDatabase $database)
70
+	{
71
+		$statement = $database->prepare(<<<SQL
72 72
             SELECT * FROM domain WHERE shortname = :name;
73 73
 SQL
74
-        );
74
+		);
75 75
 
76
-        $statement->execute([
77
-            ':name' => $shortName,
78
-        ]);
76
+		$statement->execute([
77
+			':name' => $shortName,
78
+		]);
79 79
 
80
-        /** @var RequestForm|false $result */
81
-        $result = $statement->fetchObject(get_called_class());
80
+		/** @var RequestForm|false $result */
81
+		$result = $statement->fetchObject(get_called_class());
82 82
 
83
-        if ($result !== false) {
84
-            $result->setDatabase($database);
85
-        }
83
+		if ($result !== false) {
84
+			$result->setDatabase($database);
85
+		}
86 86
 
87
-        return $result;
88
-    }
87
+		return $result;
88
+	}
89 89
 
90
-    public static function getAll(PdoDatabase $database) {
91
-        $statement = $database->prepare("SELECT * FROM domain;");
92
-        $statement->execute();
90
+	public static function getAll(PdoDatabase $database) {
91
+		$statement = $database->prepare("SELECT * FROM domain;");
92
+		$statement->execute();
93 93
 
94
-        $resultObject = $statement->fetchAll(PDO::FETCH_CLASS, get_called_class());
94
+		$resultObject = $statement->fetchAll(PDO::FETCH_CLASS, get_called_class());
95 95
 
96
-        /** @var Domain $t */
97
-        foreach ($resultObject as $t) {
98
-            $t->setDatabase($database);
99
-        }
96
+		/** @var Domain $t */
97
+		foreach ($resultObject as $t) {
98
+			$t->setDatabase($database);
99
+		}
100 100
 
101
-        return $resultObject;
102
-    }
101
+		return $resultObject;
102
+	}
103 103
 
104
-    public function save()
105
-    {
106
-        if ($this->isNew()) {
107
-            // insert
108
-            $statement = $this->dbObject->prepare(<<<SQL
104
+	public function save()
105
+	{
106
+		if ($this->isNew()) {
107
+			// insert
108
+			$statement = $this->dbObject->prepare(<<<SQL
109 109
                 INSERT INTO domain (
110 110
                     shortname, longname, wikiarticlepath, wikiapipath, enabled, defaultclose, defaultlanguage, 
111 111
                     emailreplyaddress, notificationtarget, localdocumentation
@@ -114,29 +114,29 @@  discard block
 block discarded – undo
114 114
                     :emailreplyaddress, :notificationtarget, :localdocumentation
115 115
                 );
116 116
 SQL
117
-            );
118
-
119
-            $statement->bindValue(":shortname", $this->shortname);
120
-            $statement->bindValue(":longname", $this->longname);
121
-            $statement->bindValue(":wikiarticlepath", $this->wikiarticlepath);
122
-            $statement->bindValue(":wikiapipath", $this->wikiapipath);
123
-            $statement->bindValue(":enabled", $this->enabled);
124
-            $statement->bindValue(":defaultclose", $this->defaultclose);
125
-            $statement->bindValue(":defaultlanguage", $this->defaultlanguage);
126
-            $statement->bindValue(":emailreplyaddress", $this->emailreplyaddress);
127
-            $statement->bindValue(":notificationtarget", $this->notificationtarget);
128
-            $statement->bindValue(":localdocumentation", $this->localdocumentation);
129
-
130
-
131
-            if ($statement->execute()) {
132
-                $this->id = (int)$this->dbObject->lastInsertId();
133
-            }
134
-            else {
135
-                throw new Exception($statement->errorInfo());
136
-            }
137
-        }
138
-        else {
139
-            $statement = $this->dbObject->prepare(<<<SQL
117
+			);
118
+
119
+			$statement->bindValue(":shortname", $this->shortname);
120
+			$statement->bindValue(":longname", $this->longname);
121
+			$statement->bindValue(":wikiarticlepath", $this->wikiarticlepath);
122
+			$statement->bindValue(":wikiapipath", $this->wikiapipath);
123
+			$statement->bindValue(":enabled", $this->enabled);
124
+			$statement->bindValue(":defaultclose", $this->defaultclose);
125
+			$statement->bindValue(":defaultlanguage", $this->defaultlanguage);
126
+			$statement->bindValue(":emailreplyaddress", $this->emailreplyaddress);
127
+			$statement->bindValue(":notificationtarget", $this->notificationtarget);
128
+			$statement->bindValue(":localdocumentation", $this->localdocumentation);
129
+
130
+
131
+			if ($statement->execute()) {
132
+				$this->id = (int)$this->dbObject->lastInsertId();
133
+			}
134
+			else {
135
+				throw new Exception($statement->errorInfo());
136
+			}
137
+		}
138
+		else {
139
+			$statement = $this->dbObject->prepare(<<<SQL
140 140
                 UPDATE domain SET
141 141
                     longname = :longname,
142 142
                     wikiarticlepath = :wikiarticlepath,
@@ -151,190 +151,190 @@  discard block
 block discarded – undo
151 151
                     updateversion = updateversion + 1
152 152
 				WHERE id = :id AND updateversion = :updateversion;
153 153
 SQL
154
-            );
155
-
156
-            $statement->bindValue(":longname", $this->longname);
157
-            $statement->bindValue(":wikiarticlepath", $this->wikiarticlepath);
158
-            $statement->bindValue(":wikiapipath", $this->wikiapipath);
159
-            $statement->bindValue(":enabled", $this->enabled);
160
-            $statement->bindValue(":defaultclose", $this->defaultclose);
161
-            $statement->bindValue(":defaultlanguage", $this->defaultlanguage);
162
-            $statement->bindValue(":emailreplyaddress", $this->emailreplyaddress);
163
-            $statement->bindValue(":notificationtarget", $this->notificationtarget);
164
-            $statement->bindValue(":localdocumentation", $this->localdocumentation);
165
-
166
-            $statement->bindValue(':id', $this->id);
167
-            $statement->bindValue(':updateversion', $this->updateversion);
168
-
169
-            if (!$statement->execute()) {
170
-                throw new Exception($statement->errorInfo());
171
-            }
172
-
173
-            if ($statement->rowCount() !== 1) {
174
-                throw new OptimisticLockFailedException();
175
-            }
176
-
177
-            $this->updateversion++;
178
-        }
179
-    }
180
-
181
-    /**
182
-     * @return string
183
-     */
184
-    public function getShortName(): string
185
-    {
186
-        return $this->shortname;
187
-    }
188
-
189
-    /**
190
-     * @param string $shortName
191
-     */
192
-    public function setShortName(string $shortName): void
193
-    {
194
-        $this->shortname = $shortName;
195
-    }
196
-
197
-    /**
198
-     * @return string
199
-     */
200
-    public function getLongName(): string
201
-    {
202
-        return $this->longname;
203
-    }
204
-
205
-    /**
206
-     * @param string $longName
207
-     */
208
-    public function setLongName(string $longName): void
209
-    {
210
-        $this->longname = $longName;
211
-    }
212
-
213
-    /**
214
-     * @return string
215
-     */
216
-    public function getWikiArticlePath(): string
217
-    {
218
-        return $this->wikiarticlepath;
219
-    }
220
-
221
-    /**
222
-     * @param string $wikiArticlePath
223
-     */
224
-    public function setWikiArticlePath(string $wikiArticlePath): void
225
-    {
226
-        $this->wikiarticlepath = $wikiArticlePath;
227
-    }
228
-
229
-    /**
230
-     * @return string
231
-     */
232
-    public function getWikiApiPath(): string
233
-    {
234
-        return $this->wikiapipath;
235
-    }
236
-
237
-    /**
238
-     * @param string $wikiApiPath
239
-     */
240
-    public function setWikiApiPath(string $wikiApiPath): void
241
-    {
242
-        $this->wikiapipath = $wikiApiPath;
243
-    }
244
-
245
-    /**
246
-     * @return bool
247
-     */
248
-    public function isEnabled(): bool
249
-    {
250
-        return $this->enabled == 1;
251
-    }
252
-
253
-    /**
254
-     * @param bool $enabled
255
-     */
256
-    public function setEnabled(bool $enabled): void
257
-    {
258
-        $this->enabled = $enabled ? 1 : 0;
259
-    }
260
-
261
-    /**
262
-     * @return int
263
-     */
264
-    public function getDefaultClose(): ?int
265
-    {
266
-        return $this->defaultclose;
267
-    }
268
-
269
-    /**
270
-     * @param int $defaultClose
271
-     */
272
-    public function setDefaultClose(?int $defaultClose): void
273
-    {
274
-        $this->defaultclose = $defaultClose;
275
-    }
276
-
277
-    /**
278
-     * @return string
279
-     */
280
-    public function getDefaultLanguage(): string
281
-    {
282
-        return $this->defaultlanguage;
283
-    }
284
-
285
-    /**
286
-     * @param string $defaultLanguage
287
-     */
288
-    public function setDefaultLanguage(string $defaultLanguage): void
289
-    {
290
-        $this->defaultlanguage = $defaultLanguage;
291
-    }
292
-
293
-    /**
294
-     * @return string
295
-     */
296
-    public function getEmailReplyAddress(): string
297
-    {
298
-        return $this->emailreplyaddress;
299
-    }
300
-
301
-    /**
302
-     * @param string $emailReplyAddress
303
-     */
304
-    public function setEmailReplyAddress(string $emailReplyAddress): void
305
-    {
306
-        $this->emailreplyaddress = $emailReplyAddress;
307
-    }
308
-
309
-    /**
310
-     * @return string|null
311
-     */
312
-    public function getNotificationTarget(): ?string
313
-    {
314
-        return $this->notificationtarget;
315
-    }
316
-
317
-    /**
318
-     * @param string|null $notificationTarget
319
-     */
320
-    public function setNotificationTarget(?string $notificationTarget): void
321
-    {
322
-        $this->notificationtarget = $notificationTarget;
323
-    }
324
-
325
-    /**
326
-     * @return string
327
-     */
328
-    public function getLocalDocumentation(): string
329
-    {
330
-        return $this->localdocumentation;
331
-    }
332
-
333
-    /**
334
-     * @param string $localDocumentation
335
-     */
336
-    public function setLocalDocumentation(string $localDocumentation): void
337
-    {
338
-        $this->localdocumentation = $localDocumentation;
339
-    }
154
+			);
155
+
156
+			$statement->bindValue(":longname", $this->longname);
157
+			$statement->bindValue(":wikiarticlepath", $this->wikiarticlepath);
158
+			$statement->bindValue(":wikiapipath", $this->wikiapipath);
159
+			$statement->bindValue(":enabled", $this->enabled);
160
+			$statement->bindValue(":defaultclose", $this->defaultclose);
161
+			$statement->bindValue(":defaultlanguage", $this->defaultlanguage);
162
+			$statement->bindValue(":emailreplyaddress", $this->emailreplyaddress);
163
+			$statement->bindValue(":notificationtarget", $this->notificationtarget);
164
+			$statement->bindValue(":localdocumentation", $this->localdocumentation);
165
+
166
+			$statement->bindValue(':id', $this->id);
167
+			$statement->bindValue(':updateversion', $this->updateversion);
168
+
169
+			if (!$statement->execute()) {
170
+				throw new Exception($statement->errorInfo());
171
+			}
172
+
173
+			if ($statement->rowCount() !== 1) {
174
+				throw new OptimisticLockFailedException();
175
+			}
176
+
177
+			$this->updateversion++;
178
+		}
179
+	}
180
+
181
+	/**
182
+	 * @return string
183
+	 */
184
+	public function getShortName(): string
185
+	{
186
+		return $this->shortname;
187
+	}
188
+
189
+	/**
190
+	 * @param string $shortName
191
+	 */
192
+	public function setShortName(string $shortName): void
193
+	{
194
+		$this->shortname = $shortName;
195
+	}
196
+
197
+	/**
198
+	 * @return string
199
+	 */
200
+	public function getLongName(): string
201
+	{
202
+		return $this->longname;
203
+	}
204
+
205
+	/**
206
+	 * @param string $longName
207
+	 */
208
+	public function setLongName(string $longName): void
209
+	{
210
+		$this->longname = $longName;
211
+	}
212
+
213
+	/**
214
+	 * @return string
215
+	 */
216
+	public function getWikiArticlePath(): string
217
+	{
218
+		return $this->wikiarticlepath;
219
+	}
220
+
221
+	/**
222
+	 * @param string $wikiArticlePath
223
+	 */
224
+	public function setWikiArticlePath(string $wikiArticlePath): void
225
+	{
226
+		$this->wikiarticlepath = $wikiArticlePath;
227
+	}
228
+
229
+	/**
230
+	 * @return string
231
+	 */
232
+	public function getWikiApiPath(): string
233
+	{
234
+		return $this->wikiapipath;
235
+	}
236
+
237
+	/**
238
+	 * @param string $wikiApiPath
239
+	 */
240
+	public function setWikiApiPath(string $wikiApiPath): void
241
+	{
242
+		$this->wikiapipath = $wikiApiPath;
243
+	}
244
+
245
+	/**
246
+	 * @return bool
247
+	 */
248
+	public function isEnabled(): bool
249
+	{
250
+		return $this->enabled == 1;
251
+	}
252
+
253
+	/**
254
+	 * @param bool $enabled
255
+	 */
256
+	public function setEnabled(bool $enabled): void
257
+	{
258
+		$this->enabled = $enabled ? 1 : 0;
259
+	}
260
+
261
+	/**
262
+	 * @return int
263
+	 */
264
+	public function getDefaultClose(): ?int
265
+	{
266
+		return $this->defaultclose;
267
+	}
268
+
269
+	/**
270
+	 * @param int $defaultClose
271
+	 */
272
+	public function setDefaultClose(?int $defaultClose): void
273
+	{
274
+		$this->defaultclose = $defaultClose;
275
+	}
276
+
277
+	/**
278
+	 * @return string
279
+	 */
280
+	public function getDefaultLanguage(): string
281
+	{
282
+		return $this->defaultlanguage;
283
+	}
284
+
285
+	/**
286
+	 * @param string $defaultLanguage
287
+	 */
288
+	public function setDefaultLanguage(string $defaultLanguage): void
289
+	{
290
+		$this->defaultlanguage = $defaultLanguage;
291
+	}
292
+
293
+	/**
294
+	 * @return string
295
+	 */
296
+	public function getEmailReplyAddress(): string
297
+	{
298
+		return $this->emailreplyaddress;
299
+	}
300
+
301
+	/**
302
+	 * @param string $emailReplyAddress
303
+	 */
304
+	public function setEmailReplyAddress(string $emailReplyAddress): void
305
+	{
306
+		$this->emailreplyaddress = $emailReplyAddress;
307
+	}
308
+
309
+	/**
310
+	 * @return string|null
311
+	 */
312
+	public function getNotificationTarget(): ?string
313
+	{
314
+		return $this->notificationtarget;
315
+	}
316
+
317
+	/**
318
+	 * @param string|null $notificationTarget
319
+	 */
320
+	public function setNotificationTarget(?string $notificationTarget): void
321
+	{
322
+		$this->notificationtarget = $notificationTarget;
323
+	}
324
+
325
+	/**
326
+	 * @return string
327
+	 */
328
+	public function getLocalDocumentation(): string
329
+	{
330
+		return $this->localdocumentation;
331
+	}
332
+
333
+	/**
334
+	 * @param string $localDocumentation
335
+	 */
336
+	public function setLocalDocumentation(string $localDocumentation): void
337
+	{
338
+		$this->localdocumentation = $localDocumentation;
339
+	}
340 340
 }
341 341
\ No newline at end of file
Please login to merge, or discard this patch.