Assembla home | Assembla project page
 

Changeset 155

Show
Ignore:
Timestamp:
11/11/08 20:13:16 (1 year ago)
Author:
aprice30
Message:

The problem was when the form was being saved. Since the aco & aro radio buttons where disabled no values where passed on. So when adding a new action it just added it to a random aro & aco, thus the creating a new permission.

Quick fix for this was if you are saving a record (not creating) fetch the aro & aco values from the database. Closes #20

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/modules/auth/controllers/admin/acl_permissions.php

    r154 r155  
    119119         function save() 
    120120         { 
    121              $aro = $this->input->post('aro'); 
     121                 // Get values from form 
     122             $id = $this->input->post('id'); 
     123             $allow = $this->input->post('allow'); 
     124 
     125             // INFO: This is a bit of a dirty fix for bug #20 there must be a better way 
     126                 if($id != NULL) 
     127                 { 
     128                        // Form has been submited, so we need to fetch the 
     129                        // aro and aco values from the database 
     130                        $result = $this->access_control_model->getPermissions(NULL,array('acl.id'=>$id)); 
     131                $row = $result[$id]; 
     132 
     133                $_POST['aro'] = $row['aro']; 
     134                $_POST['aco'] = $row['aco']; 
     135                 } 
     136 
     137                 $aro = $this->input->post('aro'); 
    122138             $aco = $this->input->post('aco'); 
    123              $allow = $this->input->post('allow'); 
    124              $id = $this->input->post('id'); 
    125139 
    126140             $this->load->library('khacl'); 
     
    128142             $this->db->trans_start(); 
    129143 
    130              // Remove old actions 
    131              if($id != ''
     144             // Remove old actions if modifying 
     145             if($id != NULL
    132146                 $this->access_control_model->delete('access_actions',array('access_id'=>$id)); 
    133147 
    134              // Create permission 
    135148             // First we will process the actions 
    136149             foreach($_POST as $key=>$value) 
     
    147160 
    148161             // Now process the main permission 
    149              switch($allow) 
    150              { 
    151                  case 'Y':$this->khacl->allow($aro,$aco);break; 
    152                  case 'N':$this->khacl->deny($aro,$aco);break; 
     162             if($id == NULL) 
     163             { 
     164                     switch($allow) 
     165                     { 
     166                         case 'Y':$this->khacl->allow($aro,$aco);break; 
     167                         case 'N':$this->khacl->deny($aro,$aco);break; 
     168                     } 
    153169             } 
    154170 
  • trunk/user_guide/general/changelog.html

    r152 r155  
    6969<h3>Bug Fixes</h3> 
    7070<ul> 
     71        <li>Fixed bug where when modifying a permission, instead of saving it, it created a new permission, See <a href="http://trac2.assembla.com/backendpro/ticket/20">Bug #20</a></li> 
    7172        <li>Fixed bug where status messages would get repeated if an ajax controller method was called, See <a href="http://trac2.assembla.com/backendpro/ticket/4">Bug #4</a></li> 
    7273        <li>Fixed bug where if no user profile fields are created but the user profiles are turned on, it would error saying "Must you set method" when trying to save a edited user account, See <a href="http://trac2.assembla.com/backendpro/ticket/51">Bug #51</a></li>