Fixed several bugs in events.
This commit is contained in:
parent
a70fc62af0
commit
af1b7c1f64
|
@ -1578,4 +1578,30 @@ function groups_get_tree(&$groups, $parent = false) {
|
|||
|
||||
return $return;
|
||||
}
|
||||
|
||||
function groups_get_all_hierarchy_group ($id_group, $hierarchy = array(), $debug = false) {
|
||||
global $config;
|
||||
|
||||
$hierarchy[] = $id_group;
|
||||
$parent = db_get_value('parent','tgrupo','id_grupo',$id_group);
|
||||
|
||||
if ($parent !== 0) {
|
||||
$propagate = db_get_value('propagate','tgrupo','id_grupo',$parent);
|
||||
|
||||
if ($propagate == 1) {
|
||||
//$childrens_ids_parent = array($parent);
|
||||
$hierarchy[] = $parent;
|
||||
$childrens = groups_get_childrens($parent);
|
||||
if (!empty($childrens)) {
|
||||
foreach ($childrens as $child) {
|
||||
//$childrens_ids_parent[] = (int)$child['id_grupo'];
|
||||
$hierarchy[] = (int)$child['id_grupo'];
|
||||
}
|
||||
}
|
||||
|
||||
$hierarchy = groups_get_all_hierarchy_group ($parent, $hierarchy);
|
||||
}
|
||||
}
|
||||
return $hierarchy;
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -1229,17 +1229,20 @@ function tags_checks_event_acl($id_user, $id_group, $access, $tags = array(), $c
|
|||
if($id_user === false) {
|
||||
$id_user = $config['id_user'];
|
||||
}
|
||||
|
||||
|
||||
$tags_user = tags_get_acl_tags($id_user, $id_group, $access, 'data', '', '', false, $childrens_ids);
|
||||
|
||||
// If there are wrong parameters or fail ACL check, return false
|
||||
if($tags_user === ERR_WRONG_PARAMETERS || $tags_user === ERR_ACL) {
|
||||
return false;
|
||||
//return false;
|
||||
$return = false;
|
||||
}
|
||||
|
||||
// If there are not tags restrictions or tags passed, return true
|
||||
if(empty($tags_user) || empty($tags)) {
|
||||
//if(empty($tags_user) || empty($tags)) {
|
||||
if(empty($tags_user)) {
|
||||
return true;
|
||||
//$return = true;
|
||||
}
|
||||
|
||||
$tags_user_ids = array();
|
||||
|
@ -1252,9 +1255,38 @@ function tags_checks_event_acl($id_user, $id_group, $access, $tags = array(), $c
|
|||
$tag_id = tags_get_id($tag);
|
||||
if (in_array($tag_id, $tags_user_ids)) { //check tag
|
||||
return true;
|
||||
//$return = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
//return false;
|
||||
$return = false;
|
||||
|
||||
if ($return == false) {
|
||||
|
||||
$parent = db_get_value('parent','tgrupo','id_grupo',$id_group);
|
||||
|
||||
if ($parent !== 0) {
|
||||
$propagate = db_get_value('propagate','tgrupo','id_grupo',$parent);
|
||||
|
||||
if ($propagate == 1) {
|
||||
|
||||
$childrens_ids_parent = array($parent);
|
||||
|
||||
$childrens = groups_get_childrens($parent);
|
||||
|
||||
if (!empty($childrens)) {
|
||||
foreach ($childrens as $child) {
|
||||
$childrens_ids_parent[] = (int)$child['id_grupo'];
|
||||
}
|
||||
}
|
||||
//$acl_parent = tags_check_acl_event($id_user, $parent, $access, $tags,$p);
|
||||
$acl_parent = tags_checks_event_acl($id_user, $parent, $access, $tags, $childrens_ids_parent);
|
||||
return $acl_parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -202,7 +202,13 @@ else {
|
|||
$group_array = array_keys($groups);
|
||||
}
|
||||
|
||||
$tags_acls_condition = tags_get_acl_tags($id_user, $group_array, 'ER', 'event_condition', 'AND', '', $meta);
|
||||
//$tags_acls_condition = tags_get_acl_tags($id_user, $group_array, 'ER', 'event_condition', 'AND', '', $meta);
|
||||
if ($id_group == 0) {
|
||||
$hierarchy = array_keys($groups);
|
||||
} else {
|
||||
$hierarchy = groups_get_all_hierarchy_group ($id_group, array(), true);
|
||||
}
|
||||
$tags_acls_condition = tags_get_acl_tags($id_user, $group_array, 'ER', 'event_condition', 'AND', '', $meta, $hierarchy, true);
|
||||
|
||||
if (($tags_acls_condition != ERR_WRONG_PARAMETERS) && ($tags_acls_condition != ERR_ACL)&& ($tags_acls_condition != -110000)) {
|
||||
$sql_post .= $tags_acls_condition;
|
||||
|
|
Loading…
Reference in New Issue