package lingtao.net.util;

import org.apache.shiro.SecurityUtils;

import lingtao.net.bean.SysUser;

public class PublicMethods {

	// 是否有【超管】或者【组长】身份
	public boolean isSuperOrManager() {
		SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
		String role = user.getRole();
		boolean flag = false;
		if (role.contains(",")) {
			String[] split = role.split(",");
			for (int i = 0; i < split.length; i++) {
				if ("1011".equals(split[i]) || "1".equals(split[i])) {
					flag = true;
					break;
				}
			}
		} else {
			if ("1011".equals(role) || "1".equals(role)) {
				flag = true;
			}
		}
		return flag;
	}

	// 是否有【超管】身份
	public boolean isSuper() {
		SysUser user = (SysUser) SecurityUtils.getSubject().getPrincipal();
		String role = user.getRole();
		boolean flag = false;
		if (role.contains(",")) {
			String[] split = role.split(",");
			for (int i = 0; i < split.length; i++) {
				if ("1".equals(split[i]) || "2".equals(split[i])) {
					flag = true;
					break;
				}
			}
		} else {
			if ("1".equals(role) || "2".equals(role)) {
				flag = true;
			}
		}
		return flag;
	}

}
