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