php8
[web.mtrack] / MTrackWeb / Roo.php
1 <?php
2
3
4 require_once 'Pman/Roo.php';
5
6
7 /**
8  * This extends the standard Roo API
9  *
10  * however it has to verify that we send data protected, as it's pretty open!!!
11  *
12  * 
13  *
14  */
15
16 class MTrackWeb_Roo extends Pman_Roo
17 {
18     var $validTables = array(
19         'mtrack_ticket', /// all of these MUST have applyFilters, and check authenication..
20         'Mtrack_ticket', /// all of these MUST have applyFilters, and check authenication..
21         'mtrack_change',
22         'core_enum',
23         //'Person',  // fixme - need to verify this is protected..
24         'mtrack_milestone',
25         'core_project',  // fixme - we should remove code from projects....
26         'Images',   // not sure about this...
27         'mtrack_repos'   // not sure about this...
28         
29     );
30     
31     function getAuth() {
32         Pman::getAuth(); // load company!
33         $au = $this->getAuthUser();
34         $this->authUser =  false;
35         if ($au) {
36            $this->authUser = $au;
37         }
38         
39         return true;
40     }
41     
42     function delete()
43     {
44         $this->jerr("Delete not permitted yet...");
45         // only post requests..???
46         // need perms sorting out first.
47     }
48     
49     function checkPerm($obj, $lvl, $req=null)
50     {
51         //if ($this->authUser) {
52             $res = parent::checkPerm($obj,$lvl,$req);
53             
54             if ($res) {
55                 return $res;
56             }
57         //}
58         // not authenticated...
59          
60         // these checks only apply to non-company users.
61         
62         // normally allowed, but we have more restrictions...
63         switch($obj->tablename()) {
64             
65             case 'core_enum':
66                 if (empty($req['etype'])) {
67                     return false;
68                 }
69                 if ($lvl != 'S') {
70                     return false;
71                 }
72                 
73                 switch ($req['etype']) {
74                      case 'classification':
75                     case 'severity':
76                     case 'resolution':
77                     case 'priority':
78                     case 'ticketstate':                    
79                      
80                     
81                     // not a member of the company..
82                     // not allowed in..
83                         return true;
84                     default:
85                         return false;
86                 }
87                 break; // should not get here...
88             
89             default:
90                 return false;
91                 
92             
93             
94         }
95         
96     }
97      
98     
99 }