今天遇到hibernate.find就会进行权限配置,如果某处想要跳过权限配置,则可以如下

ThreadLocalClient.get().envParamMap.put(DataAuthority.IS_APPLY_AUTHORITY, false);

所有ThreadLocalClient都在下面配置

package com.huatek.framework.security;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set; import com.huatek.framework.entity.FwAccount;
import com.huatek.framework.entity.FwActionCnt;
import com.huatek.framework.entity.FwGroup;
import com.huatek.framework.entity.FwSrcAction; public class ClientInfoBean implements Serializable { /**
*
*/
private static final long serialVersionUID = 8810206692236045600L; private String actionURL; private String actionMethod; private String contextPath; private String serverHost; private int serverPort; private Calendar accessCalendar; private String actionId; private String hostIp; private int hostPort; private Long menuId; private boolean isLogged; private String requestMethod; public Map<String,Object> envParamMap = new HashMap<String,Object>(); public String getRequestMethod() {
return requestMethod;
} public void setRequestMethod(String requestMethod) {
this.requestMethod = requestMethod;
} public Long getMenuId() {
return menuId;
} public void setMenuId(Long menuId) {
this.menuId = menuId;
} private Long operationGroupId; private List<FwGroup> permitGroup; private List<FwSrcAction> permitAction; public List<FwSrcAction> getPermitAction() {
return permitAction;
} public void setPermitAction(List<FwSrcAction> permitAction) {
this.permitAction = permitAction;
} public List<FwGroup> getPermitGroup() {
return permitGroup;
} public void setPermitGroup(List<FwGroup> permitGroup) {
this.permitGroup = permitGroup;
} public Long getOperationGroupId() {
return operationGroupId;
} public void setOperationGroupId(Long operationGroupId) {
this.operationGroupId = operationGroupId;
} private FwAccount operator; private Set<FwActionCnt> auditContents; public Set<FwActionCnt> getAuditContents() {
return auditContents;
} public void setAuditContents(Set<FwActionCnt> auditContents) {
this.auditContents = auditContents;
} private String actualActionPath; public String getActualActionPath() {
return actualActionPath;
} public void setActualActionPath(String actualActionPath) {
this.actualActionPath = actualActionPath;
} public FwAccount getOperator() {
return operator;
} public void setOperator(FwAccount operator) {
this.operator = operator;
} private FwSrcAction srcAction; public FwSrcAction getSrcAction() {
return srcAction;
} public void setSrcAction(FwSrcAction srcAction) {
this.srcAction = srcAction;
} public int getHostPort() {
return hostPort;
} public void setHostPort(int hostPort) {
this.hostPort = hostPort;
} public Calendar getAccessCalendar() {
return accessCalendar;
} public void setAccessCalendar(Calendar accessCalendar) {
this.accessCalendar = accessCalendar;
} public String getActionId() {
return actionId;
} public void setActionId(String actionId) {
this.actionId = actionId;
} public String getActionURL() {
return actionURL;
} public void setActionURL(String actionName) {
this.actionURL = actionName;
} public String getHostIp() {
return hostIp;
} public void setHostIp(String hostIp) {
this.hostIp = hostIp;
} public String toString() { /*SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-DD hh:mm:ss");*/
Date time = accessCalendar.getInstance().getTime();
if(time==null){
time = new Date();
}
return "actionURL=" + this.actionURL + "\n" + "accessCalendar="
+ time + "\n"
+ "actionId=" + this.actionId + "\n"
+ "hostIp=" + this.hostIp;
} public String getActionMethod() {
return actionMethod;
} public void setActionMethod(String actionMethod) {
this.actionMethod = actionMethod;
} public String getContextPath() {
return contextPath;
} public void setContextPath(String contextPath) {
this.contextPath = contextPath;
} public int getServerPort() {
return serverPort;
} public void setServerPort(int serverPort) {
this.serverPort = serverPort;
} public String getServerHost() {
return serverHost;
} public void setServerHost(String serverHost) {
this.serverHost = serverHost;
} public boolean isLogged() {
return isLogged;
} public void setLogged(boolean isLogged) {
this.isLogged = isLogged;
} }

根据下面判断当前的账户是否要继续

if(ThreadLocalClient.get().envParamMap.get(DataAuthority.IS_APPLY_AUTHORITY)!=null&&
ThreadLocalClient.get().envParamMap.get(DataAuthority.IS_APPLY_AUTHORITY).equals(false)){
return hsql;
}
if (ThreadLocalClient.get() == null || ThreadLocalClient.get().getOperator()==null
|| ThreadLocalClient.get().getOperator().getId().longValue() == Constant.OPS_ADMIN
.longValue()) {
return hsql;
}

