Package org.beangle.security.blueprint.restrict

Examples of org.beangle.security.blueprint.restrict.RestrictionHolder


  }

  public RestrictionHolder getHolder() {
    Long restrictionHolderId = Params.getLong("restriction.holder.id");
    String restrictionType = Params.get("restrictionType");
    RestrictionHolder holer = null;
    if ("user".equals(restrictionType)) {
      holer = (RestrictionHolder) entityDao.get(User.class, restrictionHolderId);
    } else if ("group".equals(restrictionType)) {
      holer = (RestrictionHolder) entityDao.get(Group.class, restrictionHolderId);
    } else {
View Full Code Here


  /**
   * 删除数据限制权限
   */
  public String remove() {
    Restriction restriction = getRestriction();
    RestrictionHolder holer = new RestrictionHelper(entityDao).getHolder();
    holer.getRestrictions().remove(restriction);
    entityDao.saveOrUpdate(holer);
    return redirect("info", "info.delete.success");
  }
View Full Code Here

    return forward();
  }

  public String save() {
    Restriction restriction = getRestriction();
    RestrictionHolder holder = new RestrictionHelper(entityDao).getHolder();
    List<Restriction> myRestrictions = getMyRestrictions(restriction.getPattern(), holder);
    Set<RestrictField> ignoreParams = getIgnoreParams(myRestrictions);
    boolean isAdmin = isAdmin(getUser());
    for (RestrictField param : restriction.getPattern().getObject().getFields()) {
      String value = get(param.getName());
      if ((ignoreParams.contains(param) || isAdmin) && getBool("ignoreParam" + param.getId())) {
        restriction.setItem(param, "*");
      } else {
        if (StringUtils.isEmpty(value)) {
          restriction.getItems().remove(param.getId());
        } else {
          restriction.setItem(param, value);
        }
      }
    }
    if (restriction.getItems().isEmpty()) {
      holder.getRestrictions().remove(restriction);
      entityDao.saveOrUpdate(holder);
      return redirect("info", "info.save.success");
    } else {
      if (!restriction.isPersisted()) {
        holder.getRestrictions().add(restriction);
        entityDao.saveOrUpdate(holder);
      } else {
        entityDao.saveOrUpdate(
            (String) RestrictionHelper.restrictionTypeMap.get(get("restrictionType")),
            restriction);
View Full Code Here

    // 用户组自身限制
    for (Group group : groups) {
      restrictions.addAll(group.getRestrictions());
    }
    // 用户自身限制
    RestrictionHolder userHolder = (RestrictionHolder) user;
    restrictions.addAll(userHolder.getRestrictions());
    // 模式过滤
    return (List<Restriction>) CollectionUtils.select(restrictions, new Predicate() {
      public boolean evaluate(Object obj) {
        Restriction restriciton = (Restriction) obj;
        if (restriciton.isEnabled()
View Full Code Here

TOP

Related Classes of org.beangle.security.blueprint.restrict.RestrictionHolder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.