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') {
global $config;
//users_is_strict_acl
if ($id_user === false) {
$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
$acl_column = get_acl_column($access);
if(empty($acl_column)) {
if (empty($acl_column)) {
return array();
}
$query = sprintf("SELECT count(*)
FROM tusuario_perfil, tperfil
WHERE tperfil.id_perfil = tusuario_perfil.id_perfil AND
tusuario_perfil.id_usuario = '%s' AND
tperfil.%s = 1 AND tags <> ''",
$id_user, $acl_column);
$query = sprintf("
SELECT count(*)
FROM tusuario_perfil, tperfil
WHERE tperfil.id_perfil = tusuario_perfil.id_perfil
AND tusuario_perfil.id_usuario = '%s'
AND tperfil.%s = 1
AND tags <> ''",
$id_user, $acl_column);
$profiles_without_tags = db_get_value_sql($query);
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
$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 ($tags_user === ERR_WRONG_PARAMETERS || $tags_user === ERR_ACL) {
return array();
@ -928,7 +944,7 @@ function tags_get_user_tags($id_user = false, $access = 'AR') {
$user_tags_id = array();
foreach ($tags as $t) {
if(empty($user_tags_id)) {
if (empty($user_tags_id)) {
$user_tags_id = $t;
}
else {

View File

@ -21,6 +21,22 @@
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)
*