Package com.github.zhangkaitao.shiro.chapter22.service

Examples of com.github.zhangkaitao.shiro.chapter22.service.UserService


     * 根据用户名查找其权限
     * @param username
     * @return
     */
    public Set<String> findPermissions(String username) {
        User user =findByUsername(username);
        if(user == null) {
            return Collections.EMPTY_SET;
        }
        return roleService.findPermissions(user.getRoleIds().toArray(new Long[0]));
    }
View Full Code Here


        return false;
    }

    @Override
    public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
        CurrentUser currentUserAnnotation = parameter.getParameterAnnotation(CurrentUser.class);
        return webRequest.getAttribute(currentUserAnnotation.value(), NativeWebRequest.SCOPE_REQUEST);
    }
View Full Code Here

*/
public class UserTests extends ForgeAPITestBase {

  @Test
  public void testListUsers() throws IOException {
    UserService service = getTestUserForge().createUserService();
    List<User> Users = service.list(null);
    assertNotNull("Null User list", Users);
    assertFalse("Empty User list", Users.isEmpty());
  }
View Full Code Here

    assertFalse("Empty User list", Users.isEmpty());
  }

  @Test
  public void testListUsersSorted() throws IOException {
    UserService service = getTestUserForge().createUserService();
    ListPreferences listPrefs = new ListPreferences();
    listPrefs.setLimit(4);
    listPrefs.setOffset(1);
    listPrefs.setSortBy("username");
    listPrefs.setSortOrder("descending");
    List<User> Users = service.list(listPrefs);
    assertNotNull("Null User list", Users);
    assertFalse("Empty User list", Users.isEmpty());
  }
View Full Code Here

    assertFalse("Empty User list", Users.isEmpty());
  }

  @Test
  public void testUserDetail() throws IOException {
    UserService service = getTestUserForge().createUserService();
    User user = service.get(TEST_USER);
    assertNotNull("Null user", user);
  }
View Full Code Here

TOP

Related Classes of com.github.zhangkaitao.shiro.chapter22.service.UserService

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.