|
|
@@ -19,6 +19,7 @@ import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
|
|
import com.uas.kanban.annotation.NotEmpty;
|
|
|
import com.uas.kanban.exception.OperationException;
|
|
|
import com.uas.kanban.model.User;
|
|
|
+import com.uas.kanban.model.User.Role;
|
|
|
import com.uas.kanban.support.SessionHelper;
|
|
|
import com.uas.kanban.support.SystemSession;
|
|
|
|
|
|
@@ -73,9 +74,11 @@ public class SecurityInterceptor extends HandlerInterceptorAdapter {
|
|
|
}
|
|
|
|
|
|
// 只允许管理员访问
|
|
|
- for (String pattern : this.adminPatterns) {
|
|
|
- if (pathMatcher.match(pattern, url)) {
|
|
|
- throw new OperationException("没有权限");
|
|
|
+ if (user.getRole() != Role.Admin) {
|
|
|
+ for (String pattern : this.adminPatterns) {
|
|
|
+ if (pathMatcher.match(pattern, url)) {
|
|
|
+ throw new OperationException("没有权限");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
SystemSession.setUser(user);
|