package com.engine.organization.util;

import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;

/**
 * @description:
 * @author:dxfeng
 * @createTime: 2022/06/07
 * @version: 1.0
 */
public class HasRightUtil {

    /**
     * 判断是否拥有对应权限
     *
     * @param user
     * @param rightName
     * @param isReturnFalse
     * @return
     */
    public static boolean hasRight(User user, String rightName, boolean isReturnFalse) {
        boolean hasRight = HrmUserVarify.checkUserRight(rightName, user);
        if (!isReturnFalse) {
            OrganizationAssert.isTrue(hasRight, "暂无权限访问");
        }
        return hasRight;
    }
}
