Fixed the acl tags with groups without tags. Ticket: #1611
This commit is contained in:
parent
badafddc3b
commit
668d029047
|
@ -636,7 +636,10 @@ function tags_get_tags_formatted ($tags_array, $get_url = true) {
|
|||
* @return mixed/string Tag ids
|
||||
*/
|
||||
|
||||
function tags_get_acl_tags($id_user, $id_group, $access = 'AR', $return_mode = 'module_condition', $query_prefix = '', $query_table = '', $meta = false, $childrens_ids = array(), $force_group_and_tag = false) {
|
||||
function tags_get_acl_tags($id_user, $id_group, $access = 'AR',
|
||||
$return_mode = 'module_condition', $query_prefix = '',
|
||||
$query_table = '', $meta = false, $childrens_ids = array(),
|
||||
$force_group_and_tag = false) {
|
||||
|
||||
global $config;
|
||||
|
||||
|
@ -755,14 +758,14 @@ function tags_get_acl_tags($id_user, $id_group, $access = 'AR', $return_mode = '
|
|||
// Return the condition of the tags for tagente_modulo table
|
||||
$condition = tags_get_acl_tags_module_condition($acltags, $query_table);
|
||||
if (!empty($condition)) {
|
||||
return " $query_prefix ".$condition;
|
||||
return " $query_prefix " . $condition;
|
||||
}
|
||||
break;
|
||||
case 'event_condition':
|
||||
// Return the condition of the tags for tevento table
|
||||
$condition = tags_get_acl_tags_event_condition($acltags, $meta, $force_group_and_tag);
|
||||
if(!empty($condition)) {
|
||||
return " $query_prefix "."(".$condition.")";
|
||||
if (!empty($condition)) {
|
||||
return " $query_prefix " . "(" . $condition . ")";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -796,6 +799,10 @@ function tags_get_acl_tags_module_condition($acltags, $modules_table = '') {
|
|||
if ($i == 0)
|
||||
$condition .= ' ( ';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Group condition (The module belongs to an agent of the group X)
|
||||
// Juanma (08/05/2014) Fix: Now group and tag is checked at the same time, before only tag was checked due to a bad condition
|
||||
if (!array_key_exists(0, $acltags)) {
|
||||
|
@ -806,10 +813,20 @@ function tags_get_acl_tags_module_condition($acltags, $modules_table = '') {
|
|||
//Avoid the user profiles with all group access.
|
||||
$group_condition = " 1 = 1 ";
|
||||
}
|
||||
// Tags condition (The module has at least one of the restricted tags)
|
||||
$tags_condition = sprintf('%sid_agente_modulo IN (SELECT id_agente_modulo FROM ttag_module WHERE id_tag IN (%s))', $modules_table, implode(',',$group_tags));
|
||||
|
||||
$condition .= "($group_condition AND \n$tags_condition)\n";
|
||||
|
||||
//When the acl is only group without tags
|
||||
if (empty($group_tags)) {
|
||||
$condition .= "($group_condition)\n";
|
||||
}
|
||||
else {
|
||||
// Tags condition (The module has at least one of the restricted tags)
|
||||
$tags_condition = sprintf('%sid_agente_modulo IN (SELECT id_agente_modulo FROM ttag_module WHERE id_tag IN (%s))', $modules_table, implode(',',$group_tags));
|
||||
|
||||
$condition .= "($group_condition AND \n$tags_condition)\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue