validation stringlengths 16 3.54k | validationType stringclasses 2
values | function stringlengths 49 6.38k | author stringclasses 5
values | context stringclasses 5
values |
|---|---|---|---|---|
if (interfaceRuleDto == null) {
return Result.error("您没有该接口的权限!");
}
| conventional | @ApiOperation(value = "根据ID获取黑名单信息", notes = "根据ID获取黑名单信息", httpMethod = "GET", produces = "application/json")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public ResponseMessage<?> get(@PathVariable("id") String id, HttpServletRequest request) {
InterfaceRuleDto interfaceRuleDto = Int... | 万爽 | |
ID user = getRequestUser(request);
Assert.isTrue(Application.getSecurityManager().allow(user, ZeroEntry.AllowCustomDataList), "没有权限"); | conventional | @RequestMapping(value = "list-fields", method = RequestMethod.POST)
@Override
public void sets(@PathVariable String entity, HttpServletRequest request, HttpServletResponse response) throws IOException {
JSON config = ServletUtils.getRequestJson(request);
ID cfgid = getIdParameter(request, "id");
if (cf... | 万爽 | |
checkAccess(file, true, false); | conventional | @Override
public List<AclEntry<AclEntry>> getAcl() throws IOException {
/* GetFileSecurity does not follow links so when following links we need the final target */
String path = WindowsLinkSupport.getFinalPath(file, followLinks);
/*
* ALLOW and DENY entries in DACL;
* AUDIT entries in SACL (ignor... | 肖敬先 | |
if (permission != null) {
needLogin = permission.limit();
needAdminuser = permission.superUser();
}
// if pass
if (needLogin) {
XxlApiUser loginUser = loginService.ifLogin(request);
if (loginUser == null) {
response.sendRedirect(request.getContextPath() + "/toLogi... | conventional | @Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
if (!(handler instanceof HandlerMethod)) {
return super.preHandle(request, response, handler);
}
// if need login
boolean needLogin = true;
boolean needAdminuser = ... | 肖敬先 | |
boolean isAdmin = (Boolean) session.getAttribute("isAdmin");
if (!isAdmin) {
Set<String> actions = (Set<String>) session.getAttribute("allActions");
String aname = hm.getBean().getClass().getName() + "." + hm.getMethod().getName();
if (!actions.contains(aname))
... | conventional | @SuppressWarnings("unchecked")
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
HttpSession session = request.getSession();
String sid = request.getParameter("sid");
if (sid != null && !"".equals(sid.trim())) {
sessi... | 肖敬先 | |
if (tableBlackList != null && !tableBlackList.isEmpty()) {
for (String tn : tableBlackList) {
if (tableUCN.equals(tn.toUpperCase())) {
error("请求的表:" + tableName + "在黑名单中");
return;
}
}
}
if (tableWhiteList != null && !tableWhiteList.isEmpty... | conventional | private void validateTable(String tableName) {
String tableUCN = tableName.toUpperCase();
return
} | 肖敬先 | |
ValidatorUtils.validateEntity(config);
if (config.getType() == Constant.CloudService.QINIU.getValue()) {
ValidatorUtils.validateEntity(config, QiniuGroup.class);
} else if (config.getType() == Constant.CloudService.ALIYUN.getValue()) {
ValidatorUtils.validateEntity(config, AliyunGroup.class);
} else if (config.... | conventional | @Log("保存云存储配置信息")
@ApiOperation(value = "保存云存储配置信息", notes = "权限编码(oss:file:config)")
@PostMapping("/saveConfig")
@RequiresPermissions("oss:file:saveConfig")
public JsonResponse saveConfig(@RequestBody(required = false) CloudStorageConfig config) {
sysConfigService.updateValueByKey(KEY, JSON.toJSONString(config));
... | 肖敬先 | |
ID roleId = getIdParameterNotNull(request, "role");
if (RoleService.ADMIN_ROLE.equals(roleId)) {
writeFailure(response, "系统内建管理员角色,不允许修改。此角色拥有高级系统权限,请谨慎使用");
return;
} | conventional | @RequestMapping("privileges-list")
public void privilegesList(HttpServletRequest request, HttpServletResponse response) throws IOException {
ID roleId = getIdParameterNotNull(request, "role");
Object[][] array = Application.createQuery("select entity,definition,zeroKey from RolePrivileges where roleId = ?"... | 肖敬先 | |
@RequiresPermissions<method*start>org.apache.shiro.authz.annotation.RequiresPermissions<method*end>("user") | annotation | @RequestMapping<method*start>org.springframework.web.bind.annotation.RequestMapping<method*end>(value<method*start>org.springframework.web.bind.annotation.RequestMapping.value<method*end> = "treeselect")
public String<method*start>java.lang.String<method*end> treeselect(HttpServletRequest<method*start>javax.servlet.htt... | 肖敬先 | |
if (!mcfg.isMemberOn()) {
return FrontUtils.showMessage(request, model, "member.memberClose");
}
if (user == null) {
return FrontUtils.showLogin(request, model, site);
}
CmsMessage message = messageMng.findById(id);
// 非发件人无权查看信件
if (!message.getMsgSendUser().equals(user)) {
... | annotation | @RequestMapping(value = "/member/message_edit.jspx")
public String message_edit(Integer id, HttpServletRequest request, HttpServletResponse response, ModelMap model) {
CmsSite site = CmsUtils.getSite(request);
CmsUser user = CmsUtils.getUser(request);
FrontUtils.frontData(request, model, site);
MemberCo... | 肖敬先 | |
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) {
return Hret.error<method*start>c... | 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... | 肖敬先 | |
switch(((HttpException) e).code()) {
case 403:
mErrorMsg = "没有权限访问此链接!";
break; | conventional | @Override
public void onError(Throwable e) {
if (mView == null) {
return;
}
if (e instanceof HttpException) {
switch(((HttpException) e).code()) {
case 403:
mErrorMsg = "没有权限访问此链接!";
break;
case 504:
if (!NetUtil.isConne... | 肖敬先 | |
@ApiResponse<method*start>io.swagger.annotations.ApiResponse<method*end>(code<method*start>io.swagger.annotations.ApiResponse.code<method*end> = 401, message<method*start>io.swagger.annotations.ApiResponse.message<method*end> = "没有权限", response<method*start>io.swagger.annotations.ApiOperation.response<method*end> = Err... | annotation | @RequestMapping<method*start>org.springframework.web.bind.annotation.RequestMapping<method*end>("/client/save")
@ApiResponses<method*start>io.swagger.annotations.ApiResponses<method*end>(value<method*start>io.swagger.annotations.ApiResponses.value<method*end> = { @ApiResponse<method*start>io.swagger.annotations.ApiResp... | 肖敬先 | |
@PreAuthorize("hasAnyAuthority('ROLE_ADMIN','ROLE_USER','ROLE_VISTOR')") | annotation | @DeleteMapping("/{id}")
@Transactional
public ResponseEntity<Response<com.whichard.spring.boot.blog.vo.Response>> delete(@PathVariable("id") Long blogId, @RequestParam(value = "voteId", required = true) Long voteId) {
User principal = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
... | 肖敬先 | |
@RequiresPermissions<method*start>org.apache.shiro.authz.annotation.RequiresPermissions<method*end>("ueboot:role:delete") | annotation | @PostMapping<method*start>org.springframework.web.bind.annotation.PostMapping<method*end>(value<method*start>org.springframework.web.bind.annotation.RequestMapping.value<method*end> = "/delete")
public Response<method*start>com.ueboot.core.http.response.Response<method*end><String<method*start>java.lang.String<method*e... | 肖敬先 | |
boolean result = userGroupService.checkUuserPower(groupName, user.getUserId());
if (result) {
body.render(env.getOut());
} | conventional | @Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException {
DefaultObjectWrapperBuilder builder = new DefaultObjectWrapperBuilder(Configuration.VERSION_2_3_25);
User user =... | 肖敬先 | |
if (configuration.getTunnelSignatureKey<method*start>com.qcloud.weapp.Configuration.getTunnelSignatureKey<method*end>() == null)
throw new ConfigurationException<method*start>com.qcloud.weapp.ConfigurationException<method*end>("SDK 密钥配置不能为空"); | conventional | public static void setup(Configuration<method*start>com.qcloud.weapp.Configuration<method*end> configuration) throws ConfigurationException<method*start>com.qcloud.weapp.ConfigurationException<method*end> {
currentConfiguration = configuration;
if (configuration == null) {
throw new ConfigurationException<metho... | 肖敬先 | |
if (!adminUser.getRole().equals("a")) {
return "/admin/login";
}
if (adminUser == null) {
return "/admin/login";
} | conventional | @RequestMapping("/adminLogin")
public String adminLogin(String name, String password, String captcha, HttpSession session) {
User adminUser = userService.findUser(name, password);
session.setAttribute("user", adminUser);
return "/admin/index";
} | 肖敬先 | |
if (!StringUtils.isEmpty(resource.getUrl()) && !StringUtils.isEmpty(resource.getPermission())) {
if (!"".equals(resource.getPermission().trim())) {
if (resource.getVerification()) {
permsList.add(0, new String[] { resource.getUrl() + "/**", "perms[" + resource... | conventional | @Override
public Map<String, String> getFilterChainDefinitionMap() {
Map<String, String> filterChainDefinitionMap = new LinkedHashMap<>();
List<String[]> permsList = new LinkedList<>();
List<String[]> anonList = new LinkedList<>();
List<SysResource> resources = resourceService.list();
if (resources ... | 肖敬先 | |
if (interfaceRuleDto == null) {
return Result.error("您没有该接口的权限!");
} | conventional | @RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据ID获取jeecgDemo信息", notes = "根据ID获取jeecgDemo信息", httpMethod = "GET", produces = "application/json")
public ResponseMessage<?> get(@ApiParam(required = true, name = "id", value = "ID") @PathVariable("id") String id, HttpSer... | 肖敬先 | |
case "create":
if (!"create".equals<method*start>java.lang.String.equals<method*end>(crudConfig.retrievePermission<method*start>cn.ffast.core.annotations.CrudConfig.retrievePermission<method*end>())) {
AnnotationUtils.setAnnotationValue<method*start>cn.ffast.core.utils.Annota... | conventional | @PostConstruct
private void initCrudController() {
CrudConfig<method*start>cn.ffast.core.annotations.CrudConfig<method*end> crudConfig = getCrudConfig<method*start>cn.ffast.core.support.BaseCrudController.getCrudConfig<method*end>();
if (crudConfig != null) {
Method<method*start>java.lang.reflect.M... | 肖敬先 | |
if (ReflectUtil.needsPackageAccessCheck<method*start>sun.reflect.misc.ReflectUtil.needsPackageAccessCheck<method*end>(caller.getClassLoader<method*start>java.lang.Class.getClassLoader<method*end>(), ihClass.getClassLoader<method*start>java.lang.Class.getClassLoader<method*end>())) {
ReflectUtil.checkPackageAcce... | conventional | @CallerSensitive
public static InvocationHandler<method*start>java.lang.reflect.InvocationHandler<method*end> getInvocationHandler(Object<method*start>java.lang.Object<method*end> proxy) throws IllegalArgumentException<method*start>java.lang.IllegalArgumentException<method*end> {
final InvocationHandler<method... | 肖敬先 | |
AccessRequired accessRequired = ((HandlerMethod) handler).getMethodAnnotation(AccessRequired.class);
AdminReqired adminReqired = ((HandlerMethod) handler).getMethodAnnotation(AdminReqired.class);
if (adminReqired != null && adminReqired.validate()) {
User user = (User) httpServletRequest.getSession().getAttribute(... | conventional | @Override
public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object handler) throws Exception {
if (handler.getClass().isAssignableFrom(HandlerMethod.class)) {
return true;
}
return true;
} | 肖敬先 | |
// 校验
if (service.verify<method*start>com.egzosn.pay.union.api.UnionPayService.verify<method*end>(params)) {
// 支付校验通过后的处理
// ......业务逻辑处理块........
} | conventional | @RequestMapping<method*start>org.springframework.web.bind.annotation.RequestMapping<method*end>(value<method*start>java.lang.annotation.Retention.value<method*end> = "microPay")
public Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object<method*start>java.lang.Object<metho... | 万爽 | |
if (!user.equals(createdBy[0])) {
throw new DataSpecificationException("无权删除他人目录");
} | conventional | @Override
public int delete(ID recordId) {
Object inFolder = Application.createQueryNoFilter("select inFolder from Attachment where inFolder = ?").setParameter(1, recordId).unique();
if (inFolder != null) {
throw new DataSpecificationException("目录内有文件不能删除");
}
Object parent = Application.createQ... | 万爽 | |
if (manager != null && manager.getUsername<method*start>com.hibernate.model.Login.getUsername<method*end>().equals<method*start>java.lang.String.equals<method*end>("mr")) | conventional | protected ModelAndView<method*start>org.springframework.web.servlet.ModelAndView<method*end> onSubmit(HttpServletRequest<method*start>javax.servlet.http.HttpServletRequest<method*end> request, HttpServletResponse<method*start>javax.servlet.http.HttpServletResponse<method*end> response, Object<method*start>java.lang.Obj... | 万爽 | |
if (!dir.canWrite()) {
throw new IOException("上传目录没有写权限");
} | conventional | @Override
public String save(MultipartFile file, byte[] bytes, IUploadContext context) throws UploadException, IOException {
if (StringUtils.isBlank(this.dir)) {
throw new UploadException("文件保存路径不存在");
}
if (StringUtils.isBlank(urlPrefix)) {
urlPrefix = String.format("%s://%s/", context.getS... | 万爽 | |
String noAuthPage = getServiceDegardingPage();
if (StringUtils.isNotEmpty(requestAccept)) {
if (StringUtils.contains(requestAccept, "application/json") || StringUtils.contains(requestAccept, "text/javascript") || StringUtils.contains(requestAccept, "text/json")) {
contentType = "application/json";
}
} | conventional | public void serviceDegardingPage(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String servletPath = request.getServletPath();
request.setAttribute("currentUrl", servletPath);
String requestAccept = request.getHeader("accept");
String contentType = "text... | 万爽 | |
if (null == sysRole) {
return Result.error<method*start>my.common.beans.Result.error<method*end>("[0]无效编码!");
} | conventional | @PostMapping({ "delete" })
@ResponseBody
public Result<method*start>my.common.beans.Result<method*end> delete(SysRole<method*start>my.admin.model.SysRole<method*end> row) {
Map<method*start>java.util.Map<method*end><String<method*start>java.lang.String<method*end>, Object> paras = new HashMap<method*start>java.util... | 万爽 | |
// 检查权限
if (ContextCompat<method*start>android.support.v4.content.ContextCompat<method*end>.checkSelfPermission(this, Manifest<method*start>android.Manifest<method*end>.permission.READ_EXTERNAL_STORAGE) != PackageManager<method*start>android.content.pm.PackageManager<method*end>.PERMISSION_GRANTED) {
RxPermissions<... | conventional | private void requestDynamicPermissions() {
} | 万爽 | |
// 先判断登陆用户是否存在
SysUser user = userRepository.findByUserName(userName);
if (user == null) {
throw new UsernameNotFoundException("Cannot find user by username: " + userName);
}
// 登录用户存在的情况加载用户的权限
List<SysAuthority> roleList = authorityRepository.findByUserId(user.getId());
List<GrantedAuthority> grantedAuthorities =... | conventional | @Override
public UserDetails loadUserByUsername(String userName) throws UsernameNotFoundException {
return new User(user.getUserName(), user.getPassword(), grantedAuthorities);
} | 万爽 | |
if (crmBusiness.getOwnerUserId<method*start>com.kakarote.crm9.erp.crm.entity.base.BaseCrmBusiness.getOwnerUserId<method*end>() != null) {
Record<method*start>com.jfinal.plugin.activerecord.Record<method*end> ownerUser = Db.findFirst<method*start>com.jfinal.plugin.activerecord.Db.findFirst<method*end>(Db.getSql<... | conventional | public List<method*start>java.util.List<method*end><Record<method*start>com.jfinal.plugin.activerecord.Record<method*end>> getMembers(Integer<method*start>java.lang.Integer<method*end> businessId) {
CrmBusiness<method*start>com.kakarote.crm9.erp.crm.entity.CrmBusiness<method*end> crmBusiness = CrmBusiness.dao.findB... | 万爽 | |
@RequiresPermissions("oss:file:upload") | annotation | @ApiOperation(value = "文件上传", notes = "权限编码(oss:file:upload)")
@PostMapping("/upload")
public JsonResponse<com.king.common.utils.JsonResponse> upload(@RequestParam(value = "file", required = false) MultipartFile file) throws Exception {
if (file.isEmpty()) {
throw new RRException("上传文件不能为空");
}
// 上... | 万爽 | |
// 校验操作用户当前的操作是否具有此操作权限
boolean isSuccess = limitService.verify(user, operation, resources, dataDom);
if (isSuccess) {
filterChain.doFilter(request, response);
} else {
output(response, LimitsResult.failure().noPermission());
return;
} | conventional | public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain) throws IOException, ServletException {
// 获取当前操作用户信息
User user = ParamUtils.getUser(request);
// 解析出当前操作
Operation operation = ParamUtils.getOperation(request);
// 解析出当前操作的资源
List<Resource> resources ... | 肖敬先 | |
// 验证所属俱乐部
if (itemInDb == null || !itemInDb.getClubId<method*start>com.stylefeng.guns.modular.system.model.ClubCoach.getClubId<method*end>().equals(clubId)) {
return ResponseEntity.ok<method*start>org.springframework.http.ResponseEntity.ok<method*end>(new ReturnTip<method*start>com.stylefeng.guns.rest.comm... | conventional | @SuppressWarnings("unchecked")
@RequestMapping(value<method*start>org.springframework.web.bind.annotation.RequestMapping.value<method*end> = "/detail")
@ResponseBody
public Object<method*start>java.lang.Object<method*end> detail() {
HttpServletRequest<method*start>javax.servlet.http.HttpServletRequest<method*end> r... | 肖敬先 | |
if (session.getAttribute("UserInfo_session") != null) | conventional | @RequestMapping(value = "app/user/user_info{user_info_id}/edit", produces = { "application/json;charset=UTF-8" })
@ResponseBody
public String user_info_edit(@RequestBody String result, HttpServletRequest request, HttpSession session) {
try {
long user_info_id = Long.valueOf(request.getParameter... | 肖敬先 | |
if (UserRealm.SUPER_USER.equals(username)) {
return this.resourcesRepository.findAll();
}
permissions.forEach((p) -> {
resourcesMap.put(p.getResource().getId(), p.getResource());
}); | conventional | @Override
public Collection<Resources> getUserResources(String username) {
// root用户返回所有菜单,防止root账户还需要授权才能访问
// 找出用户的角色,根据角色查找用户的菜单
// 直接调用shiroService的实现方式,防止使用框架方需要自定义角色获取方式
Set<String> roleNames = shiroService.getUserRoleNames(username);
List<Permission> permissions = permissionRepository.fi... | 肖敬先 | |
InterfaceRuleDto interfaceRuleDto = InterfaceUtil.getInterfaceRuleDto(request, InterfaceEnum.jeecgdemo_list);
if (interfaceRuleDto == null) {
return Result.error("您没有该接口的权限!");
} | conventional | @RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "jeecgDemo列表信息", produces = "application/json", httpMethod = "GET")
public ResponseMessage<Map<String, Object>> list(@RequestParam("pageNo") int pageNo, @RequestParam("pageSize") int pageSize, JeecgDemoEntity entity, HttpSe... | 肖敬先 | |
// 防止 url 写错
if (!access_token_uri.contains<method*start>java.lang.String.contains<method*end>("token") || !authorization_uri.contains<method*start>java.lang.String.contains<method*end>("authorize"))
throw new RuntimeException<method*start>java.lang.RuntimeException<method*end>("uri is wrong : access_t... | conventional | public OAuth2RestOperations<method*start>org.springframework.security.oauth2.client.OAuth2RestOperations<method*end> authorizationCodeRestTemplate(String<method*start>java.lang.String<method*end> client_id, String<method*start>java.lang.String<method*end> client_secret, String<method*start>java.lang.String<method*end> ... | 肖敬先 | |
if (!BaseUtil.getUserId<method*start>com.kakarote.crm9.utils.BaseUtil.getUserId<method*end>().equals<method*start>java.lang.Long.equals<method*end>(BaseConstant.SUPER_ADMIN_USER_ID<method*start>com.kakarote.crm9.common.constant.BaseConstant.SUPER_ADMIN_USER_ID<method*end>) && !BaseUtil.getUser<method*start>com.kakarote... | conventional | public R<method*start>com.kakarote.crm9.utils.R<method*end> deleteByIds(String<method*start>java.lang.String<method*end> customerIds) {
String<method*start>java.lang.String<method*end>[] idsArr = customerIds.split<method*start>java.lang.String.split<method*end>(",");
List<method*start>java.util.List<method*end>... | 肖敬先 | |
if (e.getError().getErrorCode() == 48001) {
this.logger.info("该公众号没有获取用户信息权限!");
} | conventional | @Override
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map<String, Object> context, WxMpService weixinService, WxSessionManager sessionManager) throws WxErrorException {
this.logger.info("新关注用户 OPENID: " + wxMessage.getFromUser());
// 获取微信用户基本信息
try {
WxMpUser userWxInfo = weixinService... | 肖敬先 | |
if (cellVal.toString<method*start>java.lang.Object.toString<method*end>().equals<method*start>java.lang.String.equals<method*end>(DataListWrapper.NO_READ_PRIVILEGES<method*start>com.rebuild.server.helper.datalist.DataListWrapper.NO_READ_PRIVILEGES<method*end>)) {
cellVal = "[无权限]";
} | conventional | protected List<method*start>java.util.List<method*end><List<method*start>java.util.List<method*end><Object<method*start>java.lang.Object<method*end>>> buildData(DefaultDataListControl<method*start>com.rebuild.server.helper.datalist.DefaultDataListControl<method*end> control) {
JSONArray<method*start>com.alibaba.fas... | 肖敬先 | |
Authentication authentication = authenticationManager.authenticate(new PlainTextUsernamePasswordAuthenticationRequest(username, password));
| conventional | @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 = ... | 肖敬先 | |
if (currentUser.hasRole<method*start>org.apache.shiro.subject.Subject.hasRole<method*end>("role2")) {
System.out.println<method*start>java.io.PrintStream.println<method*end>("有role2这个角色");
} else {
System.out.println<method*start>java.io.PrintStream.println<method*end>("没有role2这个角色");
} | conventional | @Test
public void hasRoleTest() {
Subject<method*start>org.apache.shiro.subject.Subject<method*end> currentUser = ShiroUtil.login<method*start>authorization.ShiroUtil.login<method*end>("classpath:shiro_role.ini", "jack", "123456");
boolean[] results = currentUser.hasRoles<method*start>org.apache.shiro.subject.... | 肖敬先 | |
boolean canGet = EfoApplication.settings.getBooleanUseEval(ConfigConsts.ANONYMOUS_VISIBLE_OF_SETTING) || (Checker.isNotNull(user) && user.getIsVisible() == 1);
if (canGet){
} else {
jsonObject.put("error", "权限被限制,无法获取资源,请联系管理员");
return jsonObject.toString();
} | conventional | @ApiOperation(value = "获取文件记录")
@ApiImplicitParams({ @ApiImplicitParam(name = "offset", value = "偏移量", required = true), @ApiImplicitParam(name = "categoryId", value = "分类ID", required = true), @ApiImplicitParam(name = "orderBy", value = "排序方式", required = true, example = "id desc"), @ApiImplicitParam(name = "search", ... | 肖敬先 | |
if (authorization == null || "".equals<method*start>java.lang.String.equals<method*end>(authorization.trim<method*start>java.lang.String.trim<method*end>())) {
throw RequestException.fail<method*start>cn.licoy.wdog.common.exception.RequestException.fail<method*end>("未含授权标示,禁止访问");
}
if (e.getMessage<method*... | conventional | public static boolean executeLogin(ServletRequest<method*start>javax.servlet.ServletRequest<method*end> request) {
HttpServletRequest<method*start>javax.servlet.http.HttpServletRequest<method*end> httpServletRequest = (HttpServletRequest<method*start>javax.servlet.http.HttpServletRequest<method*end>) request;
S... | 肖敬先 | |
if (user != null || (menu != null && menu.access()) || handlerMethod.getBean() instanceof BasicErrorController) {
filter = true;
if (user != null && StringUtils.isNotBlank(user.getId())) {
getUserProxy().attachOrgansPropertiesForUser(user);
getUserProxy().attachRolesMap(user);
request.ge... | 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... | 肖敬先 | |
if (oConvertUtils.isEmpty(token)) {
return Result.error("退出登录失败!");
} | conventional | @RequestMapping(value = "/logout")
public Result logout(HttpServletRequest request, HttpServletResponse response) {
// 用户退出逻辑
String token = request.getHeader(DefContants.X_ACCESS_TOKEN);
String username = JwtUtil.getUsername(token);
LoginUser sysUser = sysBaseAPI.getUserByName(username);
if (s... | 肖敬先 | |
if (interfaceRuleDto == null) {
return Result.error<method*start>org.jeecgframework.jwt.util.Result.error<method*end>("您没有该接口的权限!");
} | 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>, consumes<method*start>org.... | 肖敬先 | |
// 判断账号是否超过停用时间
if (StrUtil.isNotBlank<method*start>com.xiaoleilu.hutool.util.StrUtil.isNotBlank<method*end>(user.getEndTime<method*start>org.superboot.entity.jpa.SuperbootUser.getEndTime<method*end>())) {
long num = DateUtils.getSecondDiffer<method*start>org.superboot.utils.DateUtils.getSecondDiffer<metho... | conventional | @Override
public BaseResponse<method*start>org.superboot.base.BaseResponse<method*end> login(LoginUser<method*start>org.superboot.entity.request.LoginUser<method*end> loginUser) throws BaseException<method*start>org.superboot.base.BaseException<method*end> {
String<method*start>java.lang.String<method*end> usercode... | 肖敬先 | |
@RequiresPermissions("oss:pdf:upload") | annotation | @ApiOperation(value = "文件上传", notes = "权限编码(oss:pdf:upload)")
@PostMapping("/upload")
public JsonResponse upload(@RequestParam(value = "file", required = false) MultipartFile file) throws Exception {
if (file.isEmpty()) {
return JsonResponse.error("上传文件不能为空");
} else if (file.getOriginalFilename().endsW... | 肖敬先 | |
if (StringUtil.isBlank(openId) || "undefined".equals(openId)) {
retData.setCode(ResultCodeMessage.PARMS_ERROR);
retData.setMessage("未授权,请退出再试");
return retData;
} | conventional | @RequestMapping("getMeeting")
public RetData<com.cn.xmf.base.model.RetData> getMeeting(HttpServletRequest request) {
RetData<com.cn.xmf.base.model.RetData> retData = new RetData<com.cn.xmf.base.model.RetData>();
Meeting retmeeting = null;
String openId = request.getParameter("openId");
String key =... | 肖敬先 | |
UserInfo userInfo = (UserInfo) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
Message message = new Message();
if (!userInfo.getAuthorities().toString().contains("ROLE_ADMIN")) {
message.setResult("权限错误!");
message.setMessageInfo("只有管理员才可以添加管理员!");
return message;... | conventional | @RequestMapping(value = { "/admin/add-admin" }, method = RequestMethod.POST)
@ResponseBody
public Message addUser(@RequestBody User user) {
UserInfo userInfo = (UserInfo) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
Message message = new Message();
user.setCreateTime(new Date(... | 肖敬先 | |
if (user == null || !Application.getSecurityManager<method*start>com.rebuild.server.Application.getSecurityManager<method*end>().allowRead<method*start>com.rebuild.server.service.bizz.privileges.SecurityManager.allowRead<method*end>(user, entity.getEntityCode<method*start>cn.devezhao.persist4j.Entity.getEntityCode<meth... | conventional | public static ChartData<method*start>com.rebuild.server.business.charts.ChartData<method*end> create(JSONObject<method*start>com.alibaba.fastjson.JSONObject<method*end> config, ID<method*start>cn.devezhao.persist4j.engine.ID<method*end> user) throws ChartsException<method*start>com.rebuild.server.business.charts.Charts... | 肖敬先 | |
boolean isok = user_serv.canFindPass(u, key);
if (null == vcode || vcode.isEmpty()) {
// 点邮件过来或者直接非法访问的
if (isok) {
mav.addObject("key", key);
mav.addObject("u", u);
} else {
rep.sendError(500, msg_50X);
} | conventional | @RequestMapping("/findpass.do")
public ModelAndView findpass(HttpServletRequest req, HttpServletResponse rep, String u, String key, String vcode, String password1, String password2, RedirectAttributes attr) {
ModelAndView mav = new ModelAndView("/admin/pub/findpass");
String msg_50X = "授权码过期或者非法操作!";
try {
... | 肖敬先 | |
// 如果存在安全管理器,则需要检查删除权限
file.checkDelete(); | conventional | @Override
boolean implDelete(Path path, boolean failIfNotExists) throws IOException {
// 将Path强制转换为WindowsPath
WindowsPath file = WindowsPath.toWindowsPath(path);
WindowsFileAttributes attrs = null;
try {
attrs = WindowsFileAttributes.get(file, false);
if (attrs.isDirectory() || attrs.is... | 肖敬先 | |
if (!hasBizPermission(request, apiDataType.getBizId<method*start>com.xxl.api.admin.core.model.XxlApiDataType.getBizId<method*end>())) {
return new ReturnT<method*start>com.xxl.api.admin.core.model.ReturnT<method*end><String<method*start>java.lang.String<method*end>>(ReturnT.FAIL_CODE<method*start>com.xxl.api.a... | conventional | @RequestMapping<method*start>org.springframework.web.bind.annotation.RequestMapping<method*end>("/deleteDataType")
@ResponseBody<method*start>org.springframework.web.bind.annotation.ResponseBody<method*end>
public ReturnT<method*start>com.xxl.api.admin.core.model.ReturnT<method*end><String<method*start>java.lang.String... | 肖敬先 | |
if (!isValidApp(request)) {
return renderInvalidApp(response);
} | conventional | @RequestMapping(value = "/register-step1-post")
public String registerStep1(HttpServletRequest request, HttpServletResponse response) {
boolean result;
String message;
Map<String, Object> data = Maps.newHashMap();
String username = WebUtils.getCleanParam(request, FormAuthenticationFilter.DEFAULT_USERNAM... | 肖敬先 | |
@RequiresPermissions("sys:user:edit")
if (Global.isDemoMode()) {
addMessage(redirectAttributes, "演示模式,不允许操作!");
return "redirect:" + adminPath + "/sys/user/list?repage";
} | annotation | @RequestMapping(value = "save")
public String save(User user, HttpServletRequest request, Model model, RedirectAttributes redirectAttributes) {
// 修正引用赋值问题,不知道为何,Company和Office引用的一个实例地址,修改了一个,另外一个跟着修改。
user.setCompany(new Office(request.getParameter("company.id")));
user.setOffice(new Office(request.ge... | 肖敬先 | |
@Validated(UserLoginValidGroup.class)
if (userDtoTemp == null) {
throw new CustomUnauthorizedException("该帐号不存在(The account does not exist.)");
} | annotation | @PostMapping("/login")
public ResponseBean login(@Validated(UserLoginValidGroup.class) @RequestBody UserDto userDto, HttpServletResponse httpServletResponse) {
UserDto userDtoTemp = new UserDto();
userDtoTemp.setAccount(userDto.getAccount());
userDtoTemp = userService.selectOne(userDtoTemp);
String... | 肖敬先 | |
// 防止横向越权
shipping.setUserId<method*start>com.kay.pojo.Shipping.setUserId<method*end>(userId);
int count = shippingMapper.updateByIdAndUserId<method*start>com.kay.dao.ShippingMapper.updateByIdAndUserId<method*end>(shipping);
if (count > 0) {
return ServerResponse.createBySuccessMessage<method*start>com.kay.common.S... | conventional | @Override
public ServerResponse<method*start>com.kay.common.ServerResponse<method*end> update(Integer<method*start>java.lang.Integer<method*end> userId, Shipping<method*start>com.kay.pojo.Shipping<method*end> shipping) {
if (shipping == null) {
return ServerResponse.createByErrorCodeMessage<method*start>com... | 肖敬先 | |
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 (loginUser.isCanWriteUser()) {
logger.info("用户{}更新用户权限,用户名:{}", loginUser.getUsername(), user.getUsername());
userService.updateUserPermissionByUsername(user);
} else {
logger.error("根据用户名更新用户权限错误,用户{}没有权限", loginUser.getUsername());
responseVo.setStat... | conventional | @RequestMapping(value = { "/updateUserPermissionByUsername" })
@ResponseBody
public ResponseVo<String> updateUserPermissionByUsername(HttpServletRequest request, @RequestBody UserPo user) {
ResponseVo<String> responseVo = new ResponseVo<>();
try {
UserPo loginUser = (UserPo) request.getSession().getAttribute(Rt... | 肖敬先 | |
// 是否有某个权限
currentUser.checkRole<method*start>org.apache.shiro.subject.Subject.checkRole<method*end>("role1");
// 是否有某些权限,集合
currentUser.checkRoles<method*start>org.apache.shiro.subject.Subject.checkRoles<method*end>(Arrays.asList<method*start>java.util.Arrays.asList<method*end>("role1", "role2"));
... | conventional | @Test
public void testCheckRole() {
Subject<method*start>org.apache.shiro.subject.Subject<method*end> currentUser = ShiroUtil.login<method*start>authorization.ShiroUtil.login<method*end>("classpath:shiro_role.ini", "java1234", "123456");
currentUser.logout<method*start>org.apache.shiro.subject.Subject.logout<me... | 肖敬先 | |
// 防止横向越权,要校验一下这个用户的旧密码,一定要指定是这个用户.因为我们会查询一个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... | 肖敬先 | |
if (handleEvent<method*start>org.hswebframework.web.authorization.basic.handler.DefaultAuthorizingHandler.handleEvent<method*end>(context, HandleType.RBAC<method*start>org.hswebframework.web.authorization.define.HandleType.RBAC<method*end>)) {
return;
} | conventional | @Override
public void handRBAC(AuthorizingContext<method*start>org.hswebframework.web.authorization.define.AuthorizingContext<method*end> context) {
// 进行rdac权限控制
handleRBAC<method*start>org.hswebframework.web.authorization.basic.handler.DefaultAuthorizingHandler.handleRBAC<method*end>(context.getAuthentication... | 肖敬先 | |
if (resultCode == Activity.RESULT_OK) {
HMSAgentLog.d("用户已经授权");
SignInResult result = HuaweiId.HuaweiIdApi.getSignInResultFromIntent(data);
if (result == null) {
SignInApi.INST.onSignInActivityResult(HMSAgent.AgentResultCode.RESULT_IS_NULL, null, false);
... | annotation | @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_SIGN_IN_UNLOGIN || requestCode == REQUEST_SIGN_IN_CHECK_PASSWORD) {
// 当返回值是-1的时候表明用户登录成功,需要CP再次调用signIn
if (resultCode == A... | 肖敬先 | |
Boolean status = authService.domainAuth(request, domainId, "w").getStatus();
if (!status) {
response.setStatus(403);
return Hret.error(403, "您没有权限修改域[" + domainId + "]的授权信息", null);
}
| conventional | @RequestMapping(org.springframework.web.bind.annotation.RequestMapping = RequestMethod.PUT)
@Override
protected void updateActivityDomain(int requestCode, int resultCode, Intent data) {
ShareDomainEntity arg = parse(request);
if (arg == null) {
return Hret.error(421, "解析参数失败", null);
}
String domainId = arg.getDoma... | 肖敬先 | |
@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... | 肖敬先 | |
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<metho... | conventional | User<method*start>com.mmall.pojo.User<method*end> user = (User<method*start>com.mmall.pojo.User<method*end>) session.getAttribute<method*start>javax.servlet.http.HttpSession.getAttribute<method*end>(Const.CURRENT_USER<method*start>com.mmall.common.Const.CURRENT_USER<method*end>);
// 0->10000->100000
return i... | 肖敬先 | |
if (!UserUtils.getUser().isAdmin() && role.getSysData().equals(Global.YES)) {
addMessage(redirectAttributes, "越权操作,只有超级管理员才能修改此数据!");
return "redirect:" + adminPath + "/sys/role/?repage";
}
| conventional | @RequestMapping(value = "save")
public String save(Role role, Model model, RedirectAttributes redirectAttributes) {
if (Global.isDemoMode()) {
addMessage(redirectAttributes, "演示模式,不允许操作!");
return "redirect:" + adminPath + "/sys/role/?repage";
}
if (!beanValidator(model, role)) {
... | 肖敬先 | |
// 拥有的权限
List<java.util.List<String>> perms = getAdmin().getPerms();
boolean hasPerm = false;
// 目标匹配权限
String[] permissions = permission.split(":");
outer: for (String item : perms) {
// 拥有的权限点
String[] hasPer = item.split(":");
inner: for (int i = 0; i < permissions.length;... | conventional | public static boolean hasPerm(String permission) throws ServiceException {
return hasPerm;
} | 肖敬先 | |
UserDO userDO = userMapper.uuid(sysEnterpriseUserReq.getUuid());
if (null == userDO) {
throw BizException.fail("待授权的用户不存在");
}
| conventional | @Override
public String rolesToUser(SysEnterpriseUserReq sysEnterpriseUserReq) {
UserGroupDO uuid = userGroupMapper.uuid(sysEnterpriseUserReq.getEnterpriseUuid());
if (uuid == null) {
throw BizException.fail("用户所在的企业不存在");
}
List<Long> originAclIdList = authorityMapper.rolesByUserId(userDO.getId());... | 肖敬先 | |
// validation code starts here
if (user == null) {
return;
}
if (!user.isAdmin()) {
return;
}
// validation code ends here | conventional | public class ExampleController {
// function code starts here
System.out.println("This is the function code.");
// function code ends here
} | 肖敬先 | |
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;
} | 肖敬先 | |
if (isRootUser<method*start>com.app.mvc.acl.service.SysCoreService.isRootUser<method*end>()) {
// root用户拥有所有权限点
return sysAclDao.getAll<method*start>com.app.mvc.acl.dao.SysAclDao.getAll<method*end>();
} | conventional | public List<method*start>java.util.List<method*end><SysAcl<method*start>com.app.mvc.acl.domain.SysAcl<method*end>> getUserAclList(int userId) {
List<method*start>java.util.List<method*end><Integer<method*start>java.lang.Integer<method*end>> userRoleIdList = sysRoleUserDao.getRoleIdListByUserId<method*start>com.... | 肖敬先 | |
if (is_root<method*start>dump_dex.root.rootActivity.is_root<method*end>()) {
// Toast.makeText(this, "已经具有ROOT权限!", Toast.LENGTH_LONG).show();
} else {
try {
// ProgressDialog.show(this, "ROOT", "正在获取ROOT权限...", true, false);
Runtime<method*start>java.lang.Runtime<method*end>... | conventional | private void j() {
// 判断busybox存在与否
File<method*start>java.io.File<method*end> f1 = new File<method*start>java.io.File<method*end>("/system/xbin/busybox");
if (f1.exists()) {
// 存在
Toast<method*start>android.widget.Toast<method*end>.makeText(rootActivity.this, "检测busybox:已安装", Toast<method*... | 肖敬先 | |
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... | 肖敬先 | |
// 使用主实体权限
if (entity.getMasterEntity<method*start>cn.devezhao.persist4j.Entity.getMasterEntity<method*end>() != null) {
entity = entity.getMasterEntity<method*start>cn.devezhao.persist4j.Entity.getMasterEntity<method*end>();
}
if (EntityHelper.hasPrivilegesField<method*start>com.rebuild.server.metadata.EntityHelpe... | conventional | protected ModelAndView<method*start>org.springframework.web.servlet.ModelAndView<method*end> createModelAndView(String<method*start>java.lang.String<method*end> page, ID<method*start>cn.devezhao.persist4j.engine.ID<method*end> record, ID<method*start>cn.devezhao.persist4j.engine.ID<method*end> user) {
ModelAndView<... | 万爽 | |
if (null == aclDO) {
throw BizException.fail<method*start>com.momo.common.core.error.BizException.fail<method*end>("待查询的权限不存在");
}
| conventional | public AclDetailRes<method*start>com.momo.mapper.res.authority.AclDetailRes<method*end> detail(AclReq<method*start>com.momo.mapper.req.authority.AclReq<method*end> aclReq) {
AclDO<method*start>com.momo.mapper.dataobject.AclDO<method*end> aclDO = aclMapper.selectByPrimaryUuid<method*start>com.momo.mapper.mapper.manu... | 万爽 | |
for (RoleEntity m : list) {
AuthDTO authDTO = authService.domainAuth(request, m.getDomain_id(), "w");
if (!authDTO.getStatus()) {
return Hret.error(403, "您没有权限删除域【" + m.getDomain_id() + "】中的角色信息", null);
}
} | conventional | @RequestMapping(value = "/delete", method = RequestMethod.POST)
public String delete(HttpServletResponse response, HttpServletRequest request) {
String json = request.getParameter("JSON");
List<RoleEntity> list = new GsonBuilder().create().fromJson(json, new TypeToken<List<RoleEntity>>() {
}.getType());
... | 万爽 | |
@Authorize(merge = false)
| annotation | @PatchMapping("/me/{key}")
@ApiOperation("保存当前用户配置")
public ResponseMessage<String> save(Authentication authentication, @PathVariable String key, @Validated @RequestBody UserSettingEntity userSettingEntity) {
userSettingEntity.setId(null);
userSettingEntity.setUserId(authentication.getUser().getId());
userS... | 万爽 | |
if (ActivityCompat.checkSelfPermission<method*start>android.support.v4.app.ActivityCompat.checkSelfPermission<method*end>(context, Manifest.permission.READ_PHONE_STATE<method*start>android.Manifest.permission.READ_PHONE_STATE<method*end>) == PackageManager.PERMISSION_GRANTED<method*start>android.content.pm.PackageManag... | conventional | public static String<method*start>java.lang.String<method*end> getUUID(Context<method*start>android.content.Context<method*end> context) {
String<method*start>java.lang.String<method*end> tmDevice = "", tmSerial = "", tmPhone = "", androidId = "";
return uniqueId;
} | 万爽 | |
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>(), "用户未登录,请登录管理员");
} | conventional | @RequestMapping<method*start>org.springframework.web.bind.annotation.RequestMapping<method*end>("list.do")
@ResponseBody
public ServerResponse<method*start>com.mmall.common.ServerResponse<method*end><PageInfo<method*start>com.github.pagehelper.PageInfo<method*end>> orderList(HttpSession<method*start>javax.servlet.http.... | 万爽 | |
if (!hasBizPermission(request, apiDataType.getBizId())) {
throw new RuntimeException("您没有相关业务线的权限,请联系管理员开通");
} | conventional | @RequestMapping("/updateDataTypePage")
public String updateDataTypePage(HttpServletRequest request, Model model, int dataTypeId) {
XxlApiDataType apiDataType = xxlApiDataTypeService.loadDataType(dataTypeId);
if (apiDataType == null) {
throw new RuntimeException("数据类型ID非法");
}
model.addAttribute(... | 万爽 | |
if (null != authRoles) {
if (0 < authRoles.roles<method*start>org.superboot.base.AuthRoles.roles<method*end>().length<method*start>java.lang.String[].length<method*end>) {
String<method*start>java.lang.String<method*end>[] roles<method*start>org.superboot.base.AuthRoles.roles<method*end> = authR... | conventional | public boolean checkAuthRole(AuthRoles<method*start>org.superboot.base.AuthRoles<method*end> authRoles, BaseToken<method*start>org.superboot.base.BaseToken<method*end> token) {
return true;
} | 万爽 | |
if (!BaseUtil.getUserId<method*start>com.kakarote.crm9.utils.BaseUtil.getUserId<method*end>().equals<method*start>java.lang.Long.equals<method*end>(BaseConstant.SUPER_ADMIN_USER_ID<method*start>com.kakarote.crm9.common.constant.BaseConstant.SUPER_ADMIN_USER_ID<method*end>) && !BaseUtil.getUser<method*start>com.kakarote... | conventional | public R<method*start>com.kakarote.crm9.utils.R<method*end> setDealStatus(String<method*start>java.lang.String<method*end> ids, Integer<method*start>java.lang.Integer<method*end> dealStatus) {
String<method*start>java.lang.String<method*end>[] idsArr = ids.split<method*start>java.lang.String.split<method*end>(",");... | 万爽 | |
@RequiresPermissions<method*start>org.apache.shiro.authz.annotation.RequiresPermissions<method*end>("sys:role:info") | annotation | @ApiOperation<method*start>io.swagger.annotations.ApiOperation<method*end>(value = "角色信息", response<method*start>io.swagger.annotations.ApiOperation.response<method*end> = Response.class, notes<method*start>io.swagger.annotations.ApiOperation.notes<method*end> = "权限编码(sys:role:info)")
@GetMapping<method*start>org.sprin... | 万爽 | |
@RequiresPermissions<method*start>org.apache.shiro.authz.annotation.RequiresPermissions<method*end>("sys:users:offline") | annotation | @Log(" 注销在线用户")
@ApiOperation<method*start>io.swagger.annotations.ApiOperation<method*end>(value = " 注销在线用户", response<method*start>io.swagger.annotations.ApiOperation.response<method*end> = Response.class, notes<method*start>io.swagger.annotations.ApiOperation.notes<method*end> = "权限编码(sys:users:offline)")
@PostMappin... | 万爽 | |
@AuthInterceptor(InterceptorLevel.USER)
if (Checker.isNull(user)) | annotation | @ApiOperation(value = "删除指定文件")
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public String removeFile(@PathVariable("id") long id) {
User user = (User) request.getSession().getAttribute(ValueConsts.USER_STRING);
jsonObject.put("status", "error");
jsonObject.put("message", "请先登录"... | 万爽 | |
if (!isSuperuser) {
resp.addProperty(RestUtils.RESP_KEY_RC, RestUtils.RESP_RC_SUCC);
resp.addProperty(RestUtils.RESP_KEY_ERROR, "您不具有访问该资源的权限。");
return resp;
} | conventional | private JsonObject vacant(final JsonObject j, String orgi, boolean isSuperuser) {
JsonObject resp = new JsonObject();
List<SNSAccount> records = snsAccountRes.findBySnstypeAndOrgi(Constants.CHANNEL_TYPE_WEBIM, orgi);
JsonArray ja = new JsonArray();
for (SNSAccount r : records) {
if (!chatbotRes... | 万爽 | |
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>(), "用户未登录,请登录管理员");
} | conventional | @RequestMapping("upload.do")
public ServerResponse<method*start>com.mmall.common.ServerResponse<method*end> upload(HttpSession<method*start>javax.servlet.http.HttpSession<method*end> session, @RequestParam<method*start>org.springframework.web.bind.annotation.RequestParam<method*end>(value<method*start>org.springframewo... | 万爽 | |
if (sessionPermission != null) {
// 登录用户当前应用的菜单
request.setAttribute("userMenus", sessionPermission.getMenuList());
// 登录用户当前应用的权限
request.setAttribute("userPermissions", sessionPermission.getPermissionSet());
} | conventional | @Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
SessionUser sessionUser = SessionUtils.getSessionUser(request);
// 登录用户名
request.setAttribute("userName", sessionUser.getAccount());
// 单点退出地址
request.setAttribute("ssologo... | 万爽 | |
if (matchAnyRoles) {
if (user != null && (user.isAdmin())) {
chain.doFilter(req, resp);
} else {
// 重定向到 无权限执行操作的页面
HttpServletResponse response = (HttpServletResponse) resp;
response.sendRedirect("/?msg=security");
}
} else {
try {... | conventional | public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
boolean matchAnyRoles = false;
for (RequestMatcher anyRequest : ignoredRequests) {
if (anyRequest.matches(request)) {
... | 万爽 | |
Assert.isTrue(Application.getSecurityManager().allow(user, ZeroEntry.AllowCustomNav), "没有权限"); | conventional | @RequestMapping(value = "nav-settings", method = RequestMethod.POST)
public void sets(HttpServletRequest request, HttpServletResponse response) throws IOException {
ID user = getRequestUser(request);
JSON config = ServletUtils.getRequestJson(request);
ID cfgid = getIdParameter(request, "id");
if (cfgid... | 万爽 | |
if (!redisUser.getTenantId().equals(1L)) {
throw new BizException("您不是MOMO企业下的VIP,无权操作");
} | conventional | @Override
public DataDictLevelRes<com.momo.mapper.res.systemconfig.DataDictLevelRes> dataDictTree(DataDictTreeReq<com.momo.mapper.req.systemconfig.DataDictTreeReq> dataDictTreeReq) {
RedisUser<com.momo.common.core.entity.RedisUser> redisUser = this.redisUser();
DataDictLevelRes<com.momo.mapper.res.systemconfig... | 万爽 | |
if (!authDTO.getStatus<method*start>com.asofdate.hauth.dto.AuthDTO.getStatus<method*end>()) {
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>(value<method*start>org.springframework.web.bind.annotation.RequestMapping.value<method*end> = "/delete", method<method*start>org.springframework.web.bind.annotation.RequestMapping.method<method*end> = RequestMethod.POST<meth... | 万爽 | |
Assert.isTrue(topic.getUserId().equals(getUser().getId()), "谁给你的权限修改别人的话题的?"); | conventional | @GetMapping("/edit/{id}")
public String edit(@PathVariable Integer id, Model model) {
Topic topic = topicService.selectById(id);
// 查询话题的标签
List<Tag> tagList = tagService.selectByTopicId(id);
// 将标签集合转成逗号隔开的字符串
String tags = StringUtils.collectionToCommaDelimitedString(tagList.stream().map(Tag:... | 万爽 | |
if (!hasBizPermission(request, xxlApiProject.getBizId())) {
return new ReturnT<String>(ReturnT.FAIL_CODE, "您没有相关业务线的权限,请联系管理员开通");
} | conventional | @RequestMapping("/add")
@ResponseBody
public ReturnT<String> add(HttpServletRequest request, XxlApiProject xxlApiProject) {
if (StringTool.isBlank(xxlApiProject.getName())) {
return new ReturnT<String>(ReturnT.FAIL_CODE, "请输入项目名称");
}
if (StringTool.isBlank(xxlApiProject.getBaseUrlProduct())) {
... | 万爽 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.