HCE Project DC service web UI  0.2
Hierarchical Cluster Engine DC service web UI
 All Classes Namespaces Files Functions Variables Pages
Controller.php
Go to the documentation of this file.
1 <?php
7 class Controller extends CController
8 {
9  public function filters()
10  {
11  return array(
12  'accessControl',
13  );
14  }
15 
16  public function accessRules()
17  {
18  $baseRules = array(
19  array('allow',
20  'actions' => array('login', 'logout', 'registration', 'recovery', 'captcha'),
21  )
22  );
23  $rules = $this->getAccessRules();
24  $contollerId = Yii::app()->controller->id;
25  if (!empty($rules[$contollerId]['extends'])) {
26  $rules[$contollerId] = $rules[$rules[$contollerId]['extends']];
27  }
28  if (!empty($rules[$contollerId])) {
29  foreach ($rules[$contollerId] as $rule) {
30  $baseRules[] = $rule;
31  }
32  }
33  //VarDumper::dump($contollerId);
34  $baseRules[] = array('deny',
35  'users' => array('*')
36  );
37  //VarDumper::dump($baseRules);
38  //exit;
39  return $baseRules;
40  }
41 
42  public function getAccessRules() {
43  $siteParams = array(
44  'site' => array(
45  'userId' => Yii::app()->request->getParam('uid'),
46  'siteId' => Yii::app()->request->getParam('siteId')
47  )
48  );
49 
50  $rules = array(
51  'sitesView' => array(
52  array(
53  'allow',
54  'actions' => array(),
55  'roles' => array('readSite' => $siteParams),
56  ),
57  ),
58  'siteNew' => array(
59  array(
60  'allow',
61  'actions' => array(),
62  'roles' => array('createSite' => $siteParams),
63  )
64  ),
65  'siteDelete' => array(
66  array(
67  'allow',
68  'actions' => array(),
69  'roles' => array('deleteSite' => $siteParams),
70  )
71  ),
72  'siteUpdate' => array(
73  array(
74  'allow',
75  'actions' => array(),
76  'roles' => array('updateSite' => $siteParams),
77  )
78  ),
79  'siteRecrawl' => array('extends' => 'siteUpdate'),
80  'siteCleanup' => array('extends' => 'siteDelete'),
81  'urlsView' => array('extends' => 'sitesView'),
82  'urlUpdate' => array('extends' => 'siteUpdate'),
83  'urlRecrawl' => array('extends' => 'siteUpdate'),
84  'urlReprocess' => array('extends' => 'siteUpdate'),
85  'urlCleanup' => array('extends' => 'siteDelete'),
86  'urlDelete' => array('extends' => 'siteDelete'),
87  'resourceDownload' => array('extends' => 'siteUpdate'),
88  'ajax' => array('extends' => 'siteNew'),
89  );
90  return $rules;
91  }
92 
97  public $layout='//layouts/column1';
101  public $menu=array();
107  public $breadcrumbs=array();
108 }