ThreadLocalClient小应用的更多相关文章

  1. 【小程序分享篇 二 】web在线踢人小程序,维持用户只能在一个台电脑持登录状态

    最近离职了, 突然记起来还一个小功能没做, 想想也挺简单,留下代码和思路给同事做个参考. 换工作心里挺忐忑, 对未来也充满了憧憬与担忧.(虽然已是老人, 换了N次工作了,但每次心里都和忐忑). 写写代 ...

  2. 【小程序分享篇 一 】开发了个JAVA小程序, 用于清除内存卡或者U盘里的垃圾文件非常有用

    有一种场景, 手机内存卡空间被用光了,但又不知道哪个文件占用了太大,一个个文件夹去找又太麻烦,所以我开发了个小程序把手机所有文件(包括路径下所有层次子文件夹下的文件)进行一个排序,这样你就可以找出哪个 ...

  3. jQuery实践-网页版2048小游戏

    ▓▓▓▓▓▓ 大致介绍 看了一个实现网页版2048小游戏的视频,觉得能做出自己以前喜欢玩的小游戏很有意思便自己动手试了试,真正的验证了这句话-不要以为你以为的就是你以为的,看视频时觉得看懂了,会写了, ...

  4. 微信小程序开发心得

    微信小程序也已出来有一段时间了,最近写了几款微信小程序项目,今天来说说感受. 首先开发一款微信小程序,最主要的就是针对于公司来运营的,因为,在申请appid(微信小程序ID号)时候,需要填写相关的公司 ...

  5. 前端网络、JavaScript优化以及开发小技巧

    一.网络优化 YSlow有23条规则,中文可以参考这里.这几十条规则最主要是在做消除或减少不必要的网络延迟,将需要传输的数据压缩至最少. 1)合并压缩CSS.JavaScript.图片,静态资源CDN ...

  6. 微信应用号(小程序)开发IDE配置(第一篇)

    2016年9月22日凌晨,微信宣布“小程序”问世,当然只是开始内测了,微信公众平台对200个服务号发送了小程序内测邀请.那么什么是“小程序”呢,来看微信之父怎么说 看完之后,相信大家大概都有些明白了吧 ...

  7. Chrome出了个小bug:论如何在Chrome下劫持原生只读对象

    Chrome出了个小bug:论如何在Chrome下劫持原生只读对象 概述 众所周知,虽然JavaScript是个很灵活的语言,浏览器里很多原生的方法都可以随意覆盖或者重写,比如alert.但是为了保证 ...

  8. TODO:小程序开发过程之体验者

    TODO:小程序开发过程之体验者 1. 小程序开发过程,先下载开发者并安装开发者工具,现在腾讯开放测试了,普通用户也可以登录开发者工具,如图普通用户登录为调试类型,但是只能建立无AppID的项目 如果 ...

  9. TODO:即将开发的第一个小程序

    TODO:即将开发的第一个小程序 微信小程序是一种全新的连接用户与服务的方式,它可以在微信内被便捷地获取和传播,同时具有出色的使用体验.个人理解小程序是寄宿在微信平台上的一个前端框架,具有跨平台功能, ...

随机推荐

  1. linux下svn服务器搭建步骤

    安装步骤如下: 1.yum install subversion 2.输入rpm -ql subversion查看安装位置,如下图:   我们知道svn在bin目录下生成了几个二进制文件. 输入 sv ...

  2. 110 Balanced Binary Tree 平衡二叉树

    给定一个二叉树,确定它是高度平衡的.对于这个问题,一棵高度平衡二叉树的定义是:一棵二叉树中每个节点的两个子树的深度相差不会超过 1.案例 1:给出二叉树 [3,9,20,null,null,15,7] ...

  3. Win10系统特别卡的一个原因

    我遇到的Win10特别卡的原因是它自带的一个杀毒软件 迈克菲(McAfee)导致的,在卸载之前电脑真的特别卡,打开一个窗口都卡,,卸载了之后瞬间感觉电脑飞起来了.... 当然还有很多原因会导致电脑卡, ...

  4. nodejs 学习(1) http与fs

    var http=require("http"), fs=require('fs'); var server=http.createServer(function(req,res) ...

  5. opencart 安装

    1:安装 php5    apache2  mysql 2:下载opencart wget https://github.com/opencart/opencart/archive/master.zi ...

  6. 用Eclipse 开发Dynamic Web Project应用程序

    一.创建Server通过菜单选择File > New > Other>Server,创建Server,如下图所示. 二.创建Dynamic Web Project项目 1.菜单选择F ...

  7. C# 连接 Oracle,读取Blob字段数据,存到文件中去,包括pdf等等

    代码如下,记得引入Oracle的dll using System; using System.Collections.Generic; using System.ComponentModel; usi ...

  8. kafka基础六

    kafka中的高可用HA 1.replication副本 同一个partition会有一个leader和多个副本,这些副本存储的内容与leader相同,可以通过 server.properties 配 ...

  9. 纪念一下我的第一个php扩展

    C扩展代码 生成 so扩展文件( 很多文章介绍 生成so时候 喜欢用 # phpize ./configure ...... 刚开始掉进坑里面出不来 就是因为把这两个命令看成了一个 phpize ./ ...

  10. RSA不对称加密和公钥 私钥

    理论上只要有加密的规则 基本都是可以解密的 但是如果解密需要消耗的时间过长 比如1000年 解密过后已经没什么意义了 此时可认为这种算法不能被破解 也就是说此加密可信 MD5 是一种单向操作 加密后不 ...