今天遇到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. 2016级萌新选拔赛BE题

    #include<bits/stdc++.h> using namespace std; #define ll long long ll a[]; ll d[]; int main() { ...

  2. Partition(线段树的离线处理)

    有一点类似区间K值的求法. 这里有两颗树,一个是自己建的线段树,一个是题目中给定的树.以线段树和树进行区分. 首先离散化一下,以离散化后的结果建线段树,线段树的节点开了2维,一维保存当前以当前节点为权 ...

  3. ubuntu下sublime屏蔽alt键显示顶部菜单栏

    在sulime下喜欢把方向键映的上下左右映射为alt+i/k/j/l ,按单词移动alt+h/; 但是在ubuntu下按alt会弹出sublime的顶部菜单栏,如果想屏蔽sublime按alt屏蔽菜单 ...

  4. apache关联php

    LoadModule php5_module "D:/softs/php/php5apache2_2.dll" AddType application/x-httpd-php .p ...

  5. WebService学习之旅(四)Apache Axis2的安装

    一.Axis2简介 Axis2是目前使用较多的WebService引擎,它是Axis1.x的升级版本,不仅支持SOAP1.1和SOAP1.2,而且也提供了对REST风格WebService的支持. A ...

  6. 解决 Cocos2d-x 3.2 error C1041: 无法打开程序数据库vc120.pdb

    单个项目解决方案 解决方案是为项目添加 /FS (Force Synchronous PDB Writes) 编译选项,具体位置在: 一劳永逸的解决方案 直接修改cocos的项目模板templates ...

  7. iOS 画圆图片的几种方法

    方法一: self.cycleImv= [[UIImageView alloc]initWithFrame:CGRectMake(100, 100, 50, 50)]; [self.view addS ...

  8. mysqlsla安装和使用介绍

    安装mysqlsla源码路径:https://github.com/daniel-nichter/hackmysql.com源码存放路径:/usr/local/src1.获取源码如果没有git命令,请 ...

  9. (一)SpringMVC之警告: No mapping found for HTTP request with URI

    这个警告往往是因为url路径不正确. 所以从三个地方下手: 1.springmvc-config.xml中的配置handle,看看是不是因为handle没有配置导致的. 2.如果是使用注解的方式的话, ...

  10. 使用JDK自带的工具jstack找出造成运行程序死锁的原因

    Java多线程编程也是Java面试中经常考察的内容.刚接触Java多线程编程的朋友们,可能会不慎写出一些会导致死锁(deadlock)的应用出来.如何分析造成Java多线程的原因呢?很多时候我们在怀疑 ...