/** To retreive the vtiger_tab permissions of the specifed user from the various vtiger_profiles associated with the user
 * @param $userid -- The User Id:: Type Integer
 * @returns  user global permission  array in the following format:
 *     $tabPerrArray=(tabid1=>permission,
 * 			   tabid2=>permission)							);
 */
function getCombinedUserTabsPermissions($userId)
{
    $log = vglobal('log');
    $log->debug("Entering getCombinedUserTabsPermissions(" . $userId . ") method ...");
    $adb = PearDatabase::getInstance();
    $profArr = getUserProfile($userId);
    $no_of_profiles = sizeof($profArr);
    $userTabPerrArr = array();
    $userTabPerrArr = getProfileTabsPermission($profArr[0]);
    if ($no_of_profiles != 1) {
        for ($i = 1; $i < $no_of_profiles; $i++) {
            $tempUserTabPerrArr = getProfileTabsPermission($profArr[$i]);
            foreach ($userTabPerrArr as $tabId => $tabPermission) {
                if ($tabPermission == 1) {
                    $now_permission = $tempUserTabPerrArr[$tabId];
                    if ($now_permission == 0) {
                        $userTabPerrArr[$tabId] = $now_permission;
                    }
                }
            }
        }
    }
    $homeTabid = getTabid('Home');
    if (!array_key_exists($homeTabid, $userTabPerrArr)) {
        $userTabPerrArr[$homeTabid] = 0;
    }
    $log->debug("Exiting getCombinedUserTabsPermissions method ...");
    return $userTabPerrArr;
}
Exemple #2
0
/** To retreive the vtiger_tab permissions of the specifed user from the various vtiger_profiles associated with the user  
 * @param $userid -- The User Id:: Type Integer
 * @returns  user global permission  array in the following format:
 *     $tabPerrArray=(tabid1=>permission,
 *			   tabid2=>permission)							);
 */
function getCombinedUserTabsPermissions($userId)
{
    global $log;
    $log->debug("Entering getCombinedUserTabsPermissions(" . $userId . ") method ...");
    global $adb;
    $profArr = getUserProfile($userId);
    $no_of_profiles = sizeof($profArr);
    $userTabPerrArr = array();
    $userTabPerrArr = getProfileTabsPermission($profArr[0]);
    if ($no_of_profiles != 1) {
        for ($i = 1; $i < $no_of_profiles; $i++) {
            $tempUserTabPerrArr = getProfileTabsPermission($profArr[$i]);
            foreach ($userTabPerrArr as $tabId => $tabPermission) {
                if ($tabPermission == 1) {
                    $now_permission = $tempUserTabPerrArr[$tabId];
                    if ($now_permission == 0) {
                        $userTabPerrArr[$tabId] = $now_permission;
                    }
                }
            }
        }
    }
    $log->debug("Exiting getCombinedUserTabsPermissions method ...");
    return $userTabPerrArr;
}