Java Code Examples for org.apache.shiro.authz.annotation.Logical#OR
The following examples show how to use
org.apache.shiro.authz.annotation.Logical#OR .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SystemNotificationController.java From DouBiNovel with Apache License 2.0 | 6 votes |
@RequestMapping("/deleteList") @ResponseBody @RequiresPermissions(value = {"SYSTEM_NOTIFICATION_DELETE", Const.role.ROLE_SUPER}, logical = Logical.OR) public MvcResult deleteList(Long[] ids) { MvcResult result = MvcResult.create(); try { boolean success = systemNotificationService.deleteList(Arrays.asList(ids)); if (!success) { result.setSuccess(false); result.setMessage("删除失败:未知原因"); } } catch (Exception e) { result.setSuccess(false); result.setMessage("删除失败:" + e.getMessage()); } return result; }
Example 2
Source File: RestArticleController.java From OneBlog with GNU General Public License v3.0 | 6 votes |
@RequiresPermissions(value = {"article:batchPush", "article:push"}, logical = Logical.OR) @PostMapping(value = "/pushToBaidu/{type}") @BussinessLog("推送文章[{2}]到百度站长平台") public ResponseVO pushToBaidu(@PathVariable("type") BaiduPushTypeEnum type, Long[] ids) { if (null == ids) { return ResultUtil.error(500, "请至少选择一条记录"); } Map config = configService.getConfigs(); String siteUrl = (String) config.get(ConfigKeyEnum.SITE_URL.getKey()); StringBuilder params = new StringBuilder(); for (Long id : ids) { params.append(siteUrl).append("/article/").append(id).append("\n"); } // urls: 推送, update: 更新, del: 删除 String url = UrlBuildUtil.getBaiduPushUrl(type.toString(), (String) config.get(ConfigKeyEnum.SITE_URL.getKey()), (String) config.get(ConfigKeyEnum.BAIDU_PUSH_TOKEN.getKey())); String result = BaiduPushUtil.doPush(url, params.toString(), (String) config.get(ConfigKeyEnum.BAIDU_PUSH_COOKIE.getKey())); log.info(result); JSONObject resultJson = JSONObject.parseObject(result); if (resultJson.containsKey("error")) { return ResultUtil.error(resultJson.getString("message")); } return ResultUtil.success(null, result); }
Example 3
Source File: AdminIndexController.java From DouBiNovel with Apache License 2.0 | 6 votes |
@RequestMapping("/welcome") @RequiresPermissions(value = {"ADMIN_VIEW", Const.role.ROLE_SUPER}, logical = Logical.OR) public String welcome(Model model) { long userCount = userService.countUser(); model.addAttribute("userCount",userCount); long bookSourceCount = bookSourceService.countBookSource(); model.addAttribute("bookSourceCount",bookSourceCount); long donateCount = donateService.countDonate(); model.addAttribute("donateCount",donateCount); long updateLogCount = updateLogService.countUpdateLogs(); model.addAttribute("updateLogCount",updateLogCount); BaseQuery notificationQuery = new BaseQuery(); notificationQuery.set("order","id desc"); notificationQuery.setSize(6); model.addAttribute("notifications",systemNotificationService.getByQuery(notificationQuery).getList()); return "admin/welcome"; }
Example 4
Source File: LoginLogController.java From DouBiNovel with Apache License 2.0 | 6 votes |
@RequestMapping("/delete") @ResponseBody @RequiresPermissions(value = {"LOGIN_LOG_DELETE", Const.role.ROLE_SUPER}, logical = Logical.OR) public MvcResult delete(Long id) { MvcResult result = MvcResult.create(); try { boolean success = loginLogService.delete(id); if (!success) { result.setSuccess(false); result.setMessage("删除失败:未知原因"); } } catch (Exception e) { result.setSuccess(false); result.setMessage("删除失败:" + e.getMessage()); } return result; }
Example 5
Source File: RestUserController.java From springboot-shiro with MIT License | 5 votes |
@RequiresPermissions(value = {"user:batchDelete", "user:delete"}, logical = Logical.OR) @PostMapping(value = "/remove") public ResponseVO remove(Long[] ids) { if (null == ids) { return ResultUtil.error(500, "请至少选择一条记录"); } for (Long id : ids) { userService.removeByPrimaryKey(id); userRoleService.removeByUserId(id); } return ResultUtil.success("成功删除 [" + ids.length + "] 个用户"); }
Example 6
Source File: UpdateLogController.java From DouBiNovel with Apache License 2.0 | 5 votes |
@RequestMapping(method = RequestMethod.POST, value = "/doEdit") @ResponseBody @RequiresPermissions(value = {"UPDATE_LOG_UPDATE", Const.role.ROLE_SUPER}, logical = Logical.OR) public MvcResult doEdit(UpdateLog updateLog, boolean isSendEmail) { MvcResult result = MvcResult.create(); try { if (StringUtils.isEmpty(updateLog.getUpdateDes())) { result.setSuccess(false); result.setMessage("修改失败:内容不能为空"); } else { boolean success = updateLogService.edit(updateLog); if (!success) { result.setSuccess(false); result.setMessage("修改失败:未知原因"); }else { if (isSendEmail) { List<User> list = userService.findAll(); SystemSetting setting = systemSettingService.getSetting(); String title = String.format("%s 网站版本更新 - " + Dates.format(new Date(), "yyyy-MM-dd"), setting.getSitename()); List<String> tos = new ArrayList<>(); for (User user : list) { if (!StringUtils.isEmpty(user.getEmail())) { tos.add(user.getEmail()); } } mailService.sendAllHtmlMail(tos, title, updateLog.getUpdateDes()); } } } } catch (Exception e) { result.setSuccess(false); result.setMessage("修改失败:" + e.getMessage()); } return result; }
Example 7
Source File: UserController.java From DouBiNovel with Apache License 2.0 | 5 votes |
@RequestMapping("/listJSON") @ResponseBody @RequiresPermissions(value = {"USER_VIEW", Const.role.ROLE_SUPER}, logical = Logical.OR) public MvcResult listJSON(BaseQuery query) { MvcResult result = MvcResult.create(); try { PageTemplate<User> pageTemplate = userService.getByQuery(query); result.setData(pageTemplate); } catch (Exception e) { result.setCode(-1); result.setSuccess(false); result.setMessage("获取出错," + e.getMessage()); } return result; }
Example 8
Source File: ExampleController.java From super-cloudops with Apache License 2.0 | 5 votes |
@RequiresPermissions(value = { "order:view:test3", "order:edit:*" }, logical = Logical.OR) @RequestMapping("test4") @ResponseBody public String test4(String name) { log.info("Request test4... {}", name); return "ok"; }
Example 9
Source File: RestRoleController.java From springboot-shiro with MIT License | 5 votes |
@RequiresPermissions(value = {"role:batchDelete", "role:delete"}, logical = Logical.OR) @PostMapping(value = "/remove") public ResponseVO remove(Long[] ids) { if (null == ids) { return ResultUtil.error(500, "请至少选择一条记录"); } for (Long id : ids) { roleService.removeByPrimaryKey(id); roleResourcesService.removeByRoleId(id); } return ResultUtil.success("成功删除 [" + ids.length + "] 个角色"); }
Example 10
Source File: DonateController.java From DouBiNovel with Apache License 2.0 | 5 votes |
@RequestMapping("/edit") @RequiresPermissions(value = {"DONATE_VIEW", Const.role.ROLE_SUPER}, logical = Logical.OR) public String edit(Long id, Model model) { Donate data = donateService.getById(id); model.addAttribute("data", data); return "admin/donate/edit"; }
Example 11
Source File: RoleController.java From springboot-learn with MIT License | 5 votes |
@RequiresPermissions(value = {"role:batchDelete", "role:delete"}, logical = Logical.OR) @PostMapping(value = "/remove") public ResponseVO remove(Long[] ids) { if (null == ids) { return ResultUtil.error(500, "请至少选择一条记录"); } for (Long id : ids) { roleService.removeByPrimaryKey(id); roleResourcesService.removeByRoleId(id); } return ResultUtil.success("成功删除 [" + ids.length + "] 个角色"); }
Example 12
Source File: RestTagController.java From OneBlog with GNU General Public License v3.0 | 5 votes |
@RequiresPermissions(value = {"tag:batchDelete", "tag:delete"}, logical = Logical.OR) @PostMapping(value = "/remove") @BussinessLog("删除标签") public ResponseVO remove(Long[] ids) { if (null == ids) { return ResultUtil.error(500, "请至少选择一条记录"); } for (Long id : ids) { tagsService.removeByPrimaryKey(id); } return ResultUtil.success("成功删除 [" + ids.length + "] 个标签"); }
Example 13
Source File: RestResourcesController.java From OneBlog with GNU General Public License v3.0 | 5 votes |
@RequiresPermissions(value = {"resource:batchDelete", "resource:delete"}, logical = Logical.OR) @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 ResultUtil.success("成功删除 [" + ids.length + "] 个资源"); }
Example 14
Source File: ModuleRestControllerImpl.java From Goku.Framework.CoreUI with MIT License | 5 votes |
@Override @RequestMapping("/save") @RequiresRoles("admin_sys") @RequiresPermissions(value={"sys:module:add","sys:module:edit"},logical = Logical.OR) public String save(@RequestBody SysModule symodule) { int result=sysModuleService.saveModule(symodule); if(result>0) { return JSON.toJSONString ("true"); }else{ return JSON.toJSONString ("false"); } }
Example 15
Source File: SystemNotificationController.java From DouBiNovel with Apache License 2.0 | 4 votes |
@RequestMapping("/list") @RequiresPermissions(value = {"SYSTEM_NOTIFICATION_VIEW", Const.role.ROLE_SUPER}, logical = Logical.OR) public String list() { return "admin/systemNotification/list"; }
Example 16
Source File: MemberTransactionController.java From ZTuoExchange_framework with MIT License | 4 votes |
@RequiresPermissions(value = {"finance:member-transaction:page-query", "finance:member-transaction:page-query:recharge", "finance:member-transaction:page-query:check", "finance:member-transaction:page-query:fee"}, logical = Logical.OR) @PostMapping("page-query_es") @AccessLog(module = AdminModule.FINANCE, operation = "分页查找交易记录MemberTransaction") public MessageResult getPageQueryByES( MemberTransaction2ESVO transactionVO) { log.info(">>>>>>查询交易明细开始>>>>>>>>>"); try { String query="{\"from\":"+(transactionVO.getPageNo()-1)*transactionVO.getPageSize()+",\"size\":"+ transactionVO.getPageSize()+",\"sort\":[{\"create_time\":{\"order\":\"desc\"}}]," + "\"query\":{\"bool\":{\"must\":["; boolean deleteFlag =false; if(!StringUtils.isEmpty(transactionVO.getStartTime())&&!StringUtils.isEmpty(transactionVO.getEndTime())){ query+="{\"range\":{\"create_time\":{\"gte\":\""+transactionVO.getStartTime()+"\",\"lte\":\""+transactionVO.getEndTime()+"\"}}},"; deleteFlag =true; } if(!StringUtils.isEmpty(transactionVO.getType())){ query+="{\"match\":{\"type\":\""+transactionVO.getType()+"\"}},"; deleteFlag =true; } if(!StringUtils.isEmpty(transactionVO.getMemberId())){ query+="{\"match\":{\"member_id\":\""+transactionVO.getMemberId()+"\"}},"; deleteFlag =true; } if(!StringUtils.isEmpty(transactionVO.getMinMoney())){ query+="{\"range\":{\"amount\":{\"gte\":\""+transactionVO.getMinMoney()+"\"}}},"; deleteFlag =true; } if(!StringUtils.isEmpty(transactionVO.getMaxMoney())){ query+="{\"range\":{\"amount\":{\"lte\":\""+transactionVO.getMaxMoney()+"\"}}},"; deleteFlag =true; } if(!StringUtils.isEmpty(transactionVO.getMinFee())){ query+="{\"range\":{\"fee\":{\"gte\":\""+transactionVO.getMinFee()+"\"}}},"; } if(!StringUtils.isEmpty(transactionVO.getMaxFee())){ query+="{\"range\":{\"fee\":{\"lte\":\""+transactionVO.getMaxFee()+"\"}}},"; deleteFlag =true; } if(deleteFlag){ //去除最后一个符号 query.substring(0,query.length()-1); } query+="]}}}"; return success(esUtils.queryForAnyOne(JSONObject.parseObject(query),"member_transaction","mem_transaction")); }catch (Exception e){ log.info(">>>>>>查询异常>>>"+e); return error("查询异常"); } }
Example 17
Source File: UpdateLogController.java From DouBiNovel with Apache License 2.0 | 4 votes |
@RequestMapping("/list") @RequiresPermissions(value = {"UPDATE_LOG_VIEW", Const.role.ROLE_SUPER}, logical = Logical.OR) public String list() { return "admin/updateLog/list"; }
Example 18
Source File: MemberTransactionController.java From ZTuoExchange_framework with MIT License | 4 votes |
@RequiresPermissions(value = {"finance:member-transaction:page-query", "finance:member-transaction:page-query:recharge", "finance:member-transaction:page-query:check", "finance:member-transaction:page-query:fee"}, logical = Logical.OR) @PostMapping("page-query") @AccessLog(module = AdminModule.FINANCE, operation = "分页查找交易记录MemberTransaction") public MessageResult pageQuery( PageModel pageModel, MemberTransactionScreen screen) { List<Predicate> predicates = new ArrayList<>(); if(screen.getMemberId()!=null) { predicates.add((QMember.member.id.eq(screen.getMemberId()))); } if (!StringUtils.isEmpty(screen.getAccount())) { predicates.add(QMember.member.username.like("%"+screen.getAccount()+"%") .or(QMember.member.realName.like("%"+screen.getAccount()+"%"))); } if (screen.getStartTime() != null) { predicates.add(QMemberTransaction.memberTransaction.createTime.goe(screen.getStartTime())); } if (screen.getEndTime() != null){ predicates.add(QMemberTransaction.memberTransaction.createTime.lt(DateUtil.dateAddDay(screen.getEndTime(),1))); } if (screen.getType() != null) { predicates.add(QMemberTransaction.memberTransaction.type.eq(screen.getType())); } if(screen.getMinMoney()!=null) { predicates.add(QMemberTransaction.memberTransaction.amount.goe(screen.getMinMoney())); } if(screen.getMaxMoney()!=null) { predicates.add(QMemberTransaction.memberTransaction.amount.loe(screen.getMaxMoney())); } if(screen.getMinFee()!=null) { predicates.add(QMemberTransaction.memberTransaction.fee.goe(screen.getMinFee())); } if(screen.getMaxFee()!=null) { predicates.add(QMemberTransaction.memberTransaction.fee.loe(screen.getMaxFee())); } Page<MemberTransactionVO> results = memberTransactionService.joinFind(predicates, pageModel); return success(results); }
Example 19
Source File: BookSourceController.java From DouBiNovel with Apache License 2.0 | 4 votes |
@RequestMapping("/add") @RequiresPermissions(value = {"BOOK_SOURCE_VIEW", Const.role.ROLE_SUPER}, logical = Logical.OR) public String add() { return "admin/bookSource/add"; }
Example 20
Source File: MemberTransactionController.java From ZTuoExchange_framework with MIT License | 4 votes |
@RequiresPermissions(value = {"finance:member-transaction:page-query", "finance:member-transaction:page-query:recharge", "finance:member-transaction:page-query:check", "finance:member-transaction:page-query:fee"}, logical = Logical.OR) @PostMapping("page-query_es") @AccessLog(module = AdminModule.FINANCE, operation = "分页查找交易记录MemberTransaction") public MessageResult getPageQueryByES( MemberTransaction2ESVO transactionVO) { log.info(">>>>>>查询交易明细开始>>>>>>>>>"); try { String query="{\"from\":"+(transactionVO.getPageNo()-1)*transactionVO.getPageSize()+",\"size\":"+ transactionVO.getPageSize()+",\"sort\":[{\"create_time\":{\"order\":\"desc\"}}]," + "\"query\":{\"bool\":{\"must\":["; boolean deleteFlag =false; if(!StringUtils.isEmpty(transactionVO.getStartTime())&&!StringUtils.isEmpty(transactionVO.getEndTime())){ query+="{\"range\":{\"create_time\":{\"gte\":\""+transactionVO.getStartTime()+"\",\"lte\":\""+transactionVO.getEndTime()+"\"}}},"; deleteFlag =true; } if(!StringUtils.isEmpty(transactionVO.getType())){ query+="{\"match\":{\"type\":\""+transactionVO.getType()+"\"}},"; deleteFlag =true; } if(!StringUtils.isEmpty(transactionVO.getMemberId())){ query+="{\"match\":{\"member_id\":\""+transactionVO.getMemberId()+"\"}},"; deleteFlag =true; } if(!StringUtils.isEmpty(transactionVO.getMinMoney())){ query+="{\"range\":{\"amount\":{\"gte\":\""+transactionVO.getMinMoney()+"\"}}},"; deleteFlag =true; } if(!StringUtils.isEmpty(transactionVO.getMaxMoney())){ query+="{\"range\":{\"amount\":{\"lte\":\""+transactionVO.getMaxMoney()+"\"}}},"; deleteFlag =true; } if(!StringUtils.isEmpty(transactionVO.getMinFee())){ query+="{\"range\":{\"fee\":{\"gte\":\""+transactionVO.getMinFee()+"\"}}},"; } if(!StringUtils.isEmpty(transactionVO.getMaxFee())){ query+="{\"range\":{\"fee\":{\"lte\":\""+transactionVO.getMaxFee()+"\"}}},"; deleteFlag =true; } if(deleteFlag){ //去除最后一个符号 query.substring(0,query.length()-1); } query+="]}}}"; return success(esUtils.queryForAnyOne(JSONObject.parseObject(query),"member_transaction","mem_transaction")); }catch (Exception e){ log.info(">>>>>>查询异常>>>"+e); return error("查询异常"); } }