permission.php
838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
class ControllerStartupPermission extends Controller {
public function index() {
if (isset($this->request->get['route'])) {
$route = '';
$part = explode('/', $this->request->get['route']);
if (isset($part[0])) {
$route .= $part[0];
}
if (isset($part[1])) {
$route .= '/' . $part[1];
}
$ignore = array(
'common/dashboard',
'common/login',
'common/logout',
'common/forgotten',
'common/reset',
'error/not_found',
'error/permission',
'dashboard/order',
'dashboard/sale',
'dashboard/customer',
'dashboard/online',
'dashboard/map',
'dashboard/activity',
'dashboard/chart',
'dashboard/recent'
);
if (!in_array($route, $ignore) && !$this->user->hasPermission('access', $route)) {
return new Action('error/permission');
}
}
}
}