Merge branch 'develop' of https://github.com/pandorafms/pandorafms into develop

This commit is contained in:
Vanessa Gil 2015-03-10 11:20:47 +01:00
commit 717d32ecca
2 changed files with 48 additions and 16 deletions

View File

@ -889,6 +889,8 @@ function tags_has_user_acl_tags($id_user = false) {
function tags_get_user_tags($id_user = false, $access = 'AR') { function tags_get_user_tags($id_user = false, $access = 'AR') {
global $config; global $config;
//users_is_strict_acl
if ($id_user === false) { if ($id_user === false) {
$id_user = $config['id_user']; $id_user = $config['id_user'];
} }
@ -900,25 +902,39 @@ function tags_get_user_tags($id_user = false, $access = 'AR') {
// tags restrictions, the user can see all tags // tags restrictions, the user can see all tags
$acl_column = get_acl_column($access); $acl_column = get_acl_column($access);
if(empty($acl_column)) { if (empty($acl_column)) {
return array(); return array();
} }
$query = sprintf("SELECT count(*) $query = sprintf("
FROM tusuario_perfil, tperfil SELECT count(*)
WHERE tperfil.id_perfil = tusuario_perfil.id_perfil AND FROM tusuario_perfil, tperfil
tusuario_perfil.id_usuario = '%s' AND WHERE tperfil.id_perfil = tusuario_perfil.id_perfil
tperfil.%s = 1 AND tags <> ''", AND tusuario_perfil.id_usuario = '%s'
$id_user, $acl_column); AND tperfil.%s = 1
AND tags <> ''",
$id_user, $acl_column);
$profiles_without_tags = db_get_value_sql($query); $profiles_without_tags = db_get_value_sql($query);
if ($profiles_without_tags == 0) { if ($profiles_without_tags == 0) {
return $all_tags; //--------------------------------------------------------------
// FIXED FOR TICKET #1921
//
// If the user is setted with strict ACL, the pandora does not
// show any tags. Thanks Mr. C from T.
//
//--------------------------------------------------------------
if (users_is_strict_acl($id_user)) {
return array();
}
else {
return $all_tags;
}
} }
// Get the tags of the required access flag for each group // Get the tags of the required access flag for each group
$tags = tags_get_acl_tags($id_user, 0, $access, 'data'); $tags = tags_get_acl_tags($id_user, 0, $access, 'data');
// If there are wrong parameters or fail ACL check, return false // If there are wrong parameters or fail ACL check, return false
if ($tags_user === ERR_WRONG_PARAMETERS || $tags_user === ERR_ACL) { if ($tags_user === ERR_WRONG_PARAMETERS || $tags_user === ERR_ACL) {
return array(); return array();
@ -928,7 +944,7 @@ function tags_get_user_tags($id_user = false, $access = 'AR') {
$user_tags_id = array(); $user_tags_id = array();
foreach ($tags as $t) { foreach ($tags as $t) {
if(empty($user_tags_id)) { if (empty($user_tags_id)) {
$user_tags_id = $t; $user_tags_id = $t;
} }
else { else {

View File

@ -21,6 +21,22 @@
require_once($config['homedir'] . "/include/functions_groups.php"); require_once($config['homedir'] . "/include/functions_groups.php");
function users_is_strict_acl($id_user = null) {
global $config;
if (empty($id_user)) {
$id_user = $config['id_user'];
}
$strict_acl = (bool)db_get_value('strict_acl', 'tusuario',
'id_user', $id_user);
html_debug_print($strict_acl, true);
html_debug_print($id_user, true);
return $strict_acl;
}
/** /**
* Get a list of all users in an array [username] => (info) * Get a list of all users in an array [username] => (info)
* *