今天遇到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. selenium登录 京东滑动验证码

    京东的滑动验证码在页面上是没有原图的,所有我是用ps把他们拼成一个的. from selenium import webdriver from selenium.webdriver import Ac ...

  2. csu 1551: Longest Increasing Subsequence Again BIT + 思维

    预处理last[i]表示以第i个开始,的合法后缀. pre[i]表示以第i个结尾,的合法前缀. 那么每一个数a[i],肯定是一个合法后缀last[i] + 一个合法前缀,那么合法前缀的数字要小于a[i ...

  3. C. Hamburgers

    Polycarpus loves hamburgers very much. He especially adores the hamburgers he makes with his own han ...

  4. git与GitHub(一)

    相信,很多初入前端者都会对git以及GitHub不太了解,而我当时也经历过各种面试大关,也都会问:你了解git和GitHub吗?那么今天先来说一说git. 那么什么是git? (以下转载自廖雪峰老师的 ...

  5. Android 麦克风录音带音量大小动态显示的圆形自定义View

    1.所谓无图无真相,先上效果图.我们要实现的就是中间那个录音的按钮,周边会显示一圈音量大小的波形 2.VolumCircleBar继承自View,我们进行了自定义,代码如下 package com.r ...

  6. Android项目中包名的修改

    通常修改包名时会造成R文件错误,并且有时带有原因不明的Manifest文件中多处文本混乱. 所以,将目前认为最为简洁方便的修改包名流程记录如下: 假设我们目前的包名为com.pepper.util,我 ...

  7. IOS之网络状态设和NSUserDefaults的synchronize

    #pragma mark - check net status int apiCheckNetStatus() { Reachability *reachNet = [Reachability rea ...

  8. InitialContext与lookup

    Context initial = new InitialContext(); Object objref = initial.lookup("java:comp/env/ejb/Simpl ...

  9. spark 的RDD各种转换和动作

    今天先把spark的各种基本转换和动作总结下,以后有时间把各种用法放上去. 1 RDD基本转换操作    map.flagMap.distinct coalesce.repartition coale ...

  10. ObjectiveC中的赋值,对象拷贝,浅拷贝与深拷贝

    在开发过程中我们经常会遇到对象拷贝的问题,下面我们分别讨论赋值操作.对象拷贝.以及浅拷贝(Shallow copy)与深拷贝(Deep copy)的区别与各自的实现方式. 一.不同对象的赋值操作 Ob ...