Ejemplo n.º 1
0
 @Override
 protected void prepareModel() throws Exception {
   if (id != null) {
     functionGroup = functionGroupManager.getFunctionGroup(id);
   } else {
     functionGroup = new FunctionGroup();
     if (systemId != null) {
       BusinessSystem businessSystem = businessSystemManager.getBusiness(systemId);
       functionGroup.setBusinessSystem(businessSystem);
     }
   }
 }
Ejemplo n.º 2
0
 /**
  * 判断用户是不是拥有某权限,如果有返回ture;否则,返回false。
  *
  * @param companyId
  * @param loginName
  * @param departmentName
  * @return 用户拥有某权限,返回ture;否则,返回false。
  */
 public static boolean userHaveRole(Long companyId, String loginName, String roleName) {
   // 获得子系统的id集合
   BusinessSystemManager businessSystemManager =
       (BusinessSystemManager) ContextUtils.getBean("businessSystemManager");
   List<Long> subSystemIds =
       businessSystemManager.getSystemIdsByParentCode(ContextUtils.getSystemCode());
   if (ContextUtils.getCompanyId() == null) {
     ThreadParameters parameters = new ThreadParameters(companyId);
     ParameterUtils.setParameters(parameters);
   }
   Set<Role> roles = ApiFactory.getAcsService().getRolesByUser(loginName);
   for (Role role : roles) {
     if (role.getName().equals(roleName)) {
       boolean result = validateRole(role, subSystemIds);
       if (result) {
         return result;
       } else {
         continue;
       }
     }
   }
   return false;
 }