| | |
| | | rules={{ |
| | | required: translate('ra.validation.required'), |
| | | pattern: { |
| | | value: /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{6,13}$/, |
| | | value: /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d\.]{6,13}$/, |
| | | message: translate('page.settings.resetPwd.tip.pwdInputLimit'), |
| | | }, |
| | | validate: (value) => { |
| | |
| | | import { |
| | | useTranslate, |
| | | useNotify, |
| | | useRefresh, |
| | | } from 'react-admin'; |
| | | import { |
| | | Dialog, |
| | |
| | | const { open, setOpen } = props; |
| | | const translate = useTranslate(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | const { |
| | | control, |
| | | handleSubmit, |
| | |
| | | const onSubmit = (data) => { |
| | | request.post('/tenant/init', data).then(res => { |
| | | const { code, msg, data } = res.data; |
| | | console.log(msg); |
| | | |
| | | if (code === 200) { |
| | | notify(msg, { type: 'success', messageArgs: { _: msg } }); |
| | | setOpen(false); |
| | | reset(); |
| | | refresh(); |
| | | } else { |
| | | notify(msg, { type: 'error', messageArgs: { _: msg } }); |
| | | } |
| | |
| | | message: translate('ra.validation.required'), |
| | | }, |
| | | pattern: { |
| | | value: /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{6,13}$/, |
| | | value: /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d\.]{6,13}$/, |
| | | message: translate('page.settings.resetPwd.tip.pwdInputLimit'), |
| | | }, |
| | | }} |
| | |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 系统配置属性 |
| | | * |
| | |
| | | */ |
| | | private String superUsername; |
| | | |
| | | public List<String> getSuperUserList() { |
| | | return Arrays.stream(superUsername.split(",")).collect(Collectors.toList()); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.vincent.rsf.server.common.exception; |
| | | |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.common.constant.Constants; |
| | | import com.vincent.rsf.server.common.utils.CommonUtil; |
| | | import org.slf4j.Logger; |
| | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @ExceptionHandler(CoolException.class) |
| | | public R coolExceptionHandler(CoolException e, HttpServletResponse response) { |
| | | CommonUtil.addCrossHeaders(response); |
| | | return R.error(e.getMessage()); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @ExceptionHandler(Throwable.class) |
| | | public R exceptionHandler(Throwable e, HttpServletResponse response) { |
| | | logger.error(e.getMessage(), e); |
| | |
| | | import com.vincent.rsf.server.system.entity.User; |
| | | import com.vincent.rsf.server.system.entity.UserLogin; |
| | | import com.vincent.rsf.server.system.enums.StatusType; |
| | | import com.vincent.rsf.server.system.service.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.vincent.rsf.server.system.service.RoleMenuService; |
| | | import com.vincent.rsf.server.system.service.TenantService; |
| | | import com.vincent.rsf.server.system.service.UserLoginService; |
| | | import com.vincent.rsf.server.system.service.UserService; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | private RoleMenuService roleMenuService; |
| | | @Resource |
| | | private TenantService tenantService; |
| | | @Autowired |
| | | private UserRoleService userRoleService; |
| | | |
| | | @PostMapping("/login") |
| | | public R login(@RequestBody LoginParam param, HttpServletRequest request) { |
| | |
| | | @GetMapping("/auth/menu") |
| | | public R userMenu() { |
| | | List<Menu> menus = roleMenuService.listMenuByUserId(getLoginUserId(), Menu.TYPE_MENU); |
| | | // return R.ok().add(Utils.toTreeData(menus, 0L, Menu::getParentId, Menu::getId, Menu::setChildren)); |
| | | List<MenuVo> voList = menus.stream().map(this::convertToVo).collect(Collectors.toList()); |
| | | // exclude tenant |
| | | if (!configProperties.getSuperUserList().contains(getLoginUser().getUsername())) { |
| | | voList = voList.stream().filter(vo -> |
| | | !vo.getName().equals("menu.tenant") |
| | | && !vo.getName().equals("menu.menu") |
| | | ).collect(Collectors.toList()); |
| | | } |
| | | return R.ok().add(Utils.toTreeData(voList, 0L, MenuVo::getParentId, MenuVo::getId, MenuVo::setChildren)); |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.vincent.rsf.framework.common.BaseRes; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.common.annotation.OperationLog; |
| | |
| | | @OperationLog("Init Tenant") |
| | | @PostMapping("/tenant/init") |
| | | public R init(@RequestBody TenantInitParam param) { |
| | | tenantService.initTenant(param); |
| | | return R.ok("Initialize Success"); |
| | | return tenantService.initTenant(param) ? R.ok("Initialize Success") : R.parse(BaseRes.PARAM); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('system:tenant:update')") |