Exemple #1
0
  /**
   * @param userId
   * @param pageNo
   * @param pageSize
   * @return
   */
  public Page<CoreRole> queryByUserId(String userId, int pageNo, int pageSize) {
    CoreUser user = super.get(CoreUser.class, userId);
    Criteria criteria = this.createCriteria();
    Page<CoreRole> page = pagedQuery(criteria, pageNo, pageSize);

    List<CoreRole> list = page.getResult();
    for (CoreRole role : list) {
      if (role.getUsers().contains(user)) role.setChecked(true);
    }

    return page;
  }
Exemple #2
0
 @RemoteMethod
 public void changeRes(String roleid, String[] checked) {
   //		System.out.println(roleid);
   CoreRole role = this.get(roleid);
   Set<CoreResource> resList = role.getResources();
   if (!resList.isEmpty()) resList.clear();
   for (String id : checked) {
     CoreResource res = this.get(CoreResource.class, id);
     role.getResources().add(res);
   }
   RefreshAuthManager.refresh();
 }