Changeset 3520 for trunk/modules/auth

Show
Ignore:
Timestamp:
10/01/2008 02:37:43 PM (2 months ago)
Author:
Shadowhand
Message:

Added validate() method to Model_Auth_Role

Location:
trunk/modules/auth/classes/model/auth
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/modules/auth/classes/model/auth/role.php

    r3387 r3520  
    44 
    55        protected $has_and_belongs_to_many = array('users'); 
     6 
     7        /** 
     8         * Validates and optionally saves a role record from an array. 
     9         * 
     10         * @param  array    values to check 
     11         * @param  boolean  save the record when validation succeeds 
     12         * @return boolean 
     13         */ 
     14        public function validate(array & $array, $save = FALSE) 
     15        { 
     16                $array = Validation::factory($array) 
     17                        ->pre_filter('trim') 
     18                        ->add_rules('name', 'required', 'length[4,32]') 
     19                        ->add_rules('description', 'length[0,255]'); 
     20 
     21                return parent::validate($array, $save); 
     22        } 
    623 
    724        /** 
  • trunk/modules/auth/classes/model/auth/user.php

    r3403 r3520  
    2828         * @return boolean 
    2929         */ 
    30         public function validate( array & $array, $save = FALSE) 
     30        public function validate(array & $array, $save = FALSE) 
    3131        { 
    3232                $array = Validation::factory($array)