mirror of
https://github.com/didi/KnowStreaming.git
synced 2026-01-03 11:28:12 +08:00
2
build.sh
2
build.sh
@@ -4,7 +4,7 @@ cd $workspace
|
|||||||
|
|
||||||
## constant
|
## constant
|
||||||
OUTPUT_DIR=./output
|
OUTPUT_DIR=./output
|
||||||
KM_VERSION=2.3.0
|
KM_VERSION=2.3.1
|
||||||
APP_NAME=kafka-manager
|
APP_NAME=kafka-manager
|
||||||
APP_DIR=${APP_NAME}-${KM_VERSION}
|
APP_DIR=${APP_NAME}-${KM_VERSION}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -78,13 +78,14 @@ public class AppDaoImpl implements AppDao {
|
|||||||
* 更新APP缓存
|
* 更新APP缓存
|
||||||
*/
|
*/
|
||||||
private synchronized void updateTopicCache(List<AppDO> doList, long timestamp) {
|
private synchronized void updateTopicCache(List<AppDO> doList, long timestamp) {
|
||||||
|
if (APP_CACHE_LATEST_UPDATE_TIME == Constant.START_TIMESTAMP) {
|
||||||
|
APP_MAP.clear();
|
||||||
|
}
|
||||||
|
|
||||||
if (doList == null || doList.isEmpty() || APP_CACHE_LATEST_UPDATE_TIME >= timestamp) {
|
if (doList == null || doList.isEmpty() || APP_CACHE_LATEST_UPDATE_TIME >= timestamp) {
|
||||||
// 本次无数据更新, 或者本次更新过时 时, 忽略本次更新
|
// 本次无数据更新, 或者本次更新过时 时, 忽略本次更新
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (APP_CACHE_LATEST_UPDATE_TIME == Constant.START_TIMESTAMP) {
|
|
||||||
APP_MAP.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (AppDO elem: doList) {
|
for (AppDO elem: doList) {
|
||||||
APP_MAP.put(elem.getAppId(), elem);
|
APP_MAP.put(elem.getAppId(), elem);
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ public class AuthorityDaoImpl implements AuthorityDao {
|
|||||||
|
|
||||||
|
|
||||||
private void updateAuthorityCache() {
|
private void updateAuthorityCache() {
|
||||||
Long timestamp = System.currentTimeMillis();
|
long timestamp = System.currentTimeMillis();
|
||||||
|
|
||||||
if (timestamp + 1000 <= AUTHORITY_CACHE_LATEST_UPDATE_TIME) {
|
if (timestamp + 1000 <= AUTHORITY_CACHE_LATEST_UPDATE_TIME) {
|
||||||
// 近一秒内的请求不走db
|
// 近一秒内的请求不走db
|
||||||
@@ -109,13 +109,14 @@ public class AuthorityDaoImpl implements AuthorityDao {
|
|||||||
* 更新Topic缓存
|
* 更新Topic缓存
|
||||||
*/
|
*/
|
||||||
private synchronized void updateAuthorityCache(List<AuthorityDO> doList, Long timestamp) {
|
private synchronized void updateAuthorityCache(List<AuthorityDO> doList, Long timestamp) {
|
||||||
|
if (AUTHORITY_CACHE_LATEST_UPDATE_TIME == Constant.START_TIMESTAMP) {
|
||||||
|
AUTHORITY_MAP.clear();
|
||||||
|
}
|
||||||
|
|
||||||
if (doList == null || doList.isEmpty() || AUTHORITY_CACHE_LATEST_UPDATE_TIME >= timestamp) {
|
if (doList == null || doList.isEmpty() || AUTHORITY_CACHE_LATEST_UPDATE_TIME >= timestamp) {
|
||||||
// 本次无数据更新, 或者本次更新过时 时, 忽略本次更新
|
// 本次无数据更新, 或者本次更新过时 时, 忽略本次更新
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (AUTHORITY_CACHE_LATEST_UPDATE_TIME == Constant.START_TIMESTAMP) {
|
|
||||||
AUTHORITY_MAP.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (AuthorityDO elem: doList) {
|
for (AuthorityDO elem: doList) {
|
||||||
Map<Long, Map<String, AuthorityDO>> doMap =
|
Map<Long, Map<String, AuthorityDO>> doMap =
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public class TopicDaoImpl implements TopicDao {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateTopicCache() {
|
private void updateTopicCache() {
|
||||||
Long timestamp = System.currentTimeMillis();
|
long timestamp = System.currentTimeMillis();
|
||||||
|
|
||||||
if (timestamp + 1000 <= TOPIC_CACHE_LATEST_UPDATE_TIME) {
|
if (timestamp + 1000 <= TOPIC_CACHE_LATEST_UPDATE_TIME) {
|
||||||
// 近一秒内的请求不走db
|
// 近一秒内的请求不走db
|
||||||
@@ -108,13 +108,14 @@ public class TopicDaoImpl implements TopicDao {
|
|||||||
* 更新Topic缓存
|
* 更新Topic缓存
|
||||||
*/
|
*/
|
||||||
private synchronized void updateTopicCache(List<TopicDO> doList, Long timestamp) {
|
private synchronized void updateTopicCache(List<TopicDO> doList, Long timestamp) {
|
||||||
|
if (TOPIC_CACHE_LATEST_UPDATE_TIME == Constant.START_TIMESTAMP) {
|
||||||
|
TOPIC_MAP.clear();
|
||||||
|
}
|
||||||
|
|
||||||
if (doList == null || doList.isEmpty() || TOPIC_CACHE_LATEST_UPDATE_TIME >= timestamp) {
|
if (doList == null || doList.isEmpty() || TOPIC_CACHE_LATEST_UPDATE_TIME >= timestamp) {
|
||||||
// 本次无数据更新, 或者本次更新过时 时, 忽略本次更新
|
// 本次无数据更新, 或者本次更新过时 时, 忽略本次更新
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (TOPIC_CACHE_LATEST_UPDATE_TIME == Constant.START_TIMESTAMP) {
|
|
||||||
TOPIC_MAP.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (TopicDO elem: doList) {
|
for (TopicDO elem: doList) {
|
||||||
Map<String, TopicDO> doMap = TOPIC_MAP.getOrDefault(elem.getClusterId(), new ConcurrentHashMap<>());
|
Map<String, TopicDO> doMap = TOPIC_MAP.getOrDefault(elem.getClusterId(), new ConcurrentHashMap<>());
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public class LoginServiceImpl implements LoginService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean status = checkAuthority(request, accountService.getAccountRoleFromCache(username));
|
boolean status = checkAuthority(classRequestMappingValue, accountService.getAccountRoleFromCache(username));
|
||||||
if (status) {
|
if (status) {
|
||||||
HttpSession session = request.getSession();
|
HttpSession session = request.getSession();
|
||||||
session.setAttribute(LoginConstant.SESSION_USERNAME_KEY, username);
|
session.setAttribute(LoginConstant.SESSION_USERNAME_KEY, username);
|
||||||
@@ -94,19 +94,18 @@ public class LoginServiceImpl implements LoginService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkAuthority(HttpServletRequest request, AccountRoleEnum accountRoleEnum) {
|
private boolean checkAuthority(String classRequestMappingValue, AccountRoleEnum accountRoleEnum) {
|
||||||
String uri = request.getRequestURI();
|
if (classRequestMappingValue.equals(ApiPrefix.API_V1_NORMAL_PREFIX)) {
|
||||||
if (uri.contains(ApiPrefix.API_V1_NORMAL_PREFIX)) {
|
|
||||||
// normal 接口都可以访问
|
// normal 接口都可以访问
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uri.contains(ApiPrefix.API_V1_RD_PREFIX) ) {
|
if (classRequestMappingValue.equals(ApiPrefix.API_V1_RD_PREFIX) ) {
|
||||||
// RD 接口 OP 或者 RD 可以访问
|
// RD 接口, OP 或者 RD 可以访问
|
||||||
return AccountRoleEnum.RD.equals(accountRoleEnum) || AccountRoleEnum.OP.equals(accountRoleEnum);
|
return AccountRoleEnum.RD.equals(accountRoleEnum) || AccountRoleEnum.OP.equals(accountRoleEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uri.contains(ApiPrefix.API_V1_OP_PREFIX)) {
|
if (classRequestMappingValue.equals(ApiPrefix.API_V1_OP_PREFIX)) {
|
||||||
// OP 接口只有 OP 可以访问
|
// OP 接口只有 OP 可以访问
|
||||||
return AccountRoleEnum.OP.equals(accountRoleEnum);
|
return AccountRoleEnum.OP.equals(accountRoleEnum);
|
||||||
}
|
}
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@@ -16,7 +16,7 @@
|
|||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<kafka-manager.revision>2.3.0-SNAPSHOT</kafka-manager.revision>
|
<kafka-manager.revision>2.3.1-SNAPSHOT</kafka-manager.revision>
|
||||||
<swagger2.version>2.7.0</swagger2.version>
|
<swagger2.version>2.7.0</swagger2.version>
|
||||||
<swagger.version>1.5.13</swagger.version>
|
<swagger.version>1.5.13</swagger.version>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user