public static function check_condit_priv($uinfo, $priv, $model_name, $notice) { global $_lang; $uid = $uinfo['uid']; $item_list = keke_auth_base_class::get_auth_item('', 'auth_code,auth_open,auth_title'); $condition = array_filter(explode(",", $priv['condit'])); $priv_return = array("pass" => true, "notice" => $notice); if ($uid) { if (empty($condition)) { return $priv_return; } else { $priv_return['notice'] .= "。" . $model_name . $_lang['need_pass']; $i = 0; foreach ($condition as $k => $v) { if ($item_list[$v] && $item_list[$v]['auth_open'] == '1') { $pass = keke_auth_fac_class::auth_check($v, $uid); if (!$pass) { if ($v == 'realname' || $v == 'enterprise') { $i++; if ($i == 2) { $priv_return['pass'] = false; $priv_return['notice'] .= "实名或企业认证,"; } } else { $priv_return['pass'] = false; $priv_return['notice'] .= $item_list[$v]['auth_title'] . ","; } } } } } } else { $priv_return['pass'] = false; $priv_return['notice'] = $_lang['user_not_login']; } return $priv_return; }
$identy_auth_info = kekezu::get_table_data('auth_code,auth_status', 'witkey_auth_record', "uid=" . $gUid, '', '', '', 'auth_code'); if ($intUserRole === 2) { $strCodeWh = " auth_code!='realname' "; $intAuthStatus = keke_auth_fac_class::auth_check('enterprise', $gUid); if ($intUserRole && !$intAuthStatus) { $intAuthStatus = 1; } } else { $strCodeWh = " auth_code!='enterprise' "; $intAuthStatus = keke_auth_fac_class::auth_check('realname', $gUid); if ($intUserRole && !$intAuthStatus) { $intAuthStatus = 1; } } $arrAuthItems = keke_auth_base_class::get_auth_item(null, null, 1, $strCodeWh); $arrAllAuthItems = keke_auth_base_class::get_auth_item(null, null, 1, null); $keys = array_keys($arrAuthItems); $arrAllowAuth = array('realname', 'enterprise', 'bank', 'mobile', 'email', 'alipayjs'); if ($code && in_array($code, $arrAllowAuth)) { $code or $code = $keys['0']; $code or kekezu::show_msg($_lang['param_error'], "index.php?do=auth", 3, '', 'warning'); $auth_class = "keke_auth_" . $code . "_class"; $objAuth = new $auth_class($code); $auth_item = $arrAllAuthItems[$code]; $auth_dir = $auth_item['auth_dir']; $arrAuthInfo = $objAuth->get_user_auth_info($gUid, 0, $intBankAid); require S_ROOT . "/auth/{$code}/control/index.php"; require keke_tpl_class::template('auth/' . $code . '/tpl/' . $_K['template'] . '/' . $step); die; } else { $real_pass = keke_auth_fac_class::auth_check('enterprise', $gUid) or $real_pass = keke_auth_fac_class::auth_check("realname", $gUid);
public function __construct($code = 'mobile') { parent::__construct($code); $this->_primary_key = 'mobile_a_id'; $this->_tab_obj = keke_table_class::get_instance($this->_auth_table_name); }
public static function get_auth($user_info) { $auth_item = keke_auth_base_class::get_auth_item(); $auth_temp = array_keys($auth_item); $user_info['user_type'] == 2 and $un_code = 'realname' or $un_code = "enterprise"; $t = implode(",", $auth_temp); $auth_info = db_factory::query(" select a.auth_code,a.auth_status,b.auth_title,b.auth_small_ico,b.auth_small_n_ico from " . TABLEPRE . "witkey_auth_record a left join " . TABLEPRE . "witkey_auth_item b on a.auth_code=b.auth_code where a.uid ='" . $user_info['uid'] . "' and FIND_IN_SET(a.auth_code,'{$t}')", 1, -1); $auth_info = kekezu::get_arr_by_key($auth_info, "auth_code"); return array('item' => $auth_item, 'info' => $auth_info, 'code' => $un_code); }
<?php defined('ADMIN_KEKE') or exit('Access Denied'); keke_lang_class::package_init("auth"); keke_lang_class::loadlang("{$do}_{$view}"); $views = array('item_list', 'info', 'list', 'item_edit'); $view = !empty($view) && in_array($view, $views) ? $view : 'item_list'; if (file_exists(ADMIN_ROOT . 'admin_' . $do . '_' . $view . '.php')) { keke_lang_class::package_init("auth"); keke_lang_class::loadlang("admin_{$view}"); if (!$auth_dir) { $auth_item_list = keke_auth_base_class::get_auth_item(); $keys = array_keys($auth_item_list); $code or $code = $keys['0']; if ($view != 'item_list') { if ($auth_item_list[$code]) { $auth_class = "keke_auth_" . $code . "_class"; $auth_obj = new $auth_class($code); $auth_item = $auth_item_list[$code]; $auth_dir = $auth_item['auth_dir']; keke_lang_class::loadlang($auth_dir); } else { kekezu::show_msg($_lang['illegal_parameter_or_authmadel_delete'], "index.php?do=auth&view=item_list", 3, '', 'warning'); } } } require ADMIN_ROOT . 'admin_' . $do . '_' . $view . '.php'; } else { kekezu::admin_show_msg($_lang['404_page'], '', 3, '', 'warning'); }
<?php defined('ADMIN_KEKE') or exit('Access Denied'); $model_id or kekezu::admin_show_msg($_lang['error_model_param'], "index.php?do=info", 3, '', 'warning'); $op_code or kekezu::admin_show_msg($_lang['error_rights_project'], "index.php?do=info", 3, '', 'warning'); $model_info = $kekezu->_model_list[$model_id]; !$model_info['model_status'] and header("location:index.php?do=config&view=model&model_id={$model_id}"); $permission_class_name = $model_info['model_dir'] . "_permission_class"; switch (isset($sbt_action)) { case "0": $auth_item = keke_auth_base_class::get_auth_item(null, "auth_code,auth_title"); $perm_rule = keke_privission_class::get_model_priv_item($model_id, $op_code, 'op_id,op_code,condit,op_name,allow_times', 'op_code'); $intOpId = intval($perm_rule[$op_code]['op_id']); $perm_item = keke_privission_class::get_priv_item($model_id); break; case "1": if ($sbt_action) { $perm_item_obj = new Keke_witkey_priv_item_class(); $perm_item_obj->setWhere(" op_id = '" . $fds['op_id'] . "'"); isset($fds['condit']) or $fds['condit'] = array(); $perm_item_obj->setCondit(implode(",", $fds['condit'])); $perm_item_obj->setAllow_times($fds['allow_times']); $perm_item_obj->edit_keke_witkey_priv_item(); $perm_rule_obj = new Keke_witkey_priv_rule_class(); if ($fds['rule']) { foreach ($fds['rule'] as $k => $v) { $perm_rule_obj->setWhere(" r_id = '{$k}'"); $v != 1 and $perm_rule_obj->setRule(intval($fds['rule'][$k])); $v == 1 and $perm_rule_obj->setRule(intval($fds['times'][$k])); $perm_rule_obj->edit_keke_witkey_priv_rule(); }