Ejemplo n.º 1
0
 public boolean update(Weight weight, Map<String, Object> context) {
   if (!super.currentUser.hasServicePrivilege(weight.getService())) {
     context.put("message", getMessage("HaveNoServicePrivilege", weight.getService()));
     return false;
   }
   weight.setAddress(Tool.getIP(weight.getAddress()));
   overrideService.updateOverride(OverrideUtils.weightToOverride(weight));
   return true;
 }
Ejemplo n.º 2
0
  /**
   * 删除动作
   *
   * @param ids
   * @return
   */
  public boolean delete(Long[] ids, Map<String, Object> context) {
    for (Long id : ids) {
      Weight w = OverrideUtils.overrideToWeight(overrideService.findById(id));
      if (!super.currentUser.hasServicePrivilege(w.getService())) {
        context.put("message", getMessage("HaveNoServicePrivilege", w.getService()));
        return false;
      }
    }

    for (Long id : ids) {
      overrideService.deleteOverride(id);
    }
    return true;
  }