public function allot() { $username = $_GET['user']; $user_id = $_GET['user_id']; $uinfo = mod_member::get_oneamdinbyuser_id($user_id); if ($uinfo['user_name'] != $username) { mod_login::message('对不起,非法操作'); } if ($_POST['submit']) { $sright = r_serialize(forrightserialize($_POST['action_code'])); mod_member::saverights($sright, $user_id); mod_login::message('权限赋予成功'); } else { $rightlist = mod_menu::get_user_action(); $haveright = mod_member::get_right($user_id); $role['action_list'] = forunrightserialize(r_unserialize($haveright)); pm_tpl::assign('priv_arr', $rightlist); pm_tpl::assign('role', $role); pm_tpl::assign('uinfo', $uinfo); pm_tpl::assign('ur_here', '分派权限'); $action_link = array('href' => '?c=member&a=member_list', 'text' => '管理员列表'); pm_tpl::assign('action_link', $action_link); pm_tpl::display('member_allot'); } }
public static function member_save_role($user_id, $role_id, $role_rights) { $memberinfo = self::get_oneamdinbyuser_id($user_id); $rights = $memberinfo['rights']; $rights = forunrightserialize(r_unserialize($rights)); $roles_right = forunrightserialize(r_unserialize($role_rights)); $newright = array_merge($rights, $roles_right); $newright = r_serialize(forrightserialize($newright)); pm_db::query("UPDATE iosadm_admin_user SET role_id={$role_id},rights='{$newright}' WHERE user_id={$user_id}"); }