`
yongtree
  • 浏览: 231082 次
  • 性别: Icon_minigender_1
  • 来自: 青岛
社区版块
存档分类
最新评论
收藏列表
标题 标签 来源
Java的单操作权限判断的代码 一个比较专业的权限控制思路
//userPurview是用户具有的总权限
//optPurview是一个操作要求的权限为一个整数(没有经过权的!)
public static boolean checkPower(int userPurview, int optPurview) {
  int purviewValue = (int)Math.pow(2, optPurview);
  return (userPurview & purviewValue) == purviewValue;
}

Global site tag (gtag.js) - Google Analytics