Misc many fixes

This commit is contained in:
Deon George
2011-09-17 20:45:08 +10:00
parent 52074d239b
commit 7180e01dcf
18 changed files with 162 additions and 55 deletions

View File

@@ -35,8 +35,8 @@ class Auth_OSB extends Auth_ORM {
if (! empty($role)) {
// Get the module details
$module = ORM::factory('module',array('name'=>Request::current()->controller()));
if (! $module->loaded() OR ! $module->status) {
$mo = ORM::factory('module',array('name'=>Request::current()->controller()));
if (! $mo->loaded() OR ! $mo->status) {
SystemMessage::add(array(
'title'=>'Module is not defined or active in the Database',
'type'=>'warning',
@@ -50,21 +50,21 @@ class Auth_OSB extends Auth_ORM {
$method_name = Request::current()->action();
// Get the method number
$method = ORM::factory('module_method',array('module_id'=>$module->id,'name'=>$method_name));
if (! $method->loaded()) {
$mmo = ORM::factory('module_method',array('module_id'=>$mo->id,'name'=>$method_name));
if (! $mmo->loaded()) {
SystemMessage::add(array(
'title'=>'Method is not defined or active in the Database',
'type'=>'warning',
'body'=>sprintf('Method not defined: %s for %s',Request::current()->action(),$module->name),
'body'=>sprintf('Method not defined: %s for %s',Request::current()->action(),$mo->name),
));
} else {
// If the role has the authorisation to run the method
$group_method = ORM::factory('group_method')
->where('method_id','=',$method->id);
$gmo = ORM::factory('group_method')
->where('method_id','=',$mmo->id);
$roles = '';
foreach ($group_method->find_all() as $gm) {
foreach ($gmo->find_all() as $gm) {
$roles .= ($roles ? '|' : '').$gm->group->name;
$ro = ORM::factory('group', array('name' => $gm->group->name));
@@ -82,7 +82,7 @@ class Auth_OSB extends Auth_ORM {
SystemMessage::add(array(
'title'=>'User is not authorised in Database',
'type'=>'debug',
'body'=>sprintf('Role(s) checked: %s<br/>User: %s</br>Module: %s<br/>Method: %s',$roles,$user->username,$module->name,$method->name),
'body'=>sprintf('Role(s) checked: %s<br/>User: %s</br>Module: %s<br/>Method: %s',$roles,$user->username,$mo->name,$mmo->name),
));
}
}
@@ -199,7 +199,7 @@ class Auth_OSB extends Auth_ORM {
}
// If the passwords match, perform a login
if ($user->has('group', ORM::factory('group', array('name' => 'Registered Users'))) AND $user->password === $password)
if ($user->status AND $user->has_any('group',ORM::factory('group',array('name'=>'Registered Users'))->list_childgrps(TRUE)) AND $user->password === $password)
{
if ($remember === TRUE)
{