validation stringlengths 16 3.54k | validationType stringclasses 2
values | function stringlengths 49 6.38k | author stringclasses 5
values | context stringclasses 5
values |
|---|---|---|---|---|
@PreAuthorize("hasRole('PRODUCTS')") | annotation | @RequestMapping("/admin/files/downloads/{storeCode}/{fileName}.{extension}")
public @ResponseBody byte[] downloadProduct(@PathVariable final String storeCode, @PathVariable final String fileName, @PathVariable final String extension, HttpServletRequest request, HttpServletResponse response) throws Exception {
File... | 万爽 | |
// 校验数据范围
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
if(ObjectUtil.isNotEmpty(loginUserDataScope)) {
if(!loginUserDataScope.containsAll(orgIdList)) {
throw new CommonException("您没有权限删除这些机构,机构id:{}", orgIdList);
}
} else {
throw new CommonException("您没有权限删除这些机构,机构id:{... | conventional | @Transactional(rollbackFor = Exception.class)
@Override
public void delete(List<BizOrgIdParam> bizOrgIdParamList) {
List<String> orgIdList = CollStreamUtil.toList(bizOrgIdParamList, BizOrgIdParam::getId);
if(ObjectUtil.isNotEmpty(orgIdList)) {
List<BizOrg> allOrgList = this.list();
// 获取所有子机构
... | 万爽 | |
// 校验数据范围
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
if(ObjectUtil.isNotEmpty(loginUserDataScope)) {
if(!loginUserDataScope.contains(bizOrgAddParam.getParentId())) {
throw new CommonException("您没有权限在该机构下增加机构,机构id:{}", bizOrgAddParam.getParentId());
}
} else {
throw n... | conventional | @Transactional(rollbackFor = Exception.class)
@Override
public void add(BizOrgAddParam bizOrgAddParam) {
BizOrgCategoryEnum.validate(bizOrgAddParam.getCategory());
BizOrg bizOrg = BeanUtil.toBean(bizOrgAddParam, BizOrg.class);
// 重复名称
boolean repeatName = this.count(new LambdaQueryWrapper<BizOrg>().eq... | 万爽 | |
// 校验数据范围
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
if(ObjectUtil.isNotEmpty(loginUserDataScope)) {
if(!loginUserDataScope.containsAll(positionOrgIdList)) {
throw new CommonException("您没有权限删除这些机构下的岗位,机构id:{}", positionOrgIdList);
}
} else {
throw new CommonException... | conventional | @Transactional(rollbackFor = Exception.class)
@Override
public void delete(List<BizPositionIdParam> bizPositionIdParamList) {
List<String> positionIdList = CollStreamUtil.toList(bizPositionIdParamList, BizPositionIdParam::getId);
if(ObjectUtil.isNotEmpty(positionIdList)) {
// 获取这些岗位的的机构id集合
Set<... | 万爽 | |
@RequiresPermissions("system:dept:add") | annotation | /**
* 新增保存部门
*/
@Log(title = "部门管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(SysDept dept)
{
dept.setCreateBy(ShiroUtils.getLoginName());
return toAjax(deptService.insertDept(dept));
} | 万爽 | |
@RequiresPermissions("tool:swagger:view") | annotation | @Controller
@RequestMapping("/tool/swagger")
public class SwaggerController extends BaseController
{
@GetMapping()
public String index()
{
return redirect("/swagger-ui.html");
}
} | 万爽 | |
@RequiresPermissions("system:menu:remove") | annotation | /**
* 删除菜单
*/
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
@PostMapping("/remove/{menuId}")
@ResponseBody
public AjaxResult remove(@PathVariable("menuId") Long menuId)
{
if (menuService.selectCountMenuByParentId(menuId) > 0)
{
return error(1, "存在子菜单,不允许删除");
}
if (menuService.selec... | 万爽 | |
@PermissionData(pageComponent = "jeecg/JeecgDemoList") | annotation | @ApiOperation(value = "获取Demo数据列表", notes = "获取所有Demo数据列表")
@GetMapping(value = "/list")
public Result<?> list(JeecgDemo jeecgDemo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
... | 万爽 | |
@PermissionData(pageComponent = "jeecg/JeecgDemoList") | annotation | /**
* 导出excel
*
* @param request
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, JeecgDemo jeecgDemo) {
//获取导出表格字段
String exportFields = jeecgDemoService.getExportFields();
//分sheet导出表格字段
return super.exportXlsSheet(request, jeecgDemo, JeecgDemo.cla... | 万爽 | @Pointcut("@annotation(org.jeecg.common.aspect.annotation.PermissionData)")
public void pointCut() {
}
@Around("pointCut()")
public Object arround(ProceedingJoinPoint point) throws Throwable{
HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
MethodSignature signature = (MethodSignature... |
@PermissionData(pageComponent = "system/TenantList") | annotation | /**
* 获取列表数据
* @param sysTenant
* @param pageNo
* @param pageSize
* @param req
* @return
*/
//@RequiresPermissions("system:tenant:list")
@RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysTenant>> queryPageList(SysTenant sysTenant, @RequestParam(name="pageNo", defaultValue="1") I... | 万爽 | |
if (!adminUserService.isAdmin(loginUser)) {
return Result.error(HttpStatus.BAD_REQUEST,"无权限");
} | conventional | public Result getReportDetail(@RequestBody SecureWafReportDetailQuery query,HttpServletRequest request) throws IOException {
String loginUser = userInfoService.getUserErp(request);
return secureWafTaskRecordService.getReportDetail(query);
} | 文承业 | |
if (!adminUserService.isAdmin(user)&& agentClusterAddReqVo.getIsDefault()) {
return Result.error("只有管理员才可以操作默认集群");
} | conventional | public Result insertOrUpdate(AgentClusterAddReqVo agentClusterAddReqVo,String user) {
Result baseResponse = new Result();
try {
log.debug("AgentClusterServiceImpl.insertOrUpdate(), agentClusterAddReqVo is {}", JSON.toJSONString(agentClusterAddReqVo));
AgentCluster agentCluster = ... | 文承业 | |
if (!adminUserService.isAdmin(user)&& agentCluster.getIsDefault()) {
return new Result(501,"只有管理员才可以操作默认集群");
} | conventional | public Result insertOrUpdate(AgentNodeAddReqVo agentNodeAddReqVo,String user) {
Integer clusterId = agentNodeAddReqVo.getClusterId();
if (clusterId == null) {
return new Result(501,"clusterId为空");
}
AgentClusterRspVo agentCluster = agentClusterService.selectClusterById(cluste... | 文承业 | |
if (adminUserService.isAdmin(login)) {
}else {
List<NewProject> projectList = projectService.getProjectById(login,projectQuery.getProjectId());
if (projectList.size()==0) {
return Result.success();
}
} | conventional | public Result getCaseTree(ProjectQueryParam projectQuery, String login) {
log.info("CaseServeceImpl.getCaseTree, projectQuery is {}", JSON.toJSONString(projectQuery));
if (ObjectUtil.isEmpty(projectQuery.getProjectId())) {
return Result.success();
}
try {
QueryWra... | 文承业 | |
Long userId = getCookie(request.getCookies(), "userId");
if (orderDetail.userId != userId){
return return CommonResult.fail(500, "无权查看订单");
} | conventional | @ApiOperation("根据ID获取订单详情")
@RequestMapping(value = "/detail/{orderId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<OmsOrderDetail> detail(@PathVariable Long orderId) {
OmsOrderDetail orderDetail = portalOrderService.detail(orderId);
return CommonResult.success(orderDetail... | 文承业 | |
NewBeeMallUserVO user = (NewBeeMallUserVO) httpSession.getAttribute(Constants.MALL_USER_SESSION_KEY);
NewBeeMallOrderDetailVO orderDetailVO = newBeeMallOrderService.getOrderDetailByOrderNo(orderNo, user.getUserId()); | conventional | @GetMapping("/orders/{orderNo}")
public String orderDetailPage(HttpServletRequest request, @PathVariable("orderNo") String orderNo, HttpSession httpSession) {
NewBeeMallOrderDetailVO orderDetailVO = newBeeMallOrderService.getOrderDetailByOrderNo(orderNo);
request.setAttribute("orderDetailVO", orderD... | 文承业 | |
NewBeeMallUserVO user = (NewBeeMallUserVO) httpSession.getAttribute(Constants.MALL_USER_SESSION_KEY);
//判断订单userId
if (!user.getUserId().equals(newBeeMallOrder.getUserId())) {
NewBeeMallException.fail(ServiceResultEnum.NO_PERMISSION_ERROR.getResult());
} | conventional | @GetMapping("/selectPayType")
public String selectPayType(HttpServletRequest request, @RequestParam("orderNo") String orderNo, HttpSession httpSession) {
NewBeeMallOrder newBeeMallOrder = newBeeMallOrderService.getNewBeeMallOrderByOrderNo(orderNo);
//判断订单状态
if (newBeeMallOrder.getOrderStatus... | 文承业 | |
NewBeeMallUserVO user = (NewBeeMallUserVO) httpSession.getAttribute(Constants.MALL_USER_SESSION_KEY);
//判断订单userId
if (!user.getUserId().equals(newBeeMallOrder.getUserId())) {
NewBeeMallException.fail(ServiceResultEnum.NO_PERMISSION_ERROR.getResult());
} | conventional | @GetMapping("/payPage")
public String payOrder(HttpServletRequest request, @RequestParam("orderNo") String orderNo, HttpSession httpSession, @RequestParam("payType") int payType) {
NewBeeMallOrder newBeeMallOrder = newBeeMallOrderService.getNewBeeMallOrderByOrderNo(orderNo);
//判断订单状态
if (new... | 文承业 | |
int accessLevel = userPermissionFacade.getUserAccessLevel(SessionHolder.getUsername());
if (accessLevel < 100) {
log.warn("越权访问: 业务资源只有{SUPER_SA}才能访问!");
throw new AuthenticationException("越权访问: 业务资源只有{SUPER_SA}才能访问!");
} | conventional | public void interceptLoginServer(int serverId) {
Tag tag = tagService.getByTagKey(TagConstants.SUPER_ADMIN.getTag());
// SA标签不存在
if (tag == null) {
return;
}
BusinessTag bizTag = BusinessTag.builder()
.businessType(BusinessTypeEnum.SERVER.getType())
... | 黄琛 | |
if (!loginUser.getUserId().equals(orderInfo.getUser_id())) {
return toResponseFail("越权操作!");
} | conventional | /**
* 获取订单详情
*/
@ApiOperation(value = "获取订单详情")
@PostMapping("detail")
public Object detail(Integer orderId, @LoginUser UserVo loginUser) {
Map resultObj = new HashMap();
//
OrderVo orderInfo = orderService.queryObject(orderId);
if (null == orderInfo) {
... | 黄琛 | /**
* @author lipengjun
* @email 939961241@qq.com
* @date 2017-08-15 08:03:41
*/
public class UserVo implements Serializable {
private static final long serialVersionUID = 1L;
//主键
private Long userId;
//会员名称
private String username;
//会员密码
private String password;
//性别
private ... |
if (!loginUser.getUserId().equals(orderInfo.getUser_id())) {
return toResponseFail("越权操作!");
} | conventional | @ApiOperation(value = "修改订单")
@PostMapping("updateSuccess")
public Object updateSuccess(Integer orderId, @LoginUser UserVo loginUser) {
OrderVo orderInfo = orderService.queryObject(orderId);
if (orderInfo == null) {
return toResponseFail("订单不存在");
} else if (orderInfo.getOrde... | 黄琛 | |
if (!loginUser.getUserId().equals(orderVo.getUser_id())) {
return toResponseFail("越权操作!");
} | conventional | /**
* 取消订单
*/
@ApiOperation(value = "取消订单")
@PostMapping("cancelOrder")
public Object cancelOrder(Integer orderId, @LoginUser UserVo loginUser) {
try {
OrderVo orderVo = orderService.queryObject(orderId);
if (null == orderVo) {
return toResponseFail(... | 黄琛 | |
if (!loginUser.getUserId().equals(orderVo.getUser_id())) {
return toResponseFail("越权操作!");
} | conventional | /**
* 确认收货
*/
@ApiOperation(value = "确认收货")
@PostMapping("confirmOrder")
public Object confirmOrder(Integer orderId, @LoginUser UserVo loginUser) {
try {
OrderVo orderVo = orderService.queryObject(orderId);
if (null == orderVo) {
return toResponseFai... | 黄琛 | |
@PermissionData(pageComponent = "system/UserList") | annotation | @RequestMapping(value = "/list", method = RequestMethod.GET)
public Result<IPage<SysUser>> queryPageList(SysUser user,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) {
QueryWra... | 万爽 | |
@EruptRouter(authIndex = 2, verifyType = EruptRouter.VerifyType.ERUPT) | annotation | @PostMapping("/auto-complete/{erupt}/{field}")
public List<Object> findAutoCompleteValue(@PathVariable("erupt") String eruptName,
@PathVariable("field") String field,
@RequestParam("val") String val,
... | 万爽 | @Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
@Documented
@Comment("接口菜单权限校验,仅对/erupt-api/**下的接口有效")
public @interface EruptRouter {
@Comment("根据请求地址'/'进行分隔,定义处于第几个下标为的字符为菜单权限标识字符")
int authIndex() default 0;
@Comment("配合authIndex使用,计算后权限下标位置为:skipAuthIndex + authIndex")
int skipAu... |
@EruptRouter(authIndex = 2, verifyType = EruptRouter.VerifyType.ERUPT) | annotation | @GetMapping("/tags-item/{erupt}/{field}")
public List<String> findTagsItem(@PathVariable("erupt") String eruptName,
@PathVariable("field") String field) {
EruptFieldModel fieldModel = EruptCoreService.getErupt(eruptName).getEruptFieldMap().get(field);
return EruptUtil.getTagList... | 万爽 | @Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
@Documented
@Comment("接口菜单权限校验,仅对/erupt-api/**下的接口有效")
public @interface EruptRouter {
@Comment("根据请求地址'/'进行分隔,定义处于第几个下标为的字符为菜单权限标识字符")
int authIndex() default 0;
@Comment("配合authIndex使用,计算后权限下标位置为:skipAuthIndex + authIndex")
int skipAu... |
@EruptRouter(authIndex = 1, verifyType = EruptRouter.VerifyType.ERUPT) | annotation | @GetMapping("/{erupt}")
@SneakyThrows
public EruptBuildModel getEruptBuild(@PathVariable("erupt") String eruptName) {
EruptModel eruptView = EruptCoreService.getEruptView(eruptName);
{
//default search conditions
Map<String, Object> conditionsMap = new HashMap<>();
DataProxyInvoke.invoke... | 万爽 | @Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
@Documented
@Comment("接口菜单权限校验,仅对/erupt-api/**下的接口有效")
public @interface EruptRouter {
@Comment("根据请求地址'/'进行分隔,定义处于第几个下标为的字符为菜单权限标识字符")
int authIndex() default 0;
@Comment("配合authIndex使用,计算后权限下标位置为:skipAuthIndex + authIndex")
int skipAu... |
@Permission(role = UserRole.ADMIN) | annotation | @GetMapping(path = "operate")
public ResVo<String> operate(@RequestParam(name = "articleId") Long articleId, @RequestParam(name = "operateType") Integer operateType) {
OperateArticleEnum operate = OperateArticleEnum.fromCode(operateType);
if (operate == OperateArticleEnum.EMPTY) {
return ResVo.fail(Stat... | 万爽 | |
@Permission(role = UserRole.ADMIN) | annotation | @RestController
@Api(value = "发布文章作者白名单管理控制器", tags = "作者白名单")
@RequestMapping(path = {"api/admin/author/whitelist"})
public class AuthorWhiteListController {
@Autowired
private AuthorWhiteListService articleWhiteListService;
@GetMapping(path = "get")
@ApiOperation(value = "白名单列表", notes = "返回作者白名单列表")... | 万爽 | |
@Permission(role = UserRole.ADMIN) | annotation | @GetMapping(path = "delete")
public ResVo<String> delete(@RequestParam(name = "categoryId") Integer categoryId) {
categorySettingService.deleteCategory(categoryId);
return ResVo.ok("ok");
} | 万爽 | |
@Permission(role = UserRole.ADMIN) | annotation | @GetMapping(path = "operate")
public ResVo<String> operate(@RequestParam(name = "categoryId") Integer categoryId,
@RequestParam(name = "pushStatus") Integer pushStatus) {
if (pushStatus != PushStatusEnum.OFFLINE.getCode() && pushStatus!= PushStatusEnum.ONLINE.getCode()) {
ret... | 万爽 | |
@Permission(role = UserRole.ADMIN) | annotation | @PostMapping(path = "saveColumn")
public ResVo<String> saveColumn(@RequestBody ColumnReq req) {
columnSettingService.saveColumn(req);
return ResVo.ok("ok");
} | 万爽 | |
@Permission(role = UserRole.ADMIN) | annotation | @PostMapping(path = "saveColumnArticle")
public ResVo<String> saveColumnArticle(@RequestBody ColumnArticleReq req) {
// 要求文章必须存在,且已经发布
ArticleDO articleDO = articleReadService.queryBasicArticle(req.getArticleId());
if (articleDO == null || articleDO.getStatus() == PushStatusEnum.OFFLINE.getCode()) {
... | 万爽 | |
@Permission(role = UserRole.LOGIN) | annotation | @GetMapping(path = "home")
public String getUserHome(@RequestParam(name = "userId") Long userId,
@RequestParam(name = "homeSelectType", required = false) String homeSelectType,
@RequestParam(name = "followSelectType", required = false) String followSelectType,
... | 万爽 | |
@Permission(role = UserRole.ADMIN) | annotation | @RequestMapping(path = "email")
public ResVo<String> email(EmailReqVo req) {
if (StringUtils.isBlank(req.getTo()) || req.getTo().indexOf("@") <= 0) {
return ResVo.fail(Status.newStatus(StatusEnum.ILLEGAL_ARGUMENTS_MIXED, "非法的邮箱接收人"));
}
if (StringUtils.isBlank(req.getTitle())) {
req.setTitle... | default | |
@AuthorshipInterceptor(moduleName = Module.PORTFOLIO) | annotation | @PutMapping("/post")
public GlobalResult<Portfolio> update(@RequestBody Portfolio portfolio) {
if (portfolio.getIdPortfolio() == null || portfolio.getIdPortfolio() == 0) {
throw new IllegalArgumentException("作品集主键参数异常!");
}
User user = UserUtils.getCurrentUserByToken();
portfolio.setPortfolioAut... | 万爽 | |
@AuthorshipInterceptor(moduleName = Module.PORTFOLIO) | annotation | @GetMapping("/{idPortfolio}/unbind-articles")
public GlobalResult<PageInfo> unbindArticles(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows, @RequestParam(defaultValue = "") String searchText, @PathVariable Long idPortfolio) {
if (idPortfolio == null || idPortfolio == ... | 万爽 | |
if (idAuthor > 0) {
String authHeader = request.getHeader(JwtConstants.AUTHORIZATION);
if (StringUtils.isNotBlank(authHeader)) {
TokenUser tokenUser = UserUtils.getTokenUser(authHeader);
if (!idAuthor.equals(tokenUser.getIdUser())) {
boolean ha... | conventional | @Before(value = "authorshipPointCut()")
public void doBefore(JoinPoint joinPoint) {
logger.info("检查作者身份 start ...");
String methodName = joinPoint.getSignature().getName();
Method method = currentMethod(joinPoint, methodName);
AuthorshipInterceptor log = method.getAnnotation(AuthorshipInterceptor.class)... | 万爽 | |
@SecurityInterceptor | annotation | @GetMapping("/detail/{idUser}")
public GlobalResult<UserInfoDTO> detail(@PathVariable Long idUser) {
UserInfoDTO userInfo = userService.findUserInfo(idUser);
return GlobalResultGenerator.genSuccessResult(userInfo);
} | 万爽 | |
@SecurityInterceptor | annotation | @GetMapping("/detail/{idUser}/extend-info")
public GlobalResult<UserExtend> extendInfo(@PathVariable Long idUser) {
UserExtend userExtend = userService.findUserExtendInfo(idUser);
return GlobalResultGenerator.genSuccessResult(userExtend);
} | 万爽 | |
@SecurityInterceptor | annotation | @PatchMapping("/update")
public GlobalResult<UserInfoDTO> updateUserInfo(@RequestBody UserInfoDTO user) throws ServiceException {
user = userService.updateUserInfo(user);
return GlobalResultGenerator.genSuccessResult(user);
} | 万爽 | |
@SecurityInterceptor | annotation | @PatchMapping("/update-extend")
public GlobalResult<UserExtend> updateUserExtend(@RequestBody UserExtend userExtend) throws ServiceException {
userExtend = userService.updateUserExtend(userExtend);
return GlobalResultGenerator.genSuccessResult(userExtend);
} | 万爽 | |
@SecurityInterceptor | annotation | @PatchMapping("/update-email")
public GlobalResult<Boolean> updateEmail(@RequestBody ChangeEmailDTO changeEmailDTO) throws ServiceException {
boolean flag = userService.updateEmail(changeEmailDTO);
return GlobalResultGenerator.genSuccessResult(flag);
} | 万爽 | |
@SecurityInterceptor | annotation | @PatchMapping("/update-password")
public GlobalResult<Boolean> updatePassword(@RequestBody UpdatePasswordDTO updatePasswordDTO) {
boolean flag = userService.updatePassword(updatePasswordDTO);
return GlobalResultGenerator.genSuccessResult(flag);
} | 万爽 | |
@SecurityInterceptor | annotation | @GetMapping("/login-records")
public GlobalResult<PageInfo<LoginRecord>> loginRecords(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows, @RequestParam Integer idUser) {
PageHelper.startPage(page, rows);
List<LoginRecord> list = loginRecordService.findLoginRecordById... | 万爽 | |
SecurityContextHolder.getContext().setAuthentication(new UsernamePasswordAuthenticationToken(hr, authentication.getCredentials(), authentication.getAuthorities())); | conventional | @PutMapping("/hr/info")
public RespBean updateHr(@RequestBody Hr hr, Authentication authentication) {
if (hrService.updateHr(hr) == 1) {
return RespBean.ok("更新成功!");
}
return RespBean.error("更新失败!");
} | 万爽 | |
SecurityContextHolder.getContext().setAuthentication(new UsernamePasswordAuthenticationToken(hr, authentication.getCredentials(), authentication.getAuthorities())); | conventional | @PostMapping("/hr/userface")
public RespBean updateHrUserface(MultipartFile file, Integer id,Authentication authentication) {
String fileId = FastDFSUtils.upload(file);
String url = nginxHost + fileId;
if (hrService.updateUserface(url, id) == 1) {
Hr hr = (Hr) authentication.getPrincipal();
... | 万爽 | |
if (user == null) {
return ResultDTO.errorOf(CustomizeErrorCode.NO_LOGIN);
}
| conventional | @ResponseBody
@RequestMapping(value = "/comment", method = RequestMethod.POST)
public Object post(@RequestBody CommentCreateDTO commentCreateDTO,
HttpServletRequest request) {
User user = (User) request.getSession().getAttribute("user");
if (user.getDisable() != null && user.getDisable() ==... | 万爽 | · |
User user = (User) request.getSession().getAttribute("user");
if (user == null) {
return "redirect:/";
} | conventional | @GetMapping("/notification/{id}")
public String profile(HttpServletRequest request,
@PathVariable(name = "id") Long id) {
NotificationDTO notificationDTO = notificationService.read(id, user);
if (NotificationTypeEnum.REPLY_COMMENT.getType() == notificationDTO.getType()
|| ... | 万爽 | |
User user = (User) request.getSession().getAttribute("user");
if (user == null) {
return "redirect:/";
} | conventional | @GetMapping("/profile/{action}")
public String profile(HttpServletRequest request,
@PathVariable(name = "action") String action,
Model model,
@RequestParam(name = "page", defaultValue = "1") Integer page,
@RequestParam(name ... | 万爽 | |
User user = (User) request.getSession().getAttribute("user");
if (user == null) {
model.addAttribute("error", "用户未登录");
return "publish";
} | conventional | @PostMapping("/publish")
public String doPublish(
@RequestParam(value = "title", required = false) String title,
@RequestParam(value = "description", required = false) String description,
@RequestParam(value = "tag", required = false) String tag,
@RequestParam(value = "id", required = fa... | 万爽 | |
if (cookies != null && cookies.length != 0)
for (Cookie cookie : cookies) {
if (cookie.getName().equals("token") && StringUtils.isNotBlank(cookie.getValue())) {
String token = cookie.getValue();
UserExample userExample = new UserExample();
userExample.createCriteria()
... | conventional | @Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//设置 context 级别的属性
request.getServletContext().setAttribute("giteeRedirectUri", giteeRedirectUri);
request.getServletContext().setAttribute("githubRedirectUri", githubRedirectUri);... | 万爽 | |
.antMatchers("/admin/**","/reg").hasRole("超级管理员") | conventional | @Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/admin/category/all").authenticated()
.anyRequest().authenticated()//其他的路径都是登录后即可访问
.and().formLogin().loginPage("/login_page").successHandler(new AuthenticationSuccess... | 万爽 | |
if (adminUser == null) {
return "admin/login";
} | conventional | @GetMapping("/profile")
public String profile(HttpServletRequest request) {
Integer loginUserId = (int) request.getSession().getAttribute("loginUserId");
AdminUser adminUser = adminUserService.getUserDetailById(loginUserId);
request.setAttribute("path", "profile");
request.setAttribute("loginUserName", ... | 万爽 | |
if (requestServletPath.startsWith("/admin") && null == request.getSession().getAttribute("loginUser")) {
request.getSession().setAttribute("errorMsg", "请重新登陆");
response.sendRedirect(request.getContextPath() + "/admin/login");
return false;
} | conventional | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object o) throws Exception {
String requestServletPath = request.getServletPath();
request.getSession().removeAttribute("errorMsg");
return true;
} | 万爽 | |
// 防止横向越权
shipping.setUserId(userId); | conventional | @Override
public ServerResponse update(Integer userId, Shipping shipping) {
if (shipping == null) {
return ServerResponse.createByErrorCodeMessage(ResponseCode.ILLEGAL_ARGUMENT.getCode(), ResponseCode.ILLEGAL_ARGUMENT.getDescription());
}
int count = shippingMapper.updateByIdAndUserId(shipping)... | 万爽 | |
checkRole(user); | conventional | @Override
@Transactional
public void updateUserRole(SysUser user) {
if (StringUtils.isBlank(user.getPassword())) {
user.setPassword(null);
} else {
user.setPassword(passwordEncoder.encode(user.getPassword()));
}
baseMapper.updateById(user);
sysUserRoleMapper.delete(Wrappers.<SysUserR... | 万爽 | |
// 防止横向越权,要校验用户的旧密码
int resCount = userMapper.checkPassword(MD5Util.MD5EncodeUtf8(passwordOld), user.getId());
if (resCount == 0) {
return ServerResponse.createByError("旧密码错误");
} | conventional | @Override
public ServerResponse<String> resetPassword(String passwordNew, String passwordOld, User user) {
int resCount = userMapper.checkPassword(MD5Util.MD5EncodeUtf8(passwordOld), user.getId());
if (resCount == 0) {
return ServerResponse.createByError("旧密码错误");
}
user.setPassword(MD5Util.MD5E... | 万爽 | |
@RequiresPermissions<method*start>org.apache.shiro.authz.annotation.RequiresPermissions<method*end>("sys:menu:edit")
| annotation | @RequestMapping<method*start>org.springframework.web.bind.annotation.RequestMapping<method*end>(value<method*start>org.springframework.web.bind.annotation.RequestMapping.value<method*end> = "save")
public String save(Menu menu, Model model, RedirectAttributes redirectAttributes) {
if (!UserUtils.getUser().isAdmin()... | 万爽 | |
if (StringUtils.isBlank<method*start>org.apache.commons.lang3.StringUtils.isBlank<method*end>(hasAclReq.getUrl<method*start>com.momo.mapper.req.sysmain.HasAclReq.getUrl<method*end>())) {
return false;
}
String<method*start>java.lang.String<method*end> url = truncateUrlPage<method*start>com.momo.serv... | conventional | public boolean hasUrlAcl(HasAclReq<method*start>com.momo.mapper.req.sysmain.HasAclReq<method*end> hasAclReq) {
if (StringUtils.isBlank<method*start>org.apache.commons.lang3.StringUtils.isBlank<method*end>(hasAclReq.getUrl<method*start>com.momo.mapper.req.sysmain.HasAclReq.getUrl<method*end>())) {
return fal... | 万爽 | |
// 检查该权限是否已经获取
int i = ContextCompat.checkSelfPermission<method*start>android.support.v4.content.ContextCompat.checkSelfPermission<method*end>(context, permission);
// 权限是否已经 授权 GRANTED---授权 DINIED---拒绝
if (i == PackageManager.PERMISSION_GRANTED<method*start>android.content.pm.PackageManager.PERMISSION_GRANTED<method*... | conventional |
public static boolean checkPermission(Context<method*start>android.content.Context<method*end> context, @NonNull<method*start>android.support.annotation.NonNull<method*end> String permission) {
List<method*start>java.util.List<method*end><String> noPermission = new ArrayList<method*start>java.util.ArrayList<method... | 万爽 | |
List<method*start>java.util.List<method*end><Long<method*start>java.lang.Long<method*end>> menuIdList = sysRoleMapper.queryAllMenuId(role.getCreateUserId());
if (!menuIdList.containsAll(role.getMenuIdList())) {
throw new RRException("新增角色的权限,已超出你的权限范围");
}
} | conventional | private void checkPrems(SysRole<method*start>com.suke.czx.modules.sys.entity.SysRole<method*end> role) {
// 如果不是超级管理员,则需要判断角色的权限是否超过自己的权限
if (role.getCreateUserId() == Constant.SUPER_ADMIN) {
return;
}
} | 万爽 | |
// 防止横向越权,要校验一下这个用户的旧密码,一定要指定是这个用户.因为我们会查询一个count(1),如果不指定id,那么结果就是true啦count>0;
int resultCount = userMapper.checkPassword<method*start>com.mmall.dao.UserMapper.checkPassword<method*end>(MD5Util.MD5EncodeUtf8<method*start>com.mmall.util.MD5Util.MD5EncodeUtf8<method*end>(passwordOld), user.getId<method*start>com.mm... | conventional | public ServerResponse<method*start>com.mmall.common.ServerResponse<method*end><String<method*start>java.lang.String<method*end>> resetPassword(String<method*start>java.lang.String<method*end> passwordOld, String<method*start>java.lang.String<method*end> passwordNew, User<method*start>com.mmall.pojo.User<method*end> use... | 万爽 | |
// 防止横向越权,要校验一下这个用户的旧密码,一定要指定是这个用户.因为我们会查询一个count(1),如果不指定id,那么结果就是true啦count>0;
int resultCount = userMapper.checkPassword(MD5Util.MD5EncodeUtf8(passwordOld), user.getId());
if (resultCount == 0) {
return ServerResponse.createByErrorMessage("旧密码错误");
} | conventional | @Override
public ServerResponse<java.lang.String> resetPassword(String passwordOld, String passwordNew, User user) {
int resultCount = userMapper.checkPassword(MD5Util.MD5EncodeUtf8(passwordOld), user.getId());
if (resultCount == 0) {
return ServerResponse.createByErrorMessage("旧密码错误");
}
user.s... | 万爽 | |
if (!status) {
response.setStatus<method*start>javax.servlet.http.HttpServletResponse.setStatus<method*end>(403);
return Hret.error<method*start>com.asofdate.utils.Hret.error<method*end>(403, "您没有权限修改域[" + domainid + "]的授权信息", null);
} | 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... | 万爽 | |
@RequiresPermissions("permission:delete") | annotation | public Result delete(@RequestParam long id) {
SysPermission sysPermission = sysPermissionService.selectById(id);
if (sysPermission == null) {
return Result.error(ResponseCode.data_not_exist.getMsg());
}
if (sysPermission.getIsFinal() == 2) {
return Result.error(ResponseCode.can_not_edit.... | 万爽 | |
Preconditions.checkNotNull(acl, "还原前的权限点为空,无法还原");
Preconditions.checkNotNull(before, "待还原的权限点不存在"); | conventional | @Override
public void recover(int targetId, Object o) {
SysAcl acl = (SysAcl) o;
SysAcl before = sysAclDao.findById(targetId);
if (checkExist(acl.getAclModuleId(), acl.getName(), acl.getId())) {
throw new ParaException("当前模块下存在相同名称的权限点");
}
sysAclDao.update(acl);
sysLogService.saveAclLog... | 万爽 | |
if (!hasPermissions(mContext, permissions)) {
// 需要向用户解释为什么申请这个权限
boolean shouldShowRationale = false;
for (Stringjava.lang.String perm : permissions) {
shouldShowRationale = shouldShowRationale || shouldShowRequestPermissionRationale(mContext, perm);
}
executePermiss... | conventional | public void requestPermissions(@NonNull android.support.annotation.NonNull CharSequence hintMessage, @Nullable android.support.annotation.Nullable PermissionListener listener, @NonNullandroid.support.annotation.NonNull final Stringjava.lang.String... permissions) {
if (listener != null) {
mListener = listen... | 万爽 | |
@RequiresPermissions("role:edit") | annotation | @GetMapping("/edit")
public String edit(Integer id, Model model) {
model.addAttribute("role", roleService.selectById(id));
model.addAttribute("currentPermissions", permissionService.selectByRoleId(id));
model.addAttribute("permissions", permissionService.selectAll());
return... | 万爽 | |
Boolean<method*start>java.lang.Boolean<method*end> status = authService.domainAuth<method*start>com.asofdate.hauth.service.AuthService.domainAuth<method*end>(request, domainId, "w").getStatus<method*start>com.asofdate.hauth.dto.AuthDTO.getStatus<method*end>();
if (!status) {
response.setStatus<method*start>... | 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>)
public String<method*start... | 万爽 | |
if (handler instanceof HandlerMethod) {
SSOToken token = SSOHelper.attrToken(request);
if (token == null) {
return true;
}
try {
return unauthorizedAccess(request, response);
} catch (Exception e) {
throw AoomsExceptions.create(e.g... | conventional | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
return true;
} | 万爽 | |
if (user == null) {
return ServerResponse.createByErrorCodeMessage(ResponseCode.NEED_LOGIN.getCode(), "用户未登录,请登录");
}
if (iUserService.checkAdminRole(user).isSuccess()) {
// 0->10000->100000
return iCategoryService.selectCategoryAndChildrenById(categoryId);
} else {
retur... | conventional | @RequestMapping("get_deep_category.do")
public ServerResponse<com.mmall.common.ServerResponse> getCategoryAndDeepChildrenCategory(HttpSession session, @RequestParam(value = "categoryId", defaultValue = "0") Integer categoryId) {
} | 万爽 | |
if (SSOConfig.getInstance().isPermissionUri()) {
String uri = request.getRequestURI();
if (uri == null || this.getAuthorization().isPermitted(token, uri)) {
return true;
}
} | conventional | protected boolean isVerification(HttpServletRequest request, Object handler, SSOToken token) {
HandlerMethod handlerMethod = (HandlerMethod) handler;
Method method = handlerMethod.getMethod();
Permission pm = method.getAnnotation(Permission.class);
if (pm != null) {
if (pm.action() == Action.Sk... | 万爽 | |
if (uuid == null) {
throw BizException.fail<method*start>com.momo.common.core.error.BizException.fail<method*end>("用户所在的企业不存在");
}
UserDO userDO = userMapper.uuid<method*start>com.momo.mapper.mapper.manual.UserMapper.uuid<method*end>(sysEnterpriseUserReq.getUuid<method*start>com.momo.mapper.req.aclm... | conventional | public String<method*start>java.lang.String<method*end> rolesToUser(SysEnterpriseUserReq<method*start>com.momo.mapper.req.aclmanager.SysEnterpriseUserReq<method*end> sysEnterpriseUserReq) {
UserGroupDO<method*start>com.momo.mapper.dataobject.UserGroupDO<method*end> uuid = userGroupMapper.uuid<method*start>com.... | 万爽 | |
if (perms != null && perms.length > 0) {
if (perms.length == 1) {
if (!subject.isPermitted(perms[0])) {
log.debug("授权认证:未通过");
isPermitted = false;
}
} else {
if (!subject.isPermittedAll(perms)) {
log.debug("授权认证:未通过... | conventional | @Override
protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) throws Exception {
Subject subject = getSubject(request, response);
String[] perms = (String[]) mappedValue;
boolean isPermitted = true;
return isPermitted;
} | 万爽 | |
String<method*start>java.lang.String<method*end>[] methods = e.getSupportedMethods<method*start>org.springframework.web.HttpRequestMethodNotSupportedException.getSupportedMethods<method*end>();
if (methods != null) {
for (String<method*start>java.lang.String<method*end> str : methods) {
sb.append<method*sta... | conventional | @ExceptionHandler<method*start>org.springframework.web.bind.annotation.ExceptionHandler<method*end>(HttpRequestMethodNotSupportedException<method*start>org.springframework.web.HttpRequestMethodNotSupportedException<method*end>.class)
public Result<method*start>org.jeecg.common.api.vo.Result<method*end><?> HttpRequestMe... | 万爽 | |
if (!aclReq.getSysAclParentIdStr().equals(0L)) {
if (null == aclDO) {
throw BizException.fail("父权限不存在");
}
if (!before.getSysAclPermissionCode().equals(aclDO.getSysAclPermissionCode())) {
throw BizException.fail("无法跨模块编辑");
}
after.setSysAclLevel(Level... | conventional | @Transactional
public String updateByPrimaryKeySelective(AclReq aclReq) {
AclDO before = aclMapper.selectByPrimaryUuid(aclReq.getUuid());
if (null == before) {
throw BizException.fail("待编辑的权限不存在");
}
if (before.getId().equals(aclReq.getSysAclParentIdStr())) {
throw BizException.fail("无法将... | 万爽 | |
String authorizeToken = ServerExtConfigBean.getInstance().getAuthorizeToken();
if (StrUtil.isEmpty(authorizeToken)) {
return;
}
if (authorizeToken.length() < 6) {
DefaultSystemLog.getLog().error("", new JpomRuntimeException("配置的授权token长度小于六位不生效"));
System.exit(-1);
}
int ... | conventional | @PreLoadMethod
private static void check() {
} | 万爽 | |
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) {
return this.client.getObjectAcl(bucketName, fileName).getPermission();
this.shutdown();
} | 万爽 | |
if (StrUtil.isNullOrEmpty(name)) {
throw new NullPointerException("获取API权限验证实现-->失败:工厂名字不能为空");
}
if (SESSION_TOKEN_AUTH.equalsIgnoreCase(name)) {
return new VxApiAuthSessionTokenImpl(options);
}
if (JWT_TOKEN_AUTH.equalsIgnoreCase(name)) {
return new VxApiAuthJwtTokenImpl(op... | conventional | public static VxApiAuth getVxApiAuth(String name, JsonObject options, VxApis api, HttpClient httpClient) throws NullPointerException, ClassNotFoundException {
throw new ClassNotFoundException("没有找到名字为 : " + name + " 的API权限验证实现类");
} | 万爽 | |
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 GetPushUrlRsp<method*start>com.tencent.qcloud.roomservice.pojo.Response.GetPushUrlRsp<method*end> getPushUrl(String<method*start>java.lang.String<method*end> userID, String<method*start>java.lang.String<method*end> token) {
GetPushUrlRsp<method*start>com.tencent.qcloud.roomservice.pojo.Response.Get... | 万爽 | |
// 没有权限
if (isAjax((HttpServletRequest) request)) {
response.setCharacterEncoding("utf-8");
response.setContentType("application/json; charset=utf-8");
PrintWriter writer = response.getWriter();
Map<String, Object> map = new HashMap<>();
map.put("code", 0);
map.pu... | conventional | @Override
protected boolean onPreHandle(ServletRequest request, ServletResponse response, Object mappedValue) throws Exception {
// 请求的url
String requestURL = getPathWithinApplication(request);
System.out.println("请求的url :" + requestURL);
Subject subject = SecurityUtils.getSubject();
if (!subject.is... | 万爽 | |
this.checkAuthorityRole(noticeAuthorityRole.getNoticeId(), noticeAuthorityRole.getRole().getId()) | conventional | public void saveTSNoticeAuthorityRole(TSNoticeAuthorityRole noticeAuthorityRole) {
if (this.checkAuthorityRole(noticeAuthorityRole.getNoticeId(), noticeAuthorityRole.getRole().getId())) {
throw new BusinessException("该角色已授权,请勿重复操作。");
} else {
final String noticeId = noticeAuthorityRole.getNotic... | 万爽 | |
if (user.isAdmin<method*start>com.dimple.project.system.domain.SysUser.isAdmin<method*end>()) {
roles.add<method*start>java.util.Set.add<method*end>("admin");
} else {
roles.addAll<method*start>java.util.Set.addAll<method*end>(roleService.selectRolePermissionByUserId<method*start>com.dimple.project.... | conventional | public Set<method*start>java.util.Set<method*end><String<method*start>java.lang.String<method*end>> getRolePermission(SysUser<method*start>com.dimple.project.system.domain.SysUser<method*end> user) {
Set<method*start>java.util.Set<method*end><String<method*start>java.lang.String<method*end>> roles = new HashSet<met... | 万爽 | |
if (userID == null || token == null) {
rsp.setCode(2);
rsp.setMessage("请求失败,缺少参数");
log.error("logout失败:缺少参数:" + "userID:" + userID + ",token: " + token);
return rsp;
}
if (imMgr.validation(userID, token) != 0) {
rsp.setCode(7);
rsp.setMessage("请求失败,鉴权失败");
... | conventional | @Override
public BaseRsp logout(String userID, String token) {
BaseRsp rsp = new BaseRsp();
// 删除session
imMgr.delLoginSession(userID);
return rsp;
} | 万爽 | |
if (isPermitted(request, path)) {
return true;
} else {
responseJson(response, SsoResultCode.SSO_PERMISSION_ERROR, '没有访问权限');
return false;
} | conventional | @Override
public boolean isAccessAllowed(HttpServletRequest request, HttpServletResponse response) throws IOException {
String path = request.getServletPath();
return true;
} | 万爽 | |
if (securityDigest != null) {
if (!sysUsers.getSecurityDigest<method*start>cms.bean.staff.SysUsers.getSecurityDigest<method*end>().equals<method*start>java.lang.String.equals<method*end>(securityDigest)) {
throw new AccessDeniedException<method*start>org.springframework.security.acce... | conventional | public void decide(Authentication<method*start>org.springframework.security.core.Authentication<method*end> authentication, Object<method*start>java.lang.Object<method*end> object, Collection<method*start>java.util.Collection<method*end><ConfigAttribute<method*start>org.springframework.security.access.ConfigAttribute<m... | 万爽 | |
// 调用设置管理员权限的方法
int ret = managerDAO.update(managerForm);
if (ret == 0) {
// 保存错误提示信息到error参数中
request.setAttribute("error", "设置管理员权限失败!");
// 转到错误提示页面
request.getRequestDispatcher("error.jsp").forward(request, response);
} else {
// 转到权限设置成功页面
request.getRequ... | conventional | private void managerModify(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
ManagerForm managerForm = new ManagerForm();
// 获取并设置管理员ID号
managerForm.setId(Integer.parseInt(request.getParameter("id")));
// 获取并设置管理员名称
managerForm.setName(request.getParame... | 万爽 | |
// 越过filters
resource = doLoad<method*start>com.alibaba.citrus.service.resource.impl.AbstractResourceLoadingContext.doLoad<method*end>(resourceName, options); | conventional | public ResourceTrace<method*start>com.alibaba.citrus.service.resource.ResourceTrace<method*end> getTrace() throws ResourceNotFoundException<method*start>com.alibaba.citrus.service.resource.ResourceNotFoundException<method*end> {
trace<method*start>com.alibaba.citrus.service.resource.impl.ResourceLoaderContextImpl.t... | 万爽 | |
int resultCount = userMapper.checkPassword<method*start>com.mmall.dao.UserMapper.checkPassword<method*end>(MD5Util.MD5EncodeUtf8<method*start>com.mmall.util.MD5Util.MD5EncodeUtf8<method*end>(passwordOld), user.getId<method*start>com.mmall.pojo.User.getId<method*end>());
if (resultCount == 0) {
return Server... | conventional | public ServerResponse<method*start>com.mmall.common.ServerResponse<method*end><String<method*start>java.lang.String<method*end>> resetPassword(String<method*start>java.lang.String<method*end> passwordOld, String<method*start>java.lang.String<method*end> passwordNew, User<method*start>com.mmall.pojo.User<method*end> use... | 万爽 | |
// 规则:只要有一个权限点有权限,那么我们就认为有访问权限
for (String<method*start>java.lang.String<method*end> aclUrl : userAclIdSet) {
if (StringUtils.isBlank<method*start>org.apache.commons.lang3.StringUtils.isBlank<method*end>(aclUrl)) {
continue;
}
if (url.equals<method*start... | conventional | public boolean hasUrlAcl(HasAclReq<method*start>com.momo.mapper.req.sysmain.HasAclReq<method*end> hasAclReq) {
if (StringUtils.isBlank<method*start>org.apache.commons.lang3.StringUtils.isBlank<method*end>(hasAclReq.getUrl<method*start>com.momo.mapper.req.sysmain.HasAclReq.getUrl<method*end>())) {
return fal... | 万爽 | |
// 检查该权限是否已经获取
int i = checkSelfPermission(mPermissions[0]);
// 权限是否已经 授权 GRANTED---授权 DINIED---拒绝
if (i != PackageManager.PERMISSION_GRANTED) {
// 提示用户应该去应用设置界面手动开启权限
showDialogTipUserGoToAppSettting();
} else {
if (mDialog != null && mDialog... | conventional | @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 123) {
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
}
}
} | 万爽 | |
List<method*start>java.util.List<method*end><String> noPermission = new ArrayList<method*start>java.util.ArrayList<method*end><>();
int i = ContextCompat.checkSelfPermission<method*start>android.support.v4.content.ContextCompat.checkSelfPermission<method*end>(context, permission);
if (i == Package... | annotation | @RequiresApi<method*start>android.support.annotation.RequiresApi<method*end>(api<method*start>android.support.annotation.RequiresApi.api<method*end> = Build.VERSION_CODES.M<method*start>android.os.Build.VERSION_CODES.M<method*end>)
public static boolean checkPermission(Context<method*start>android.content.Context<metho... | 万爽 | |
try {
UserPo loginUser = (UserPo) request.getSession().getAttribute(RtConstant.KEY_USER_PO);
if (loginUser.isCanWriteUser()) {
logger.info("用户{}更新用户权限,用户名:{}", loginUser.getUsername(), user.getUsername());
userService.updateUserPermissionByUsername(user);
} else {
... | conventional | @RequestMapping(value = { "/updateUserPermissionByUsername" })
@ResponseBody
public ResponseVo<String> updateUserPermissionByUsername(HttpServletRequest request, @RequestBody UserPo user) {
ResponseVo<String> responseVo = new ResponseVo<>();
return responseVo;
} | 万爽 | |
checkRole(user); | conventional | @Override
@Transactional
public void updateUserRole(SysUser user) {
if (StringUtils.isBlank(user.getPassword())) {
user.setPassword(null);
} else {
user.setPassword(passwordEncoder.encode(user.getPassword()));
}
baseMapper.updateById(user);
sysUserRoleMapper.delete(Wrappers.<SysUserR... | 万爽 | |
// 防止横向越权,要校验用户的旧密码
int resCount = userMapper.checkPassword(MD5Util.MD5EncodeUtf8(passwordOld), user.getId());
if (resCount == 0) {
return ServerResponse.createByError("旧密码错误");
} | conventional | @Override
public ServerResponse<String> resetPassword(String passwordNew, String passwordOld, User user) {
user.setPassword(MD5Util.MD5EncodeUtf8(passwordNew));
int updateCount = userMapper.updateByPrimaryKeySelective(user);
if (updateCount > 0) {
return ServerResponse.createBySuccessMessage("密码更新成... | 万爽 | |
// 如果没有禁用安全检查,那么需要检查显式访问权限
if (!override<method*start>java.lang.reflect.AccessibleObject.override<method*end>) {
Class<method*start>java.lang.Class<method*end><?> caller = Reflection.getCallerClass<method*start>jdk.internal.reflect.Reflection.getCallerClass<method*end>();
checkAccess<method*start>java... | conventional | @CallerSensitive<method*start>jdk.internal.reflect.CallerSensitive<method*end>
@ForceInline<method*start>jdk.internal.vm.annotation.ForceInline<method*end>
@HotSpotIntrinsicCandidate<method*start>jdk.internal.HotSpotIntrinsicCandidate<method*end>
public Object<method*start>java.lang.Object<method*end> invoke(Object<me... | 万爽 | |
// 拦截器.
Map<String, String> map = new HashMap<>();
// 配置不会被拦截的链接 顺序判断 相关静态资源
map.put("/static/**", "anon");
// 配置退出 过滤器,其中的具体的退出代码Shiro已经替我们实现了
map.put("/admin/logout", "logout");
// <!-- 过滤链定义,从上向下顺序执行,一般将/**放在最为下边 -->:这是一个坑呢,一不小心代码就不好使了;
// <!-- authc:所有url都必须认证通过才可以访问; anon:所有url都都可以... | conventional | @Bean
public ShiroFilterFactoryBean shiroFilter(@Qualifier("securityManager") SecurityManager securityManager) {
log.info("开始配置shiroFilter...");
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
shiroFilterFactoryBean.setSecurityManager(securityManager);
Map<String, Filter> f... | 万爽 | |
if (!hasBizPermission(request, apiDataType.getBizId())) {
return new ReturnT(ReturnT.FAIL_CODE, "您没有相关业务线的权限,请联系管理员开通");
}
List<XxlApiDataTypeField> list = xxlApiDataTypeFieldDao.findByFieldDatatypeId(id);
if (list != null && list.size() > 0) {
return new ReturnT(ReturnT.FAIL_CODE, "该数据类型被引用中,拒绝删除");
}
List<X... | conventional | @RequestMapping("/deleteDataType")
@ResponseBody
public ReturnT<String> deleteDataType(HttpServletRequest request, int id) {
XxlApiDataType apiDataType = xxlApiDataTypeDao.load(id);
if (apiDataType == null) {
return new ReturnT(ReturnT.FAIL_CODE, "数据类型ID非法");
}
int ret = xxlApiDataTypeDao.delet... | 万爽 | |
if (loader == null && ccl != null) {
sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION);
} | conventional | private static void checkProxyAccess(Class<?> caller, ClassLoader loader, Class<?>... interfaces) {
SecurityManager sm = System.getSecurityManager();
if (sm == null) {
return;
}
ClassLoader ccl = caller.getClassLoader();
ReflectUtil.checkProxyPackageAccess(ccl, interfaces);
} | 万爽 |
End of preview. Expand in Data Studio
- Downloads last month
- 13