Code Duplication    Length = 12-12 lines in 4 locations

base/ItemController.php 1 location

@@ 237-248 (lines=12) @@
234
		return new AuthItemModel($item);
235
	}
236
237
	public function beforeAction($action)
238
	{
239
		if (!parent::beforeAction($action)) {
240
			return false;
241
		}
242
243
		if (!\app\controllers\UsersController::test('admin')) {
244
			throw new \yii\web\ForbiddenHttpException('You are not allowed to access this page.');
245
		}
246
247
		return true;
248
	}
249
}
250

controllers/AssignmentController.php 1 location

@@ 183-194 (lines=12) @@
180
		throw new NotFoundHttpException(Yii::t('yii2mod.rbac', 'The requested page does not exist.'));
181
	}
182
183
	public function beforeAction($action)
184
	{
185
		if (!parent::beforeAction($action)) {
186
			return false;
187
		}
188
189
		if (!\app\controllers\UsersController::test('admin')) {
190
			throw new \yii\web\ForbiddenHttpException('You are not allowed to access this page.');
191
		}
192
193
		return true;
194
	}
195
}
196

controllers/RouteController.php 1 location

@@ 106-117 (lines=12) @@
103
		return $model->getAvailableAndAssignedRoutes();
104
	}
105
106
	public function beforeAction($action)
107
	{
108
		if (!parent::beforeAction($action)) {
109
			return false;
110
		}
111
112
		if (!\app\controllers\UsersController::test('admin')) {
113
			throw new \yii\web\ForbiddenHttpException('You are not allowed to access this page.');
114
		}
115
116
		return true;
117
	}
118
}
119

controllers/RuleController.php 1 location

@@ 159-170 (lines=12) @@
156
		throw new NotFoundHttpException(Yii::t('yii2mod.rbac', 'The requested page does not exist.'));
157
	}
158
159
	public function beforeAction($action)
160
	{
161
		if (!parent::beforeAction($action)) {
162
			return false;
163
		}
164
165
		if (!\app\controllers\UsersController::test('admin')) {
166
			throw new \yii\web\ForbiddenHttpException('You are not allowed to access this page.');
167
		}
168
169
		return true;
170
	}
171
}
172