Commit 1c065309 by 宁成龙

权限

parent 90dc982d
......@@ -45,7 +45,6 @@ class AssignUserHandle extends Form implements LazyRenderable
$adminUser = "userId";
$nowSaleId = getAdminUserId();
$role = PermService::getUserRoles($nowSaleId);
return $query;
if ($nowSaleId == 1000) {
return $query;
}
......
......@@ -45,10 +45,6 @@ class TransferUserHandle extends Form implements LazyRenderable
$adminUser = "userId";
$nowSaleId = getAdminUserId();
$role = PermService::getUserRoles($nowSaleId);
return $query;
if ($nowSaleId == 1000 || $role[0] == PermService::ROLE_SALE_DIRECTOR) {
return $query;
}
......
......@@ -30,14 +30,20 @@ class PermService
const ROLE_NULL = 0; // 未设置角色
static $role_name_map = [
self::ROLE_ADMIN => "管理员",
self::ROLE_SALE => "销售",
self::ROLE_SALE_LEADER => "销售经理",
self::ROLE_SALE_DIRECTOR => "销售总监",
self::ROLE_NULL => "未设置角色",
];
// 获取当前用户角色
public static function getUserRoles($uid = 0, $email = "")
{
$admin = request()->get("user");
$uid = $uid ?: $admin->userId;
$email = $email ?: $admin->email;
// dump($uid);
// dump($email);
// 如果是管理员邮箱,直接返回管理员角色
if ($email == 'admin@ichunt.com') {
return [self::ROLE_ADMIN];
......@@ -83,6 +89,7 @@ class PermService
return $role_list;
}
// 获取用户所有权限
public static function getUserPerms()
{
......@@ -136,7 +143,6 @@ class PermService
}
// 获取系统信息
public static function getBusinessInfo()
{
......@@ -144,7 +150,6 @@ class PermService
}
// 获取指定用户下级所有人员
public static function getSubUserId($userId)
{
......
......@@ -23,8 +23,8 @@ class CmsUserPermModel extends Model
public static function getUserPermByUidAndBid($uid, $bid)
{
dump($uid);
dump($bid);
// dump($uid);
// dump($bid);
$res = self::where(["userId" => $uid, "bid" => $bid])->first();
return ($res) ? $res->toArray() : [];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment