Major work to domain and hosting
Minor updates for ADSL services Updates to Sort::MAsort() Move core OSB items under application/ Moved ACCOUNT functions under application Minor updates to task
This commit is contained in:
13
application/classes/model/auth/roledefault.php
Normal file
13
application/classes/model/auth/roledefault.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* @package lnApp
|
||||
* @subpackage Auth
|
||||
* @category Models
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class Model_Auth_RoleDefault extends Model_Auth_Role {
|
||||
}
|
||||
?>
|
83
application/classes/model/auth/userdefault.php
Normal file
83
application/classes/model/auth/userdefault.php
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php defined('SYSPATH') or die('No direct access allowed.');
|
||||
|
||||
/**
|
||||
* @package lnApp
|
||||
* @subpackage Auth
|
||||
* @category Models
|
||||
* @author Deon George
|
||||
* @copyright (c) 2010 Deon George
|
||||
* @license http://dev.leenooks.net/license.html
|
||||
*/
|
||||
class Model_Auth_UserDefault extends Model_Auth_User {
|
||||
// Validation rules
|
||||
public function rules() {
|
||||
return array(
|
||||
'username' => array(
|
||||
array('not_empty'),
|
||||
array('min_length', array(':value', 4)),
|
||||
array('max_length', array(':value', 32)),
|
||||
),
|
||||
'password' => array(
|
||||
array('not_empty'),
|
||||
array('min_length', array(':value', 5)),
|
||||
array('max_length', array(':value', 32)),
|
||||
),
|
||||
'email' => array(
|
||||
array('not_empty'),
|
||||
array('min_length', array(':value', 4)),
|
||||
array('max_length', array(':value', 127)),
|
||||
array('email'),
|
||||
),
|
||||
// @todo To test
|
||||
'password_confirm' => array(
|
||||
array('matches_ifset', array(':validation', 'password', 'password_confirm')),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Validation callbacks
|
||||
// @todo _callbacks no longer used
|
||||
protected $_callbacks = array(
|
||||
'username' => array('username_available'),
|
||||
'email' => array('email_available'),
|
||||
);
|
||||
|
||||
// Columns to ignore
|
||||
protected $_ignored_columns = array('password_confirm');
|
||||
|
||||
/*
|
||||
* Complete our login
|
||||
*
|
||||
* For some database logins, we may not want to record the user last login
|
||||
* details in the repository, so we just override that parent function
|
||||
* here.
|
||||
*
|
||||
* We can also do some other post-login actions here.
|
||||
* @todo Maybe we can do our session update here.
|
||||
*/
|
||||
public function complete_login() {
|
||||
return $this->log('Logged In');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test to see if a record has been changed
|
||||
*/
|
||||
public function changed() {
|
||||
return ! (empty($this->_changed));
|
||||
}
|
||||
|
||||
/**
|
||||
* Debug function to see that has() finds
|
||||
* @todo This function could be removed
|
||||
*/
|
||||
public function has_list($alias, $model) {
|
||||
// Return list of matches
|
||||
return DB::select()
|
||||
->from($this->_has_many[$alias]['through'])
|
||||
->where($this->_has_many[$alias]['foreign_key'], '=', $this->pk())
|
||||
->where($this->_has_many[$alias]['far_key'], '=', $model->pk())
|
||||
->execute($this->_db)
|
||||
->as_array();
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user