8 changes
OldNew
...... 
22class UsersController extends AppController
33{
4     var $beforeFilters = array( array('action'=>'requireAccess','except'=>array('forgotpassword','resetpassword','login')),
5                                 array('action'=>'requireAccess','only'=>array('add', 'edit','delete'),'args'=>array('admin'))
6                               );
 4    var $beforeFilters = array( array('action'=>'requireAccess','except'=>array('forgotpassword','resetpassword','login')));
75                                
86    var $components = array('queue_email');
...... 
108    
119    function index(){
 10        // check permissions
 11        $this->requireAccess('Perm.admin');
 12        
1213        $this->Users->recursive = 0;
1314        $this->paginate = array('order'=>array('lastname' => 'ASC'));
...... 
1617
1718    function add() {
 19        // check permissions
 20        $this->requireAccess('Perm.admin');
 21        
1822        if (!empty($this->data)) {
1923            // check if we need to add a new group
...... 
5256
5357    function edit($id = null) {
 58        // check permissions
 59        $this->requireAccess('Perm.admin');
5460        
5561        if (!$id && empty($this->data)) {
...... 
107113
108114    function delete($id = null) {
 115        // check permissions
 116        $this->requireAccess('Perm.admin');
109117        if (!$id) {
110118            $this->setFlash('Invalid id for User','err');
...... 
166174                
167175                $user2['Perm.role'] = $user2['User.role'];
168                 // add some custom permissions based on a persons role.. 
169                 // this is where we grant admin / managers greater access
170                 if ($user2['User.role'] == 'admin' || $user2['User.role'] == 'manager')
171                 {
172                     $user2['Perm.tab.admin'] = true;    // enable the admin tab
173                     $user2['Perm.contacts.all'] = true;    // let admins / managers access all contacts ont he system
174                 }
175176
 177                    
176178                // load the client settings and any permissions
177179                $client2 = array();
...... 
201203                // merge settings and permissions from the package, client and user into one Auth component
202204                $auth = array_merge($package,$client2,$user2,$manager);
 205                
 206                
 207                
 208                
 209                
 210                // DO NOT LEAVE THIS IN!!!!!!!!!!!!!
 211                
 212                
 213                
 214                // WOW such a big hack to temporarily give admin perms to do everything so we dont have to keep updating it
 215                // this is where we grant admin / managers greater access
 216                if ($auth['User.role'] == 'admin' || $user2['User.role'] == 'manager')
 217                {
 218                    foreach ($auth as $key=>$perm){
 219                        if (substr($key,0,5)=='Perm.'){
 220                            $auth[$key] = true;
 221                        }
 222                    }
 223                }
 224
 225                // END OF HACKAGE!!!!
 226                
 227                
 228                
 229                
 230
203231                ksort($auth);
204232                $this->Session->write('Auth', $auth);
......