master
wangning 6 years ago
parent 208ac577c3
commit 6b429eddb9

@ -31,11 +31,16 @@ public interface PermissionManager {
List<JSONObject> listUserFunctions(int role);
JSONObject getById(String funcId);
//partner start
void synchronizePartnerFunctions();
JSONObject listPartnerFunctions();
JSONObject getPartnerFuncById(String funcId);
}

@ -137,6 +137,12 @@ public class PermissionManagerImpl implements PermissionManager {
return report;
}
@Override
@CacheEvict(value = ":System:permissionCheck:",allEntries = true)
public JSONObject getPartnerFuncById(String funcId) {
return permissionPartnerFunctionMapper.find(funcId);
}
@Override
public JSONObject listFunctions() {
List<JSONObject> funcs = permissionFunctionMapper.listAll();
@ -247,10 +253,6 @@ public class PermissionManagerImpl implements PermissionManager {
return permissionFunctionMapper.listByRoleMask(role);
}
@Override
@CacheEvict(value = ":System:permissionCheck:",allEntries = true)
public JSONObject getById(String funcId) {
return permissionFunctionMapper.find(funcId);
}
}

@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Param;
import com.alibaba.fastjson.JSONObject;
import cn.yixblog.support.mybatis.autosql.annotations.AdvanceSelect;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
@ -32,4 +33,10 @@ public interface SysPermissionClientModulesMapper {
@AutoSql(type = SqlType.SELECT)
List<JSONObject> listByClientMoniker(@Param("client_moniker")String client_moniker);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid = 1")
List<JSONObject> listValidByClientId(@Param("client_id") int client_id);
}

@ -101,9 +101,9 @@ public class ManagerUserInterceptor extends HandlerInterceptorAdapter implements
}
}
// JSONObject func = permissionManager.getById(funcId);
// JSONArray arr = loginUser.getJSONArray("available_func_ids");
// if (arr == null || !arr.contains(func.getString("funcId"))) {
// JSONObject func = permissionManager.getPartnerFuncById(funcId);
// JSONArray arr = loginUser.getJSONArray("available_module_ids");
// if (arr == null || !arr.contains(func.getString("module_id"))) {
// throw new ForbiddenException("error.permission.nopermission");
// }
request.setAttribute(CommonConsts.PARTNER_STATUS, loginUser);

@ -145,12 +145,12 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
}
}
List<JSONObject> funcs = permissionClientModulesService.listByClientId(account.getIntValue("client_id"));
List<JSONObject> funcs = permissionClientModulesService.listValidByClientId(account.getIntValue("client_id"));
List<String> funcIds = new ArrayList<>();
for (JSONObject func : funcs) {
funcIds.add(func.getString("func_id"));
funcIds.add(func.getString("module_id"));
}
account.put("available_func_ids", funcIds);
account.put("available_module_ids", funcIds);
return account;
}

@ -13,7 +13,7 @@ public interface PermissionClientModulesService {
void save(JSONObject record);
List<JSONObject> listByClientId(int clientId);
List<JSONObject> listValidByClientId(int clientId);
List<JSONObject> listByClientMoniker(String clientMoniker);

@ -45,8 +45,8 @@ public class PermissionClientModulesServiceImpl implements PermissionClientModul
@Override
@Cacheable(value = ":system:client_permission:", key = "#clientId+''")
public List<JSONObject> listByClientId(int clientId) {
return permissionClientModulesMapper.listByClientId(clientId);
public List<JSONObject> listValidByClientId(int clientId) {
return permissionClientModulesMapper.listValidByClientId(clientId);
}
@Override
@ -55,6 +55,7 @@ public class PermissionClientModulesServiceImpl implements PermissionClientModul
return permissionClientModulesMapper.listByClientMoniker(clientMoniker);
}
@Override
public void switchValid(Long id, boolean isValid, JSONObject account) {
JSONObject record = permissionClientModulesMapper.find(id);

Loading…
Cancel
Save