Package org.beangle.security.blueprint

Examples of org.beangle.security.blueprint.Resource


  public String index() throws Exception {
    return forward(new Action(this, "search"));
  }

  protected void editSetting(Entity<?> entity) {
    Resource resource = (Resource) entity;
    List<RestrictObject> objects = entityDao.getAll(RestrictObject.class);
    objects.removeAll(resource.getObjects());
    put("restrictObjects", objects);
    put("categories", entityDao.getAll(UserCategory.class));
  }
View Full Code Here


    put("restrictObjects", objects);
    put("categories", entityDao.getAll(UserCategory.class));
  }

  protected String saveAndForward(Entity<?> entity) {
    Resource resource = (Resource) entity;
    if (null != resource) {
      if (entityDao.duplicate(Resource.class, resource.getId(), "name", resource.getName())) { return redirect(
          "edit", "error.notUnique"); }
    }

    Long[] patternIds = SeqStrUtils.transformToLong(get("restrictObjectIds"));
    List<RestrictObject> objects = Collections.emptyList();
    if (null != patternIds) {
      objects = entityDao.get(RestrictObject.class, patternIds);
    }
    resource.getObjects().clear();
    resource.getObjects().addAll(objects);

    String categoryIds = get("categoryIds");
    List<UserCategory> categories = entityDao.get(UserCategory.class,
        SeqStrUtils.transformToLong(categoryIds));
    resource.getCategories().clear();
    resource.getCategories().addAll(categories);

    entityDao.saveOrUpdate(resource);
    authorityManager.refreshCache();

    logger.info("save resource success {}", resource.getTitle());
    return redirect("search", "info.save.success");
  }
View Full Code Here

        .get("security.restriction");
    if (null == restrictionMap) {
      restrictionMap = CollectUtils.newHashMap();
      session.put("security.restriction", restrictionMap);
    }
    Resource resource = getResource();
    if (resource.getObjects().isEmpty()) { return Collections.emptyList(); }
    List<Restriction> realms = restrictionMap.get(resource.getId());
    User user = getUser();
    if (null == realms) {
      realms = restrictionService.getRestrictions(user, resource);
      restrictionMap.put(resource.getId(), realms);
    }
    // 没有权限就报错
    if (realms.isEmpty()) { throw new AuthorizationException(SecurityContextHolder.getContext()
        .getAuthentication(), resource.getName()); }
    return realms;
  }
View Full Code Here

TOP

Related Classes of org.beangle.security.blueprint.Resource

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.