package com.hz.pm.api.expert.helper;

import com.hz.pm.api.user.model.enumeration.RoleEnum;
import com.hz.pm.api.user.security.model.UserInfoDetails;
import com.hz.pm.api.user.util.LoginUserUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * @author liuxinxin
 * @date 2022/8/18 上午10:02
 * 校验是否一个账号对一个专家有操作的权限
 */
@Component
@RequiredArgsConstructor
public class PermissionCheckHelper {

    public boolean isSuperAdmin() {
        UserInfoDetails details = LoginUserUtil.loginUserDetail();
        return details.getUserRoleList().stream().anyMatch(w -> w.getCode().equals(RoleEnum.SUPER_ADMIN.name()));
    }

}
