Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新增新功能并解决存在的bug #163

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion disconf-web/html/assets/js/modify_password.js
Original file line number Diff line number Diff line change
@@ -32,7 +32,6 @@ $("#item_submit").on("click", function (e) {
"new_password_2": new_password_2
}
}).done(function (data) {
$("#error").removeClass("hide");
if (data.success === "true") {
alert(data.result);
window.location.href = "/login.html";
2 changes: 0 additions & 2 deletions disconf-web/html/assets/js/register.js
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@ $("#item_submit").on("click", function (e) {

// 验证
if (!user_name || !pwd) {
$("#error").removeClass("hide");
$("#error").html("注册失败, 表单不能为空或填写格式错误!");
return;
}
@@ -22,7 +21,6 @@ $("#item_submit").on("click", function (e) {
"password": pwd
}
}).done(function (data) {
$("#error").removeClass("hide");
if (data.success === "true") {
alert(data.result);
window.location.href = "/login.html";
2 changes: 1 addition & 1 deletion disconf-web/html/main.html
Original file line number Diff line number Diff line change
@@ -94,7 +94,7 @@
<div class="row-fluid" style="min-height:400px;">
<div class="sidebar span2" style="float:left;overflow:visible;">

<div class="dropdown" style="margin-top:20px;width:100%">
<div class="dropdown" style="margin-top:20px;width:100%">
<button class="btn btn-default dropdown-toggle" type="button" id="appDropdownMenu" data-toggle="dropdown" style="width:100%;">
<span id="appDropdownMenuTitle">Apps</span>
<span class="caret"></span>
Original file line number Diff line number Diff line change
@@ -92,6 +92,7 @@ public String addOneAppForUser(Long userId, int appId) {
User user = getUser(userId);

String ownAppIds = user.getOwnApps();
//此处`admin`用户,并非指的是管理员,而是作为一个特殊的用户
if ("admin".equals(user.getName()) && StringUtils.isNotBlank(ownAppIds)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不要用admin字符进行判断是否是管理员

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"admin"只是一个很特殊的用户,而并不是简单的管理员,这样做,是将admin唯一的管理员权限,下发到各个部门各自有自己的管理,这样便于脱离"中心管理",当然也可以去掉这个特殊情况,但是这样,就没有一个整体的管控了、、、

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不要用admin字符串来判断是否是管理员

ownAppIds = StringUtils.EMPTY;
user.setOwnApps(ownAppIds);
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
import com.baidu.disconf.web.service.sign.service.SignMgr;
import com.baidu.disconf.web.service.sign.utils.SignUtils;
import com.baidu.disconf.web.service.user.bo.User;
import com.baidu.disconf.web.service.user.dao.UserDao;
import com.baidu.disconf.web.service.user.dto.Visitor;
import com.baidu.disconf.web.service.user.form.PasswordModifyForm;
import com.baidu.disconf.web.service.user.form.RegisterForm;
@@ -29,7 +30,6 @@

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;

/**
* @author liaoqiqi
@@ -53,6 +53,9 @@ public class UserController extends BaseController {
@Autowired
private RedisLogin redisLogin;

@Autowired
private UserDao userDao;

/**
* GET 获取
*
@@ -164,22 +167,19 @@ public JsonObjectBase register(@Valid RegisterForm registerForm, HttpServletRequ
String regPwd = registerForm.getPassword();

//校验是否存在用户名
List<User> userList = userMgr.getAll();

if (userList != null) {
for (User user : userList) {
if (regUserName.equals(user.getName().trim())) {
return buildFail("用户名存在, 注册失败");
}
}
User user = userDao.getUserByName(regUserName);

if (user != null) {
return buildFail("用户名存在, 注册失败");
}

//新增用户
User user = new User();
user = new User();
user.setName(regUserName);
user.setPassword(SignUtils.createPassword(regPwd));
user.setToken(SignUtils.createToken(regUserName));
user.setOwnApps("0");
//此处给管理员的权限,就是为了admin中心权限,下方到各个部门权限
user.setRoleId(RoleEnum.ADMIN.getValue());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这样以后所有注册的用户都是管理员了?
下门到各个部分权限的意思是?


userMgr.create(user);
Original file line number Diff line number Diff line change
@@ -73,10 +73,6 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons
// 显示所有用户的请求
LOG.info(request.getRequestURI());

if (requestPath.indexOf("register") != -1) {
return true;
}

if (notInterceptPathList != null) {

// 更精确的定位
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@
<value>/api/config/file</value>
<value>/api/config/list</value>
<value>/api/config/simple/list</value>
<value>/api/account/register</value>
</list>
</property>
<property name="XONE_COOKIE_DOMAIN_STRING">