当前位置: 首页>>代码示例>>PHP>>正文


PHP get_user_module_list函数代码示例

本文整理汇总了PHP中get_user_module_list函数的典型用法代码示例。如果您正苦于以下问题:PHP get_user_module_list函数的具体用法?PHP get_user_module_list怎么用?PHP get_user_module_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_user_module_list函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: check_modules_access

 function check_modules_access($user, $module_name, $action = 'write')
 {
     if (!isset($_SESSION['avail_modules'])) {
         $_SESSION['avail_modules'] = get_user_module_list($user);
     }
     if (isset($_SESSION['avail_modules'][$module_name])) {
         if ($action == 'write' && $_SESSION['avail_modules'][$module_name] == 'read_only') {
             if (is_admin($user)) {
                 return true;
             }
             return false;
         } elseif ($action == 'write' && strcmp(strtolower($module_name), 'users') == 0 && !$user->isAdminForModule($module_name)) {
             //rrs bug: 46000 - If the client is trying to write to the Users module and is not an admin then we need to stop them
             return false;
         }
         return true;
     }
     return false;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:19,代码来源:SugarWebServiceUtilv4_1.php

示例2: login

/**
 * Log the user into the application
 *
 * @param UserAuth array $user_auth -- Set user_name and password (password needs to be 
 *      in the right encoding for the type of authentication the user is setup for.  For Base 
 *      sugar validation, password is the MD5 sum of the plain text password.
 * @param String $application -- The name of the application you are logging in from.  (Currently unused).
 * @return Array(session_id, error) -- session_id is the id of the session that was 
 *      created.  Error is set if there was any error during creation.
 */
function login($user_auth, $application)
{
    $error = new SoapError();
    $user = new User();
    $user = $user->retrieve_by_string_fields(array('user_name' => $user_auth['user_name'], 'user_hash' => $user_auth['password'], 'deleted' => 0, 'status' => 'Active', 'portal_only' => 0));
    if (!empty($user) && !empty($user->id)) {
        session_start();
        global $current_user;
        $current_user = $user;
        $user->loadPreferences();
        $_SESSION['is_valid_session'] = true;
        $_SESSION['ip_address'] = $_SERVER['REMOTE_ADDR'];
        $_SESSION['user_id'] = $user->id;
        $_SESSION['type'] = 'user';
        $_SESSION['avail_modules'] = get_user_module_list($user);
        login_success();
        return array('id' => session_id(), 'error' => $error);
    }
    $error->set_error('invalid_login');
    return array('id' => -1, 'error' => $error);
}
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:31,代码来源:SoapSugarUsers.php

示例3: login

/**
 * Log the user into the application
 *
 * @param UserAuth array $user_auth -- Set user_name and password (password needs to be
 *      in the right encoding for the type of authentication the user is setup for.  For Base
 *      sugar validation, password is the MD5 sum of the plain text password.
 * @param String $application -- The name of the application you are logging in from.  (Currently unused).
 * @return Array(session_id, error) -- session_id is the id of the session that was
 *      created.  Error is set if there was any error during creation.
 */
function login($user_auth, $application)
{
    global $sugar_config, $system_config;
    $error = new SoapError();
    $user = new User();
    $success = false;
    //rrs
    $system_config = new Administration();
    $system_config->retrieveSettings('system');
    $authController = new AuthenticationController(!empty($sugar_config['authenticationClass']) ? $sugar_config['authenticationClass'] : 'SugarAuthenticate');
    //rrs
    $isLoginSuccess = $authController->login($user_auth['user_name'], $user_auth['password'], array('passwordEncrypted' => true));
    $usr_id = $user->retrieve_user_id($user_auth['user_name']);
    if ($usr_id) {
        $user->retrieve($usr_id);
    }
    if ($isLoginSuccess) {
        if ($_SESSION['hasExpiredPassword'] == '1') {
            $error->set_error('password_expired');
            $GLOBALS['log']->fatal('password expired for user ' . $user_auth['user_name']);
            LogicHook::initialize();
            $GLOBALS['logic_hook']->call_custom_logic('Users', 'login_failed');
            return array('id' => -1, 'error' => $error);
        }
        // if
        if (!empty($user) && !empty($user->id) && !$user->is_group) {
            $success = true;
            global $current_user;
            $current_user = $user;
        }
        // if
    } else {
        if ($usr_id && isset($user->user_name) && $user->getPreference('lockout') == '1') {
            $error->set_error('lockout_reached');
            $GLOBALS['log']->fatal('Lockout reached for user ' . $user_auth['user_name']);
            LogicHook::initialize();
            $GLOBALS['logic_hook']->call_custom_logic('Users', 'login_failed');
            return array('id' => -1, 'error' => $error);
        } else {
            if (function_exists('mcrypt_cbc')) {
                $password = decrypt_string($user_auth['password']);
                $authController = new AuthenticationController(!empty($sugar_config['authenticationClass']) ? $sugar_config['authenticationClass'] : 'SugarAuthenticate');
                if ($authController->login($user_auth['user_name'], $password) && isset($_SESSION['authenticated_user_id'])) {
                    $success = true;
                }
                // if
            }
        }
    }
    // else if
    if ($success) {
        session_start();
        global $current_user;
        //$current_user = $user;
        login_success();
        $current_user->loadPreferences();
        $_SESSION['is_valid_session'] = true;
        $_SESSION['ip_address'] = query_client_ip();
        $_SESSION['user_id'] = $current_user->id;
        $_SESSION['type'] = 'user';
        $_SESSION['avail_modules'] = get_user_module_list($current_user);
        $_SESSION['authenticated_user_id'] = $current_user->id;
        $_SESSION['unique_key'] = $sugar_config['unique_key'];
        $current_user->call_custom_logic('after_login');
        return array('id' => session_id(), 'error' => $error);
    }
    $error->set_error('invalid_login');
    $GLOBALS['log']->fatal('SECURITY: User authentication for ' . $user_auth['user_name'] . ' failed');
    LogicHook::initialize();
    $GLOBALS['logic_hook']->call_custom_logic('Users', 'login_failed');
    return array('id' => -1, 'error' => $error);
}
开发者ID:sunmo,项目名称:snowlotus,代码行数:82,代码来源:SoapSugarUsers.php

示例4: check_modules_access

function check_modules_access($user, $module_name, $action = 'write')
{
    if (!isset($_SESSION['avail_modules'])) {
        $_SESSION['avail_modules'] = get_user_module_list($user);
    }
    if (isset($_SESSION['avail_modules'][$module_name])) {
        if ($action == 'write' && $_SESSION['avail_modules'][$module_name] == 'read_only') {
            if (is_admin($user)) {
                return true;
            }
            return false;
        }
        return true;
    }
    return false;
}
开发者ID:nartnik,项目名称:sugarcrm_test,代码行数:16,代码来源:SoapHelperFunctions.php

示例5: login

/**
 * Log the user into the application
 *
 * @param UserAuth array $user_auth -- Set user_name and password (password needs to be
 *      in the right encoding for the type of authentication the user is setup for.  For Base
 *      sugar validation, password is the MD5 sum of the plain text password.
 * @param String $application -- The name of the application you are logging in from.  (Currently unused).
 * @return Array(session_id, error) -- session_id is the id of the session that was
 *      created.  Error is set if there was any error during creation.
 */
function login($user_auth, $application)
{
    global $sugar_config, $system_config;
    $error = new SoapError();
    $user = new User();
    $success = false;
    //rrs
    $system_config = new Administration();
    $system_config->retrieveSettings('system');
    $authController = new AuthenticationController(!empty($sugar_config['authenticationClass']) ? $sugar_config['authenticationClass'] : 'SugarAuthenticate');
    //rrs
    $user = $user->retrieve_by_string_fields(array('user_name' => $user_auth['user_name'], 'user_hash' => $user_auth['password'], 'deleted' => 0, 'status' => 'Active', 'portal_only' => 0));
    if (!empty($user) && !empty($user->id) && !$user->is_group) {
        $success = true;
        global $current_user;
        $current_user = $user;
    } else {
        if (function_exists('mcrypt_cbc')) {
            $password = decrypt_string($user_auth['password']);
            if ($authController->login($user_auth['user_name'], $password) && isset($_SESSION['authenticated_user_id'])) {
                $success = true;
            }
        }
    }
    if ($success) {
        session_start();
        global $current_user;
        //$current_user = $user;
        login_success();
        $current_user->loadPreferences();
        $_SESSION['is_valid_session'] = true;
        $_SESSION['ip_address'] = query_client_ip();
        $_SESSION['user_id'] = $current_user->id;
        $_SESSION['type'] = 'user';
        $_SESSION['avail_modules'] = get_user_module_list($current_user);
        $_SESSION['authenticated_user_id'] = $current_user->id;
        $_SESSION['unique_key'] = $sugar_config['unique_key'];
        $current_user->call_custom_logic('after_login');
        return array('id' => session_id(), 'error' => $error);
    }
    $error->set_error('invalid_login');
    $GLOBALS['log']->fatal('SECURITY: User authentication for ' . $user_auth['user_name'] . ' failed');
    LogicHook::initialize();
    $GLOBALS['logic_hook']->call_custom_logic('Users', 'login_failed');
    return array('id' => -1, 'error' => $error);
}
开发者ID:nerdystudmuffin,项目名称:dashlet-subpanels,代码行数:56,代码来源:SoapSugarUsers.php

示例6: check_modules_access

 function check_modules_access($user, $module_name, $action = 'write')
 {
     $GLOBALS['log']->info('Begin: SoapHelperWebServices->check_modules_access');
     if (!isset($_SESSION['avail_modules'])) {
         $_SESSION['avail_modules'] = get_user_module_list($user);
     }
     if (isset($_SESSION['avail_modules'][$module_name])) {
         if ($action == 'write' && $_SESSION['avail_modules'][$module_name] == 'read_only') {
             if (is_admin($user)) {
                 $GLOBALS['log']->info('End: SoapHelperWebServices->check_modules_access');
                 return true;
             }
             // if
             $GLOBALS['log']->info('End: SoapHelperWebServices->check_modules_access');
             return false;
         }
         $GLOBALS['log']->info('End: SoapHelperWebServices->check_modules_access');
         return true;
     }
     $GLOBALS['log']->info('End: SoapHelperWebServices->check_modules_access');
     return false;
 }
开发者ID:nerdystudmuffin,项目名称:dashlet-subpanels,代码行数:22,代码来源:SoapHelperWebService.php


注:本文中的get_user_module_list函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。