Browse Source

Merge pull request #55 from REJack/master

fix for #51 'is_allowed() bug'
develop
Emre Akay 10 years ago
parent
commit
e224ee336b
  1. 23
      application/libraries/Aauth.php
  2. 6
      sql/Aauth_v2.sql

23
application/libraries/Aauth.php

@ -397,7 +397,7 @@ class Aauth {
}
}
}else{
if(!$this->CI->session->has_userdata('remember')){
if(!isset($_SESSION['remember'])){
return FALSE;
}else{
$session = explode('-', $this->CI->session->userdata('remember'));
@ -1473,12 +1473,19 @@ class Aauth {
if( $query->num_rows() > 0){
return TRUE;
} elseif ($this->is_group_allowed($perm_id)) {
return TRUE;
} else {
return FALSE;
if( $user_id===FALSE){
return $this->is_group_allowed($perm_id);
} else {
$g_allowed=FALSE;
foreach( $this->get_user_groups($user_id) as $group ){
if ( $this->is_group_allowed($perm_id, $group->id) ){
$g_allowed=TRUE;
}
}
return $g_allowed;
}
}
}
/**
@ -1707,7 +1714,7 @@ class Aauth {
'receiver_id' => $receiver_id,
'title' => $title,
'message' => $message,
'date' => date('Y-m-d H:i:s')
'date_sent' => date('Y-m-d H:i:s')
);
return $query = $this->aauth_db->insert( $this->config_vars['pms'], $data );
@ -1789,7 +1796,7 @@ class Aauth {
}
$query = $this->aauth_db->where('receiver_id', $receiver_id);
$query = $this->aauth_db->where('read', 0);
$query = $this->aauth_db->where('date_read', NULL);
$query = $this->aauth_db->get( $this->config_vars['pms'] );
return $query->num_rows();
@ -1804,7 +1811,7 @@ class Aauth {
public function set_as_read_pm($pm_id){
$data = array(
'read' => 1,
'date_read' => date('Y-m-d H:i:s')
);
$this->aauth_db->update( $this->config_vars['pms'], $data, "id = $pm_id");

6
sql/Aauth_v2.sql

@ -75,8 +75,8 @@ CREATE TABLE `aauth_pms` (
`receiver_id` int(11) unsigned NOT NULL,
`title` varchar(255) NOT NULL,
`message` text,
`date` datetime DEFAULT NULL,
`read` tinyint(1) DEFAULT '0',
`date_sent` datetime DEFAULT NULL,
`date_read` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `full_index` (`id`,`sender_id`,`receiver_id`,`read`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@ -126,7 +126,7 @@ CREATE TABLE `aauth_users` (
-- ----------------------------
-- Records of aauth_users
-- ----------------------------
INSERT INTO `aauth_users` VALUES ('1', 'admin@example.com', 'dd5073c93fb477a167fd69072e95455834acd93df8fed41a2c468c45b394bfe3', 'Admin', '0', null, null, null, null, null, null, null, null, '0');
INSERT INTO `aauth_users` VALUES ('1', 'admin@example.com', 'dd5073c93fb477a167fd69072e95455834acd93df8fed41a2c468c45b394bfe3', 'Admin', '0', null, null, null, null, null, null, null, null, null, '0');
-- ----------------------------
-- Table structure for `aauth_user_to_group`

Loading…
Cancel
Save