validation stringlengths 16 3.54k | validationType stringclasses 2
values | function stringlengths 49 6.38k | author stringclasses 5
values | context stringclasses 5
values |
|---|---|---|---|---|
// 设置securityManager
shiroFilterFactoryBean.setSecurityManager(securityManager);
// 登录的url
shiroFilterFactoryBean.setLoginUrl("/login");
// 登录成功后跳转的url
shiroFilterFactoryBean.setSuccessUrl("/index");
// 未授权url
shiroFilterFactoryBean.setUnauthorizedUrl("/403");
LinkedHashMap<method*start>... | conventional | @Bean
public ShiroFilterFactoryBean<method*start>org.apache.shiro.spring.web.ShiroFilterFactoryBean<method*end> shiroFilterFactoryBean(SecurityManager<method*start>org.apache.shiro.mgt.SecurityManager<method*end> securityManager) {
ShiroFilterFactoryBean<method*start>org.apache.shiro.spring.web.ShiroFilterFactoryBe... | 万爽 | |
if (!filter) {
if (StringUtils.isNotBlank(request.getParameter("msg"))) {
response.sendRedirect("/login.html?msg=" + request.getParameter("msg"));
} else {
response.sendRedirect("/login.html");
}
} | conventional | @Override
public boolean preHandle(final HttpServletRequest request, final HttpServletResponse response, Object handler) throws Exception {
boolean filter = false;
User user = (User) request.getSession(true).getAttribute(Constants.USER_SESSION_NAME);
if (handler instanceof HandlerMethod) {
HandlerMe... | 万爽 | |
// 如果verifiers为empty,或者传入的weId为空,或者weId不在指定列表中,则无权限获取秘钥数据
if (CollectionUtils.isEmpty(verifiers) || StringUtils.isBlank(weId) || !verifiers.contains(weId)) {
logger.error("[getEncryptKey] no access to get the data, this weid is {}.", weId);
throw new EncodeSuiteException(ErrorCod... | conventional | private String getEncryptKey(EncodeData encodeData, String value) {
if (encodeData.getWeIdAuthentication() == null) {
logger.info("[getEncryptKey] the weid Authentication is null.");
throw new EncodeSuiteException(ErrorCode.ENCRYPT_KEY_NO_PERMISSION);
}
try {
Map<String, Object> keyM... | 万爽 | |
if (loginFlag) {
pjp.proceed<method*start>org.aspectj.lang.ProceedingJoinPoint.proceed<method*end>();
} else {
response.sendRedirect<method*start>javax.servlet.http.HttpServletResponse.sendRedirect<method*end>("/infoManager/login.html");
}
} | conventional | @Around<method*start>org.aspectj.lang.annotation.Around<method*end>("anyMethod()")
public Object<method*start>java.lang.Object<method*end> appsActionMethod(ProceedingJoinPoint<method*start>org.aspectj.lang.ProceedingJoinPoint<method*end> pjp) throws Throwable<method*start>java.lang.Throwable<method*end> {
Object<me... | 万爽 | |
AccessibleObject.checkPermission(); | conventional | @Override
@CallerSensitive
public void setAccessible(boolean flag) {
// 如果需要开启访问权限
if (flag) {
// 获取setAccessible()的调用者所处的类
Class<?> caller = Reflection.getCallerClass();
// 判断caller是否可以访问当前元素(涉及到exports和opens的判断)
checkCanSetAccessible(caller);
}
setAccessible0(flag);
} | 万爽 | |
@AuthInterceptor(InterceptorLevel.USER) | annotation | @ApiOperation(value = "更新文件属性")
@ApiImplicitParams({ @ApiImplicitParam(name = "name", value = "文件名", required = true), @ApiImplicitParam(name = "category", value = "分类名称", required = true), @ApiImplicitParam(name = "tag", value = "文件标签", required = true), @ApiImplicitParam(name = "description", value = "文件描述", required... | 万爽 | |
try {
AuthorizationDecodeEvent decodeEvent = new AuthorizationDecodeEvent(username, password, parameterGetter);
eventPublisher.publishEvent(decodeEvent);
username = decodeEvent.getUsername();
password = decodeEvent.getPassword();
AuthorizationBeforeEvent beforeEvent = new A... | annotation | @SneakyThrows
protected ResponseMessage<org.hswebframework.web.controller.message.ResponseMessage<Map<String, Object>>> doLogin(String username, String password, Map<String, ?> parameter) {
Assert.hasLength(username, "用户名不能为空");
Assert.hasLength(password, "密码不能为空");
AuthorizationFailedEvent.Reason reason = ... | 万爽 | |
// root用户返回所有菜单,防止root账户还需要授权才能访问
if (UserRealm.SUPER_USER.equals(username)) {
return this.resourcesRepository.findAll();
} | conventional | @Override
public Collection<Resources> getUserResources(String username) {
// 找出用户的角色,根据角色查找用户的菜单
// 直接调用shiroService的实现方式,防止使用框架方需要自定义角色获取方式
Set<String> roleNames = shiroService.getUserRoleNames(username);
List<Permission> permissions = permissionRepository.findByRoleNameIn(roleNames);
Map<Long, R... | 万爽 | |
DefaultWebSecurityManager<method*start>org.apache.shiro.web.mgt.DefaultWebSecurityManager<method*end> securityManager = (DefaultWebSecurityManager<method*start>org.apache.shiro.web.mgt.DefaultWebSecurityManager<method*end>) SecurityUtils.getSecurityManager<method*start>org.apache.shiro.SecurityUtils.getSecurityManager<... | conventional | public static void deleteCache(String<method*start>java.lang.String<method*end> username, boolean isRemoveSession) {
// 从缓存中获取Session
Session<method*start>org.apache.shiro.session.Session<method*end> session = null;
Collection<method*start>java.util.Collection<method*end><Session<method*start>org.apache.shi... | 万爽 | |
if (user == null) {
resultMap.put("success", false);
resultMap.put("msg", "请登录管理员");
return resultMap;
} | conventional | @RequestMapping("richtext_img_upload.do")
public Map richtextImgUpload(HttpSession session, @RequestParam(value = "upload_file", required = false) MultipartFile file, HttpServletRequest request, HttpServletResponse response) {
Map resultMap = Maps.newHashMap();
User user = (User) session.getAttribute(Const.CURR... | 万爽 | |
@RequiresPermissions("oss:file:upload") | annotation | @ApiOperation(value = "文件上传", notes = "权限编码(oss:file:upload)")
@PostMapping("/upload")
public JsonResponse upload(@RequestParam(value = "file", required = false) MultipartFile file) throws Exception {
if (file.isEmpty()) {
throw new RRException("上传文件不能为空");
}
// 上传文件
String suffix = file.getOrig... | 万爽 | |
if (client != null && client.getUser() != null) {
Client ret = new Client();
ret.setIp(client.getIp());
ret.setLogindatetime(client.getLogindatetime());
TSUser t = new TSUser();
t.setUserName(client.getUser().getUserName());
t.setRealName(client.getUser().getRealName(... | conventional | public void addClinet(String sessionId, Client client) {
// 当前session会话,保存登录用户信息
ContextHolderUtils.getSession().setAttribute(sessionId, client);
}
| 万爽 | |
// 拦截器.
Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>();
// 配置不会被拦截的链接 顺序判断
filterChainDefinitionMap.put("/static/**", "anon");
// 配置退出 过滤器,其中的具体的退出代码Shiro已经替我们实现了
filterChainDefinitionMap.put("/logout", "logout");
// <!-- 过滤链定义,从上向下顺序执行,一般将/**放在最为下边 -->:这是一个坑呢... | conventional | @Bean
public ShiroFilterFactoryBean shirFilter(SecurityManager securityManager) {
System.out.println("ShiroConfiguration.shirFilter()");
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
shiroFilterFactoryBean.setSecurityManager(securityManager);
// 权限控制map.
// 从数据库获... | 万爽 | |
try {
final Object[] args = new Object[] {};
InvocationContext mfc = new InvocationContext(path, cont, method, args);
WebCtrlFilterManager.INSTANCE.executeWithFilter(mfc, new IMethodCallback() {
public Object run() throws Throwable {
return RuleProxyHelper.invoke... | conventional | public void dohttp(String path, HttpServletRequest req, HttpServletResponse res, String innerPath) throws Throwable {
final AbstractExController cont = object;
cont._init(req, res);
// String mname = req.getParameter(WebDriver.OPERATION_KEY);
String mname = innerPath;
if (StringKit.isNull(mname))
... | 万爽 | |
if (StringTool.isBlank(xxlApiProject.getName())) {
return new ReturnT(ReturnT.FAIL_CODE, "请输入项目名称");
}
if (StringTool.isBlank(xxlApiProject.getBaseUrlProduct())) {
return new ReturnT(ReturnT.FAIL_CODE, "请输入根地址(线上)");
}
if (!hasBizPermission(request, xxlApiProject.getBizId())) {
r... | conventional | @RequestMapping("/update")
@ResponseBody
public ReturnT update(HttpServletRequest request, XxlApiProject xxlApiProject) {
XxlApiProject existProkect = xxlApiProjectDao.load(xxlApiProject.getId());
if (existProkect == null) {
return new ReturnT(ReturnT.FAIL_CODE, "更新失败,项目ID非法");
}
int ret = xxlAp... | 万爽 | |
if (user == null) {
throw new UsernameNotFoundException("Cannot find user by username: " + userName);
} | conventional | @Override
public UserDetails loadUserByUsername(String userName) throws UsernameNotFoundException {
// 先判断登陆用户是否存在
SysUser user = userRepository.findByUserName(userName);
List<SysAuthority> roleList = authorityRepository.findByUserId(user.getId());
List<GrantedAuthority> grantedAuthorities = new A... | 万爽 | |
Boolean<method*start>java.lang.Boolean<method*end> status = authService.domainAuth<method*start>com.asofdate.hauth.service.AuthService.domainAuth<method*end>(request, domainEntity.getDomain_id<method*start>com.asofdate.hauth.entity.DomainEntity.getDomain_id<method*end>(), "w").getStatus<method*start>com.asofdate.hauth.... | conventional | @RequestMapping<method*start>org.springframework.web.bind.annotation.RequestMapping<method*end>(method<method*start>org.springframework.web.bind.annotation.RequestMapping.method<method*end> = RequestMethod.PUT<method*start>org.springframework.web.bind.annotation.RequestMethod.PUT<method*end>)
@ResponseBody<method*start... | 万爽 | |
@RequiresPermissions<method*start>org.apache.shiro.authz.annotation.RequiresPermissions<method*end>("permission:update") | annotation | @ApiOperation<method*start>io.swagger.annotations.ApiOperation<method*end>(value<method*start>io.swagger.annotations.Api.value<method*end> = "更新权限", httpMethod<method*start>io.swagger.annotations.ApiOperation.httpMethod<method*end> = "POST", produces<method*start>io.swagger.annotations.ApiOperation.produces<method*end>... | 万爽 | |
if (StrUtil.isEmpty(authorizeToken)) {
return;
}
if (authorizeToken.length() < 6) {
DefaultSystemLog.getLog().error("", new JpomRuntimeException("配置的授权token长度小于六位不生效"));
System.exit(-1);
}
int password = CheckPassword.checkPassword(authorizeToken);
if (password != 2) {
... | conventional | @PreLoadMethod
private static void check() {
String authorizeToken = ServerExtConfigBean.getInstance().getAuthorizeToken();
} | 肖敬先 | |
badzk.addAuthInfo(authentication_type, badAuthentication.getBytes());
if (stat != null) | conventional | static void deleteNodeByBadAuthentication() throws Exception {
String prefix = "[使用错误的授权信息]";
try {
System.out.println(prefix + "删除节点:" + PATH_DEL);
ZooKeeper badzk = new ZooKeeper(CONNECT_ADDR, 2000, null);
Thread.sleep(2000);
Stat stat = badzk.exists(PATH_DEL, false);
... | 肖敬先 | |
if (!isStatAccessPermissionSet<method*start>experment.zju.statistics.MainActivity.isStatAccessPermissionSet<method*end>(MainActivity.this)) {
// 查看是否为应用设置了权限
startActivity<method*start>android.support.v7.app.AppCompatActivity.startActivity<method*end>(new Intent<method*start>andr... | conventional | @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = (Button) findViewById(R.id.OpenButton);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View vi... | 肖敬先 | |
if (adminId.equals(1L)) {
authRules.add("admin");
return authRules;
}
| conventional | @Override
public List<String> listRuleByAdminId(Long adminId) {
List<String> authRules = new ArrayList<>();
// 如果存在,先从缓存中获取权限
String aarKey = String.format(CacheConstant.ADMIN_AUTH_RULES, adminId);
if (CacheUtils.hasKey(aarKey)) {
return new ArrayList<>(CacheUtils.sGetMembers(aarKey));
... | 肖敬先 | |
if (isVerification(request, handler, token)) {
return true;
} | conventional | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
if (handler instanceof HandlerMethod) {
SSOToken token = SSOHelper.attrToken(request);
if (token == null) {
return true;
}
try {
return unaut... | 肖敬先 | |
@RequiresPermissions("sys:users:role") | annotation | @ApiOperation(value = "角色授权用户列表", response = Response.class, notes = "权限编码(sys:users:role)")
@GetMapping("/list/{roleId}")
public JsonResponse usersByRole(@PathVariable("roleId") Object roleId, @RequestParam Map<String, Object> params) {
params.put("roleId", roleId.equals("null") == true ? null : roleId);
Query... | 肖敬先 | |
User user = (User) session.getAttribute(Const.CURRENT_USER);
if (iUserService.checkRole(user)) {
// 更新categoryName
return Service.updateCategoryName(categoryId, categoryName);
} else {
return Response.createByErrorMessage("无权限操作,需要管理员权限");
} | conventional | @RequestMapping("set_category_name.do")
public ServerResponse setCategoryName(HttpSession session, Integer categoryId, String categoryName) {
// 更新categoryName
return iCategoryService.updateCategoryName(categoryId, categoryName);
} | 肖敬先 | |
if (SSOConfig.getInstance().isPermissionUri()) {
String uri = request.getRequestURI();
if (uri == null || this.getAuthorization().isPermitted(token, uri)) {
return true;
}
}
if (pm != null) {
if (pm.action() == Action.Skip) {
return true;
... | conventional | protected boolean isVerification(HttpServletRequest request, Object handler, SSOToken token) {
if (SSOConfig.getInstance().isPermissionUri()) {
String uri = request.getRequestURI();
if (uri == null || this.getAuthorization().isPermitted(token, uri)) {
return true;
}
... | 肖敬先 | |
if (originAclIdList.size() == roles.size()) {
Set<Long> originAclIdSet = Sets.newHashSet(originAclIdList);
Set<Long> aclIdSet = Sets.newHashSet(roles);
originAclIdSet.removeAll(aclIdSet);
if (CollectionUtils.isEmpty(originAclIdSet)) {
return "为企业用户授权角色成功";
}
... | conventional | @Override
public String rolesToUser(SysEnterpriseUserReq sysEnterpriseUserReq) {
UserGroupDO uuid = userGroupMapper.uuid(sysEnterpriseUserReq.getEnterpriseUuid());
if (uuid == null) {
throw BizException.fail("用户所在的企业不存在");
}
UserDO userDO = userMapper.uuid(sysEnterpriseUserReq.getUuid());
if... | 肖敬先 | |
if (mForbidDialog == null) {
mForbidDialog = new AlertDialog.Builder(this).setTitle("权限被禁止").setMessage("需要获取权限,否则无法正常使用功能;设置路径:设置-应用-权限").setPositiveButton("确定", null).setNegativeButton("取消", null).setCancelable(false).create();
| conventional | protected void showForbidPermissionDialog() {
if (mForbidDialog == null) {
mForbidDialog = new AlertDialog.Builder(this).setTitle("权限被禁止").setMessage("需要获取权限,否则无法正常使用功能;设置路径:设置-应用-权限").setPositiveButton("确定", null).setNegativeButton("取消", null).setCancelable(false).create();
mForbidDialog.setOnShowL... | 肖敬先 | |
@AuthRuleAnnotation("admin/auth/role/delete") | annotation | @PostMapping("/admin/auth/role/delete")
public BaseResponse<method*start>com.lmxdawn.api.common.res.BaseResponse<method*end> delete(@RequestBody AuthRoleSaveRequest authRoleSaveRequest) {
if (authRoleSaveRequest.getId<method*start>com.lmxdawn.api.admin.req.auth.AuthRoleSaveRequest.getId<method*end>() == null) {
... | 肖敬先 | |
if (perms != null && perms.length > 0) {
if (perms.length == 1) {
if (!subject.isCheck(perms[0])) {
isPermitted = false;
}
} else {
if (!subject.isCheck(perms)) {
isPermitted = false;
}
}
}
return getPer... | annotation | @Override
protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) throws Exception {
Subject subject = getSubject(request, response);
String[] perms = (String[]) mappedValue;
boolean getPermitted = true;
return getPermitted;
} | 肖敬先 | |
if (isRootUser()) {
// root用户拥有所有权限点
return sysAclDao.getAll();
} | conventional | public List getUserAclList(int userId) {
List userRoleIdList = sysRoleUserDao.getRoleIdListByUserId(userId);
if (CollectionUtils.isEmpty(userRoleIdList)) {
return Lists.newArrayList();
}
List userAclIdList = sysRoleAclDao.getAclIdListByRoleIdList(userRoleIdList);
if (CollectionUtils.isE... | 肖敬先 | |
if (StringUtils.isEmpty(loginToken)) {
return ServerResponse.createByErrorMessage("用户未登录");
} | conventional | @RequestMapping(value = "update_information.do", method = RequestMethod.POST)
@ResponseBody
public ServerResponse updateInformation(HttpServletRequest request, User user) {
String loginToken = CookieUtil.readLoginToken(request);
User currentUser = JsonUtil.string2obj(RedisShardedPoolUtil.get(loginToken), U... | 肖敬先 | |
Subject subject = SecurityUtils.getSubject();
if (subject.hasRole("admin")) {
adminService.deleteUsers(username);
return BlogJSONResult.ok();
} else {
return BlogJSONResult.errorRolesMsg("无权限");
} | conventional | @GetMapping("delUsers")
public BlogJSONResult delUsers(@RequestParam(value = "username") String username) {
return BlogJSONResult.ok();
} | 肖敬先 | |
if (!isStatAccessPermissionSet(MainActivity.this)) {
} | conventional | @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = (Button) findViewById(R.id.OpenButton);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View vi... | 肖敬先 | |
if (!this.client.doesBucketExist(bucketName)) {
throw new OssApiException("[阿里云OSS] 无法获取文件的访问权限!Bucket不存在:" + bucketName);
}
if (!this.client.doesObjectExist(bucketName, fileName)) {
throw new OssApiException("[阿里云OSS] 无法获取文件的访问权限!文件不存在:" + bucketName + "/" + fileName);
} | conventional | public Object getFileAcl(String fileName, String bucketName) {
try {
return this.client.getObjectAcl(bucketName, fileName).getPermission();
} finally {
this.shutdown();
}
} | 肖敬先 | |
if (oConvertUtils.isEmpty(token)) {
return Result.error("TOKEN不允许为空!");
}
} | conventional | @RequestMapping(value = "/getUserPermissionByToken", method = RequestMethod.GET)
public Result getUserPermissionByToken(@RequestParam(name = "token", required = true) String token) {
Result result = new Result();
try {
log.info(" ------ 通过令牌获取用户拥有的访问菜单 ---- TOKEN ------ " + token);
Stri... | 肖敬先 | |
if (StringTool.isBlank(xxlApiGroup.getName())) {
return new ReturnT(ReturnT.FAIL_CODE, "请输入“分组名称”");
}
XxlApiProject xxlApiProject = xxlApiProjectDao.load(xxlApiGroup.getProjectId());
if (!hasBizPermission(request, xxlApiProject.getBizId())) {
return new ReturnT(ReturnT.FAIL_CODE, "您没有相关业务线的权限,请联系管理员开通");
} | conventional | @RequestMapping("/add")
@ResponseBody
public ReturnT<String> add(HttpServletRequest request, XxlApiGroup xxlApiGroup) {
int ret = xxlApiGroupDao.add(xxlApiGroup);
return (ret > 0) ? ReturnT.SUCCESS : ReturnT.FAIL;
} | 肖敬先 | |
if (map == null || map.size() == 0 || !map.containsKey(0)) {
return "不具有任何权限,\n请找管理员分配权限";
} | conventional | public static String getAdminlteTree(Map map) {
StringBuffer menuString = new StringBuffer();
List list = map.get(0);
for (TSFunction function : list) {
if (!function.hasSubFunction(map)) {
menuString.append(getChildOfTree(function, 1, map));
} else {
menuString.... | 肖敬先 | |
if (user.isAdmin()) {
roles.add("admin");
} else {
roles.addAll(roleService.selectRolePermissionByUserId(user.getId()));
} | conventional | public Set<java.util.Set<String>> getRolePermission(SysUser user) {
Set<java.util.Set<String>> roles = new HashSet<>();
// 管理员拥有所有权限
roles.add("admin");
return roles;
} | 肖敬先 | |
boolean[] permitted = SecurityUtils.getSubject().isPermitted(name);
for (boolean b : permitted) {
// 如果有一个权限,就成功
if (b) {
return true;
}
}
return false; | conventional | public boolean hasPermissionOr(String... name) {
return false;
} | 肖敬先 | |
// 如果没有审核权限,则不允许删除或发布。
if (!UserUtils.getSubject<method*start>com.iwc.shop.modules.sys.utils.UserUtils.getSubject<method*end>().isPermitted<method*start>org.apache.shiro.subject.Subject.isPermitted<method*end>("cms:article:audit")) {
addMessage(redirectAttributes, "你没有删除或发布权限");
} | conventional | @RequestMapping<method*start>org.springframework.web.bind.annotation.RequestMapping<method*end>(value<method*start>org.springframework.web.bind.annotation.RequestMapping.value<method*end> = "delete")
public String<method*start>java.lang.String<method*end> delete(Article<method*start>com.iwc.shop.modules.cms.entity.Arti... | 肖敬先 | |
if (null == configAttributes || configAttributes.size() <= 0) {
return;
}
ConfigAttribute c;
String needRole;
for (ConfigAttribute configAttribute : configAttributes) {
c = configAttribute;
needRole = c.getAttribute();
// authentication 为在注释1 中循环添加到 GrantedAuthority ... | conventional | @Override
public void decide(Authentication authentication, Object object, Collection<ConfigAttribute> configAttributes) throws AccessDeniedException, InsufficientAuthenticationException {
} | 肖敬先 | |
User user = (User) session.getAttribute(Const.CURRENT_USER);
if (user == null) {
return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(), "用户未登录,请登录");
}
// 校验一下是否是管理员
if (iUserService.checkAdminRole(user).isSuccess()) {
// 增加我们处理分类的逻辑
return iCatego... | conventional | @RequestMapping("add_category.do")
public ServerResponse addCategory(HttpSession session, String categoryName, @RequestParam(value = "parentId", defaultValue = "0") int parentId) {
User user = (User) session.getAttribute(Const.CURRENT_USER);
// 增加我们处理分类的逻辑
return iCategoryService.addCategory(ca... | 肖敬先 | |
if (imMgr.validation<method*start>com.tencent.qcloud.roomservice.logic.IMMgr.validation<method*end>(userID, token) != 0) {
rsp.setCode<method*start>com.tencent.qcloud.roomservice.pojo.Response.BaseRsp.setCode<method*end>(7);
rsp.setMessage<method*start>com.tencent.qcloud.roomservice.pojo.Response.BaseRs... | conventional | @Override
public BaseRsp<method*start>com.tencent.qcloud.roomservice.pojo.Response.BaseRsp<method*end> logout(String<method*start>java.lang.String<method*end> userID, String<method*start>java.lang.String<method*end> token) {
BaseRsp<method*start>com.tencent.qcloud.roomservice.pojo.Response.BaseRsp<method*end> rsp =... | 肖敬先 | |
if (tbPermissionMapper.deleteByPrimaryKey(id) != 1) {
throw new XmallException("删除权限失败");
} | conventional | @Override
public int deletePermission(int id) {
TbRolePermExample example = new TbRolePermExample();
TbRolePermExample.Criteria criteria = example.createCriteria();
criteria.andPermissionIdEqualTo(id);
tbRolePermMapper.deleteByExample(example);
return 1;
} | 肖敬先 | |
// 判断请求头是否包含授权TOKEN
if (null == token) {
// 判断COOKIE是否包含授权TOKEN
if (null != cookies) {
for (Cookie<method*start>javax.servlet.http.Cookie<method*end> cookie : cookies) {
if (BaseConstants.TOKEN_KEY.toLowerCase<method*start>java.lang.String.toLowerCase<method*end>... | conventional | public BaseToken<method*start>org.superboot.base.BaseToken<method*end> getTokenInfo(HttpServletRequest<method*start>javax.servlet.http.HttpServletRequest<method*end> request) {
BaseToken<method*start>org.superboot.base.BaseToken<method*end> userInfo = new BaseToken<method*start>org.superboot.base.BaseToken<method*e... | 肖敬先 | |
DynamicData dynamicData1 = DynamicData.getDynamicData<method*start>io.jpom.permission.DynamicData.getDynamicData<method*end>(classFeature);
if (dynamicData1 == null) {
// 如果不是没有动态权限 就默认通过
return false;
}
| conventional | public boolean errorDynamicPermission(UserModel<method*start>io.jpom.model.data.UserModel<method*end> userModel, ClassFeature<method*start>io.jpom.plugin.ClassFeature<method*end> classFeature, String<method*start>java.lang.String<method*end> dataId) {
if (JpomApplication.SYSTEM_ID.equals<method*start>java.lang.Stri... | 肖敬先 | |
if (!isAuthorizationEnabled()) {
return;
}
if (role == null) {
continue;
}
if (role.getIsRelatingToNamespace() && !namespace.equals(userRole.getNamespace())) {
continue;
}
List<RolePermission> rolePermissions = role.getRolePermissions()... | conventional | @Override
public void assertIsPermitted(String permissionKey, String userName, String namespace) throws SaturnJobConsoleException {
User user = getUser(userName);
List<UserRole> userRoles = user.getUserRoles();
throw new SaturnJobConsoleException(String.format("您没有操作所需要的权限:域:%s,权限:%s", namespace, ... | 肖敬先 | |
if (!redisUser.getTenantId().equals(superAdminsService.getTeantId()) && roleDO.getSysRoleType().equals(RoleTypeEnum.admin.type)) {
throw BizException.fail("您无权限操作");
} | conventional | @Transactional
@Override
public String aclsToEnterprise(UserGroupPageReq userGroupPageReq) {
UserGroupDO uuid = userGroupMapper.uuid(userGroupPageReq.getUuid());
if (uuid == null) {
throw BizException.fail("待授权的企业不存在");
}
RoleDO roleDO = roleMapper.getVipAdminRole(uuid.getId(), RoleTypeEnum.admi... | 肖敬先 | |
@PreAuthorize<method*start>org.springframework.security.access.prepost.PreAuthorize<method*end>("hasAnyRole('ADMIN','USER_ALL','USER_SELECT')") | annotation | @Log<method*start>com.dxj.log.annotation.Log<method*end>("查询用户")
@GetMapping<method*start>org.springframework.web.bind.annotation.GetMapping<method*end>(value<method*start>org.springframework.web.bind.annotation.GetMapping.value<method*end> = "/user")
public ResponseEntity<method*start>org.springframework.http.Response... | 肖敬先 | |
if (ValidateKit.isNullOrEmpty<method*start>cn.dreampie.ValidateKit.isNullOrEmpty<method*end>(permission)) {
throw new NullPointerException<method*start>java.lang.NullPointerException<method*end>("操作权限不存在");
} | conventional | public Role<method*start>org.icedog.function.user.model.Role<method*end> addPermission(Permission<method*start>org.icedog.function.user.model.Permission<method*end> permission) {
RolePermission<method*start>org.icedog.function.user.model.RolePermission<method*end> rolePermission = new RolePermission<method*start>or... | 肖敬先 | |
// boolean authenticated = getSubjct().isAuthenticated(); | conventional | @GetMapping("/login")
public String login() {
// 判断是记住登陆还是授权登陆
UserDO user = getUser();
if (user != null) {
return "redirect:management/index";
}
return "management/login";
} | 肖敬先 | |
if (count > 0) {
return CommonResult.success(count);
} | conventional | @ApiOperation
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id, @RequestBody UmsPermission permission) {
int count = permissionService.update(id, permission);
return CommonResult.failed();
} | 肖敬先 | |
if (imMgr.validation<method*start>com.tencent.qcloud.roomservice.logic.IMMgr.validation<method*end>(userID, token) != 0) {
rsp.setCode<method*start>com.tencent.qcloud.roomservice.pojo.Response.BaseRsp.setCode<method*end>(7);
rsp.setMessage<method*start>com.tencent.qcloud.roomservice.pojo.Response.BaseRs... | conventional | @Override
public GetRoomListRsp<method*start>com.tencent.qcloud.roomservice.pojo.Response.GetRoomListRsp<method*end> getRoomList(String<method*start>java.lang.String<method*end> userID, String<method*start>java.lang.String<method*end> token, GetRoomListReq<method*start>com.tencent.qcloud.roomservice.pojo.Request.GetRoo... | 肖敬先 | |
SysUser user = this.selectById(userId);
if (user == null) {
throw RequestException.fail("用户不存在");
}
SysUser sysUser = new SysUser();
BeanUtils.copyProperties(SecurityUtils.getSubject().getPrincipal(), sysUser);
if (user.getUsername().equals(sysUser.getUsername())) {
throw RequestException.fail("不能锁定自己的账户");
} | conventional | @Override
public void statusChange(String userId, Integer status) {
SysUser user = this.selectById(userId);
user.setStatus(status);
try {
this.updateById(user);
// 若为0 需要进行清除登陆授权以及权限信息
/*if(status==0){
}*/
shiroService.clearAuthByUserId(userId, true, true);
... | 肖敬先 | |
// 权限
XxlApiProject project = xxlApiProjectDao.load(oldVo.getProjectId());
if (!hasBizPermission(request, project.getBizId())) {
return new ReturnT(ReturnT.FAIL_CODE, "您没有相关业务线的权限,请联系管理员开通");
} | conventional | @RequestMapping("/update")
@ResponseBody
public ReturnT<String> update(HttpServletRequest request, XxlApiDocument xxlApiDocument) {
XxlApiDocument oldVo = xxlApiDocumentDao.load(xxlApiDocument.getId());
if (oldVo == null) {
return new ReturnT(ReturnT.FAIL_CODE, "操作失败,接口ID非法");
}
x... | 肖敬先 | |
Subject subject = SecurityUtils.getSubject();
if (subject.hasRole("admin")) {
PagedResult allUsers = adminService.getAllFriendsUrl(pageSize, pageNum);
return BlogJSONResult.ok(allUsers);
} else {
return BlogJSONResult.errorRolesMsg("无权限");
} | conventional | @GetMapping("getAllFriendsUrl")
public BlogJSONResult getAllFriendsUrl(@RequestParam(value = "pageSize") Integer pageSize, @RequestParam(value = "pageNum") Integer pageNum) {
PagedResult allUsers = adminService.getAllFriendsUrl(pageSize, pageNum);
return BlogJSONResult.ok(allUsers);
} | 肖敬先 | |
int count = permissionService.delete(ids);
if (count > 0) {
return CommonResult.success(count);
} | conventional | @ApiOperation("根据id批量删除权限")
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@RequestParam("ids") List<Long> ids) {
int count = permissionService.delete(ids);
return CommonResult.failed();
} | 肖敬先 | |
checkNotNull(username, "Username could not be null.");
checkNotNull(password, "Password could not be null."); | conventional | public static void login(String username, String password, boolean rememberMe) {
Principal principal = credentials.getPrincipal(username);
if (principal == null) {
throw new HttpException(HttpMessage.USERNAME_NOT_FOUND);
}
boolean match;
String salt = principal.getSalt();
if (salt != nul... | 肖敬先 | |
UserPo user = (UserPo) request.getSession().getAttribute(RtConstant.KEY_USER_PO);
if (user.isCanReadGateway()) {
String gatewayId = requestVo.getVoData();
GatewayPo gatewayPo = gatewayService.getGatewayByGatewayId(gatewayId);
responseVo.setVoData(gatewayPo);
} else {
... | conventional | @RequestMapping("/getGatewayByGatewayId")
@ResponseBody
public ResponseVo<GatewayPo> getGatewayByGatewayId(HttpServletRequest request, @RequestBody RequestVo<String> requestVo) {
ResponseVo<GatewayPo> responseVo = new ResponseVo<>();
try {
GatewayPo gatewayPo = gatewayService.getGatewayByGatewayId(gatewayId);
r... | 肖敬先 | |
if (AndroidVersionUtil.hasM<method*start>com.arialyy.frame.util.AndroidVersionUtil.hasM<method*end>()) {
if (requestCode == OnPermissionCallback.PERMISSION_ALERT_WINDOW<method*start>com.arialyy.frame.permission.OnPermissionCallback.PERMISSION_ALERT_WINDOW<method*end>) {
if (Settings.... | conventional | public void handleSpecialPermissionCallback(Context<method*start>android.content.Context<method*end> context, int requestCode, int resultCode, Intent<method*start>android.content.Intent<method*end> data) {
} | 万爽 | |
@RequiresPermissions<method*start>org.apache.shiro.authz.annotation.RequiresPermissions<method*end>("oss:file:list") | annotation | @Log("文件上传列表")
@ApiOperation<method*start>io.swagger.annotations.ApiOperation<method*end>(value = "列表", notes<method*start>io.swagger.annotations.ApiOperation.notes<method*end> = "权限编码(oss:file:list)")
@GetMapping<method*start>org.springframework.web.bind.annotation.GetMapping<method*end>("/list")
public JsonResponse<m... | 万爽 | |
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
UIUtils.toast("授权成功");
}
| conventional | @Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
switch(requestCode) {
case PERMISSIONS_REQUEST_CODE_STORAGE:
{
// If request is cancelled, the result arrays are empty.
case Fi... | 万爽 | |
if (permission.getId() == null) {
throw new InvalidParamException("ID不存在");
}
final QueryWrapper<SysPermission> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("code", permission.getCode());
queryWrapper.notIn("id", permission.getId());
if (this.count(queryWrapper) > 0) {
throw ... | conventional | @Override
public Boolean updatePermission(final SysPermission permission) {
return this.updateById(permission);
} | 万爽 | |
if (user == null) {
return ServerResponse.createByErrorCodeMessage<method*start>com.mmall.common.ServerResponse.createByErrorCodeMessage<method*end>(ResponseCode.NEED_LOGIN.getCode<method*start>com.mmall.common.ResponseCode.getCode<method*end>(), "用户未登录,请登录管理员");
}
if (iUserService.checkAdminRole<method... | conventional | @RequestMapping<method*start>org.springframework.web.bind.annotation.RequestMapping<method*end>("detail.do")
@ResponseBody
public ServerResponse<method*start>com.mmall.common.ServerResponse<method*end><OrderVo<method*start>com.mmall.vo.OrderVo<method*end>> orderDetail(HttpSession<method*start>javax.servlet.http.HttpSes... | 万爽 | |
if (checkRootUser && isRootUser()) {
return true;
}
if (acl == admin ) {
return true;
} | conventional | public boolean hasAcl(SysAcl acl, boolean checkRootUser) {
List<Integer> aclIdList = getCurrentUserAclIdListFromCache();
if (CollectionUtils.isEmpty(aclIdList)) {
return false;
}
return Sets.newHashSet(aclIdList).contains(acl.getId());
} | 万爽 | |
// 检查权限
CheckAccess(comment); | conventional | @PostMapping(value = "/delete")
@ResponseBody
@SystemLog(description = "删除评论", type = LogTypeEnum.OPERATION)
public JsonResult moveToAway(@RequestParam("id") Long commentId) {
// 评论
Comment comment = commentService.get(commentId);
// 检查权限
if (Objects.equals(comment.getCommentStatus(), CommentStatusE... | 万爽 | |
@RequiresPermissions("配置管理:权限管理:后台用户管理") | annotation | @RequestMapping(value = "/menus/data", method = RequestMethod.GET)
@ResponseBody
public Object menusData(@ModelEntity(preFectchLazyFields = { "userR2Roles" }) User entity) {
List<Map<String, Object>> items = Lists.newArrayList();
List<Menu> userMenus = menuService.processUserMenu(entity);
for (Menu menu : u... | 肖敬先 | |
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
UIUtils.toast("授权成功");
}
break;
} | conventional | @Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
switch(requestCode) {
case PERMISSIONS_REQUEST_CODE_STORAGE:
{
case FilePickerDialog.EXTERNAL_READ_PERMISSION_GRANT:
{
... | 肖敬先 | |
if (permission.getId() == null) {
throw new InvalidParamException("ID不存在");
}
final QueryWrapper<SysPermission> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("code", permission.getCode());
queryWrapper.notIn("id", permission.getId());
if (this.count(queryWrapper) > 0) {
throw ... | conventional | @Override
public Boolean updatePermission(final SysPermission permission) {
return this.updateById(permission);
} | 肖敬先 | |
if (user == null) {
return ServerResponse.createByErrorCodeMessage<method*start>com.mmall.common.ServerResponse.createByErrorCodeMessage<method*end>(ResponseCode.NEED_LOGIN.getCode<method*start>com.mmall.common.ResponseCode.getCode<method*end>(), "用户未登录,请登录管理员");
}
if (iUserService.checkAdminRole<method... | conventional | @RequestMapping<method*start>org.springframework.web.bind.annotation.RequestMapping<method*end>("detail.do")
@ResponseBody
public ServerResponse<method*start>com.mmall.common.ServerResponse<method*end><OrderVo<method*start>com.mmall.vo.OrderVo<method*end>> orderDetail(HttpSession<method*start>javax.servlet.http.HttpSes... | 肖敬先 | |
if (checkRootUser && isRootUser()) {
return true;
}
if (acl == null || acl.getStatus() != Status.AVAILABLE.getCode()) {
// 不存在或未生效的,按照有权限处理
return true;
} | conventional | public boolean hasAcl(SysAcl acl, boolean checkRootUser) {
List<Integer> aclIdList = getCurrentUserAclIdListFromCache();
if (CollectionUtils.isEmpty(aclIdList)) {
return false;
}
return Sets.newHashSet(aclIdList).contains(acl.getId());
} | 肖敬先 | |
Partner u = partnerMapper.getById(uid);
if (null == u) {
throw new UserNameNotFoundException("id不存在");
}
if (!u.getIsAdmin()) {
throw new NoPermissionException("普通用户无权登录管理系统");
} | conventional | @Override
public String getUsername(Integer uid, String password) throws UserNameNotFoundException, NoPermissionException {
return u.getPassword().equals(password) ? u.getUsername() : null;
} | 肖敬先 | |
if (checkRootUser && isRootUser()) {
return true;
}
if (acl == null || acl.getStatus() != Status.AVAILABLE.getCode()) {
// 不存在或未生效的,按照有权限处理
return true;
} | conventional | @RequestMapping(value = { "/addContractByUnifiedSymbol" })
@ResponseBody
public ResponseVo<String> addContractByUnifiedSymbol(HttpServletRequest request, @RequestBody ContractPo contract) {
ResponseVo<String> responseVo = new ResponseVo<>();
try {
UserPo user = (UserPo) request
} catch (Exception e... | 肖敬先 | |
if (!content.isHasDeleteRight<method*start>foo.cms.entity.main.Content.isHasDeleteRight<method*end>()) {
errors.addErrorCode<method*start>foo.common.web.springmvc.WebErrors.addErrorCode<method*end>("content.error.afterCheckDelete");
return errors;
} | conventional | private WebErrors<method*start>foo.cms.web.WebErrors<method*end> validateDelete(Integer<method*start>java.lang.Integer<method*end>[] ids, HttpServletRequest<method*start>javax.servlet.http.HttpServletRequest<method*end> request) {
WebErrors<method*start>foo.cms.web.WebErrors<method*end> errors = WebErrors.create<me... | 肖敬先 | |
if (user == null) {
return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(), "用户未登录,请登录管理员");
}
if (iUserService.checkAdminRole(user).isSuccess()) {
// 填充业务
} else {
return ServerResponse.createByErrorMessage("无权限操作");
} | conventional | @RequestMapping("detail.do")
public ServerResponse<com.mmall.common.ServerResponse> getDetail(HttpSession session, Integer productId) {
User user = (User) session.getAttribute(Const.CURRENT_USER);
return iProductService.manageProductDetail(productId)
} | 肖敬先 | |
wxMpOAuth2AccessToken = wxMpService.oauth2getAccessToken(code);
| conventional | @GetMapping("/qrUserInfo")
public String qrUserInfo(@RequestParam("code") String code) {
WxMpOAuth2AccessToken wxMpOAuth2AccessToken = new WxMpOAuth2AccessToken();
try {
wxMpOAuth2AccessToken = wxMpService.oauth2getAccessToken(code);
} catch (WxErrorException e) {
log.error("【微信网页授权】{}", e);... | 肖敬先 | |
@RequiresPermissions("admin_user:edit") | annotation | @PostMapping("/edit")
public String edit(AdminUser adminUser) {
AdminUser _adminUser = getAdminUser();
if (StringUtils.isEmpty(adminUser.getPassword())) {
adminUser.setPassword(null);
} else {
adminUser.setPassword(new BCryptPasswordEncoder().encode(adminUser.getPassword()));
}
... | 肖敬先 | |
for (Object obj : pp.keySet()) {
String key = ((String) obj);
// 使用正则表达式验证 需要将 ? . 替换一下,并将通配符 * 处理一下
if (uri.matches(key.replace("?", "\\?").replace(".", "\\.").replace("*", ".*"))) {
// 如果 role 匹配
if (role.equals(pp.get(key))) {
authentificated = true... | conventional | @Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
logger.info("{} 开始做过滤处理", this.getClass().getName());
HttpServletRequest request = (HttpServletRequest) req;
// 获取访问的路径,例如:admin.jsp
String requestURI = request.getRequestURI... | 肖敬先 | |
if (currentUserId != null) | conventional | @Override
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
// 取出鉴权时存入的登录用户Id
Long currentUserId = (Long) webRequest.getAttribute(C.CURRENT_USER_ID, RequestAttributes.SCOPE_REQUEST);
... | 肖敬先 | |
if (StringUtils.isNotEmpty(token)) | conventional | public LoginUser getLoginUser(HttpServletRequest request) {
String token = getToken(request);
Claims claims = parseToken(token);
String uuid = (String) claims.get(Constants.LOGIN_USER_KEY);
String userKey = getTokenKey(uuid);
return redisCacheService.getCacheObjec... | 肖敬先 | |
/* if (userId == null) {
return false;
}
User user = userService.getUserById(userId);
//超级管理员拥有所有执行器的权限
if (user != null && user.getRoleId() == 999) {
return true;
}
String agentIds = userService.getUserById(userId).getAgentIds();
agentIds = "," + agentIds + ",";
String thisAgentId = "," + jobAgentId + ",";
ret... | conventional | private boolean checkJobPermission(Long jobAgentId, Long userId) {
String agentIds = userService.getUserById(userId).getAgentIds();
agentIds = "," + agentIds + ",";
String thisAgentId = "," + jobAgentId + ",";
return agentIds.contains(thisAgentId);*/
} | 肖敬先 | |
Boolean isAdmin = loginUserIsAdmin(); | conventional | private void basicCheck(Post post) {
if (post == null) {
throw new SensBusinessException(localeMessageUtil.getMessage("code.admin.common.post-not-exist"));
}
User user = getLoginUser();
if (!Objects.equals(post.getUserId(), user.getId()) && !isAdmin) {
throw new SensBusinessException(loc... | 肖敬先 | |
@RequiresPermissions("配置管理:权限管理:后台用户管理")
| annotation | @RequestMapping(value = "/roles", method = RequestMethod.GET)
public String roles(User entity, Model model) {
Account account = entity.getAccount();
model.addAttribute(GlobalConstant.ROOT_VALUE, true);
if (Account.AuthTypeEnum.admin.equals(account.getAuthType()) && GlobalConstant.ROOT_VALUE.equals(accoun... | 肖敬先 | |
// valid
if (username == null || username.trim().length() == 0 || password == null || password.trim().length() == 0) {
throw new RuntimeException("权限账号密码不可为空");
} | conventional | @Override
public void afterPropertiesSet() throws Exception {
// valid
// login token
// .getBytes("UTF-8")
String tokenTmp = DigestUtils.md5DigestAsHex(String.valueOf(username + "_" + password).getBytes());
tokenTmp = new BigInteger(1, tokenTmp.getBytes()).toString(16);
LOGIN_IDENTITY_TOKE... | 肖敬先 | |
@RequiresPermissions("role:allotResource") | annotation | @PostMapping("/saveRoleResources")
@BussinessLog("分配角色拥有的资源")
public ResponseVO<method*start>com.zyd.blog.framework.object.ResponseVO<method*end> saveRoleResources(Long<method*start>java.lang.Long<method*end> roleId, String<method*start>java.lang.String<method*end> resourcesId) {
if (StringUtils.isEmpty<method*star... | 肖敬先 | |
if (imMgr.validation(userID, token) != 0) {
rsp.setCode(7);
rsp.setMessage("请求失败,鉴权失败");
log.error("getPushers失败:鉴权失败:" + "userID:" + userID);
return rsp;
} | conventional | @Override
public Room getPushers(String userID, String token, GetPushersReq req, int type) {
Room rsp = new Room();
if (userID == null || token == null) {
rsp.setCode(2);
rsp.setMessage("请求失败,缺少参数");
log.error("getPushers失败:缺少参数:" + "userID:" + userID + ",token: " + token + ",type: " + t... | 肖敬先 | |
// 权限校验
XxlApiProject xxlApiProject = xxlApiProjectDao.load(existGroup.getProjectId());
if (!hasBizPermission(request, xxlApiProject.getBizId())) {
return new ReturnT<String>(ReturnT.FAIL_CODE, "您没有相关业务线的权限,请联系管理员开通");
} | conventional | @RequestMapping("/delete")
@ResponseBody
public ReturnT<String> delete(HttpServletRequest request, int id) {
// exist
XxlApiGroup existGroup = xxlApiGroupDao.load(id);
if (existGroup == null) {
return new ReturnT<String>(ReturnT.FAIL_CODE, "更新失败,分组ID非法");
}
List<XxlApiDocument... | 肖敬先 | |
@RequiresPermissions("配置管理:权限管理:部门配置") | annotation | @RequestMapping(value = "/tree", method = RequestMethod.GET)
@ResponseBody
public MappingJacksonValue findTreeData(GroupPropertyFilter filter, Pageable pageable, HttpServletRequest request) {
filter.forceAnd(new PropertyFilter(MatchType.NE, "disabled", true));
Object value = departmentService.findByPage(filter,... | 肖敬先 | |
@RequiresPermissions(value = { "resource:batchDelete", "resource:delete" }, logical = Logical.OR)
@RequiresPermissions.Logical.OR | annotation | @PostMapping(value = "/remove")
@BussinessLog("删除资源")
public ResponseVO remove(Long[] ids) {
if (null == ids) {
return ResultUtil.error(500, "请至少选择一条记录");
}
for (Long id : ids) {
resourcesService.removeByPrimaryKey(id);
}
// 更新权限
shiroService.updatePermission();
return Result... | 肖敬先 | |
BaseToken baseToken = getRedisUtils().getTokenInfo(token);
if (null != baseToken) {
// 判断用户的角色是否为空
if (!StringUtils.isBlank(baseToken.getUserRole())) {
// 获取系统有操作权限的角色
String[] roles = BaseConstants.ADMIN_ROLE_TYPE.split(",");
for (String role : roles) {
if (-1 != role.indexO... | conventional | @Override
public BaseResponse checkUserIsManager(String token) {
BaseToken baseToken = getRedisUtils().getTokenInfo(token);
return new BaseResponse(StatusCode.UNAUTHORIZED_OPERATION);
} | 肖敬先 | |
AuthDTO<method*start>com.asofdate.hauth.dto.AuthDTO<method*end> authDTO = authService.domainAuth<method*start>com.asofdate.hauth.service.AuthService.domainAuth<method*end>(request, domainId, "w");
if (!authDTO.getStatus<method*start>com.asofdate.hauth.dto.AuthDTO.getStatus<method*end>()) {
return Hret.error<method*... | conventional | @RequestMapping<method*start>org.springframework.web.bind.annotation.RequestMapping<method*end>(method<method*start>org.springframework.web.bind.annotation.RequestMapping.method<method*end> = RequestMethod.POST<method*start>org.springframework.web.bind.annotation.RequestMethod.POST<method*end>)
public String<method*sta... | 肖敬先 | |
if (!TextUtils.isEmpty(wxAuthorizationVo.getErrorMsg())) | conventional | @PostMapping(value = "/authentication")
public Response authentication(HttpServletRequest request, @RequestBody JSONObject json) {
// 邀请者的openId
String openId = json.getString("openId");
// 微信授权码
String code = json.getString("code");
AuthorizationVo wxAuthorizationVo = authenticationService.authentication(request, ... | 肖敬先 | |
// 无权限
if (exception instanceof UnauthorizedException<method*start>org.apache.shiro.authz.UnauthorizedException<method*end>) {
return "/403.jsp";
}
// shiro session 过期
if (exception instanceof InvalidSessionException<method*start>org.apache.shiro.session.InvalidSessionException<method*end>) ... | conventional | @ExceptionHandler<method*start>org.springframework.web.bind.annotation.ExceptionHandler<method*end>
public String<method*start>java.lang.String<method*end> exceptionHandler(HttpServletRequest<method*start>javax.servlet.http.HttpServletRequest<method*end> request, HttpServletResponse<method*start>javax.servlet.http.Http... | 肖敬先 | |
User user = (User) session.getAttribute(Const.CURRENT_USER);
if (user == null) {
return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(), "用户未登录,请登录管理员");
}
if (iUserService.checkAdminRole(user).isSuccess()) {
// 填充我们增加产品的业务逻辑
return iProductService.saveO... | conventional | @RequestMapping("save.do")
public ServerResponse<com.mmall.common.ServerResponse> productSave(HttpSession session, Product product) {
User user = (User) session.getAttribute(Const.CURRENT_USER);
return iProductService.saveOrUpdateProduct(product);
} | 肖敬先 | |
@RequiresPermissions<method*start>org.apache.shiro.authz.annotation.RequiresPermissions<method*end>("permission:group:insert") | annotation | @ApiOperation<method*start>io.swagger.annotations.ApiOperation<method*end>(value<method*start>io.swagger.annotations.Api.value<method*end> = "新增权限组", httpMethod<method*start>io.swagger.annotations.ApiOperation.httpMethod<method*end> = "POST", produces<method*start>io.swagger.annotations.ApiOperation.produces<method*end... | 肖敬先 | |
BaseConvert.checkPara(para); | conventional | public void update(DeptPara para) {
SysDept before = sysDeptDao.findById(para.getId());
Preconditions.checkNotNull(before, "待更新部门不存在");
if (checkExist(para.getParentId(), para.getName(), para.getId())) {
throw new ParaException("当前模块下存在相同名称的权限点");
}
SysDept after = DeptConvert.of(para);
... | 肖敬先 | |
@PreAuthorize("hasAnyAuthority('ROLE_ADMIN','ROLE_USER','ROLE_VISTOR')") | annotation | @PostMapping
public ResponseEntity<Response> createVote(Long blogId) {
try {
blogService.createVote(blogId);
} catch (ConstraintViolationException e) {
return ResponseEntity.ok().body(new Response(false, ConstraintViolationExceptionHandler.getMessage(e)));
} catch (Exception e) {
ret... | 肖敬先 | |
@RequiresPermissions("membership.permission:view") | annotation |
@RequiresPermissions("membership.permission:view")
public Map<String, Object> list(final DataGridPager pager, final Integer id) {
final int moduleId = (id == null ? 0 : id);
final PageInfo pageInfo = pager.toPageInfo();
final List<Permission> list = this.service.getByPage(pageInfo, moduleId);
final Map... | 肖敬先 | |
if (imMgr.validation(userID, token) != 0) {
rsp.setCode(7);
rsp.setMessage("请求失败,鉴权失败");
log.error("destroyRoom失败:鉴权失败:" + "userID:" + userID + ",roomID:" + req.getRoomID());
return rsp;
}
if (!roomMgr.isRoomCreator(req.getRoomID(), req.getUserID(), type)) {
rsp.setCode(3);
rsp.setMessag... | conventional | @Override
public BaseRsp destroyRoom(String userID, String token, DestroyRoomReq req, int type) {
BaseRsp rsp = new BaseRsp();
if (userID == null || token == null || req.getUserID() == null || req.getRoomID() == null) {
rsp.setCode(2);
rsp.setMessage("请求失败,缺少参数");
log.error("destroyRoom失... | 万爽 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.