master
wangning 8 years ago
parent 208ac577c3
commit 6b429eddb9

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

@ -137,6 +137,12 @@ public class PermissionManagerImpl implements PermissionManager {
return report; return report;
} }
@Override
@CacheEvict(value = ":System:permissionCheck:",allEntries = true)
public JSONObject getPartnerFuncById(String funcId) {
return permissionPartnerFunctionMapper.find(funcId);
}
@Override @Override
public JSONObject listFunctions() { public JSONObject listFunctions() {
List<JSONObject> funcs = permissionFunctionMapper.listAll(); List<JSONObject> funcs = permissionFunctionMapper.listAll();
@ -247,10 +253,6 @@ public class PermissionManagerImpl implements PermissionManager {
return permissionFunctionMapper.listByRoleMask(role); 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 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.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql; import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType; import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
@ -32,4 +33,10 @@ public interface SysPermissionClientModulesMapper {
@AutoSql(type = SqlType.SELECT) @AutoSql(type = SqlType.SELECT)
List<JSONObject> listByClientMoniker(@Param("client_moniker")String client_moniker); 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); // JSONObject func = permissionManager.getPartnerFuncById(funcId);
// JSONArray arr = loginUser.getJSONArray("available_func_ids"); // JSONArray arr = loginUser.getJSONArray("available_module_ids");
// if (arr == null || !arr.contains(func.getString("funcId"))) { // if (arr == null || !arr.contains(func.getString("module_id"))) {
// throw new ForbiddenException("error.permission.nopermission"); // throw new ForbiddenException("error.permission.nopermission");
// } // }
request.setAttribute(CommonConsts.PARTNER_STATUS, loginUser); 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<>(); List<String> funcIds = new ArrayList<>();
for (JSONObject func : funcs) { 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; return account;
} }

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

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

Loading…
Cancel
Save