Examples of AppUser


Examples of com.apress.prospring3.springblog.domain.AppUser

   
    System.out.println("App context initialized successfully");       

    UserService userService = ctx.getBean("userService", UserService.class);
   
    AppUser appUser = userService.findByUserName("clarence");
   
    System.out.println("User name: " + appUser.getUserName());
  }
View Full Code Here

Examples of com.apress.prospring3.springblog.domain.AppUser

    logger.info("Loading user record for user name: {}", userName);
   
    UserDetails userDetails = null;  
   
    AppUser user = userService.findByUserName(userName);
   
    if (user != null) {
     
      String password = user.getPassword();
           
            Set<Role> roles = user.getRoles();
            List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
            for (Role role: roles) {
                String roleName = role.getRoleId();
                GrantedAuthority grantedAuthority = new SimpleGrantedAuthority(roleName);
                authorities.add(grantedAuthority);
View Full Code Here

Examples of com.impetus.client.crud.entities.AppUser

    }

    @Test
    public void test()
    {
        AppUser user = new AppUser();
        user.setId("id");
        PhoneDirectory properties = new PhoneDirectory();
        user.setPropertyContainer(properties);
        em.persist(user);

        em.clear();

        AppUser result = em.find(AppUser.class, "id");

        Assert.assertNotNull(result);
        Assert.assertNotNull(result.getId());
        Assert.assertNotNull(result.getPropertyKeys());
        Assert.assertFalse(result.getPropertyKeys().isEmpty());
        Assert.assertEquals(1, result.getPropertyKeys().size());
        Assert.assertNotNull(result.getNickName());
        Assert.assertFalse(result.getNickName().isEmpty());
        Assert.assertEquals(1, result.getNickName().size());
        Assert.assertTrue(result.getNickName().contains("kk"));
        Assert.assertNotNull(result.getFriendList());
        Assert.assertFalse(result.getFriendList().isEmpty());
        Assert.assertEquals(2, result.getFriendList().size());
        Assert.assertNotNull(result.getTags());
        Assert.assertFalse(result.getTags().isEmpty());
        Assert.assertEquals(1, result.getTags().size());
        Assert.assertEquals("yo", result.getTags().get(0));

        PhoneDirectory propertyContainer = result.getPhoneDirectory();
        Assert.assertNotNull(propertyContainer);
        Assert.assertEquals("MyPhoneDirectory", propertyContainer.getPhoneDirectoryName());
        Assert.assertNotNull(propertyContainer.getContactMap());
        Assert.assertFalse(propertyContainer.getContactMap().isEmpty());
        Assert.assertEquals(1, propertyContainer.getContactMap().size());
View Full Code Here

Examples of net.sf.mark.authority.po.AppUser

   * init所有权限
   * @param userLoginName
   * @return
   */
  public AppUser findByUserLoginName(String userLoginName) {
    AppUser user = userDao.findByUserLoginName(userLoginName);
    if (user != null) {
      Hibernate.initialize(user.getAppRoles());
      for (AppRole role : user.getAppRoles()) {
        Hibernate.initialize(role.getAppAuths());
      }
    }
    return user;
  }
View Full Code Here

Examples of net.sf.mark.authority.po.AppUser

    userDao.delete(instance);
  }

  @Override
  public AppUser findById(String id) {
    AppUser user = userDao.findById(id);
    Hibernate.initialize(user.getAppRoles());
    return user;
  }
View Full Code Here

Examples of net.sf.mark.authority.po.AppUser

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        if (log.isDebugEnabled()) log.debug("========> loadUserByUsername() username: {}", username);

        AppUser user = userService.findByUserLoginName(username);
        if (user == null)
            throw new UsernameNotFoundException("用户(" + username + ")不存在");

        if (log.isDebugEnabled()) {
            log.debug("========> user: {}", user);
            log.debug("========> password: {}", user.getUserPassword());
        }
       
        boolean accountNonExpired = true;
        boolean credentialsNonExpired = true;
        boolean accountNonLocked = true;

        UserDetailsImpl userdetail = new UserDetailsImpl(
                user.getUserLoginName(), user.getUserPassword(), user.getDisableFlag(), accountNonExpired, credentialsNonExpired,
                accountNonLocked, obtainGrantedAuthorities(user), user);

        return userdetail;
    }
View Full Code Here

Examples of net.sf.mark.authority.po.AppUser

      return null;

    if (principal instanceof UserDetailsImpl) {
      UserDetailsImpl userDetails = (UserDetailsImpl) principal;

      AppUser appUser = userDetails.getAppUser();

      return appUser;
    } else {
      return null;
    }
View Full Code Here

Examples of net.sf.mark.authority.po.AppUser

   *
   * @return
   */
  public static String getCurrentUserId() {

    AppUser appUser = getCurrentUser();

    if (appUser == null)
      return null;

    return appUser.getId();
  }
View Full Code Here

Examples of net.sf.mark.authority.po.AppUser

  @Override
  protected void prepareModel() throws Exception {
    if (StringUtils.isNotBlank(filterId)) {
      entity = userService.findById(filterId);
    } else {
      entity = new AppUser();
    }
  }
View Full Code Here

Examples of net.sf.mark.authority.po.AppUser

  private static final String USER_ID = "c220319de9b447149afb17592bd8fd4c";
  private static final String ROLE_ID = "c4f90f1c228d45a099e1ff0869e0fe3c";
 
  @Test
  public void testSaveOrUpdate() {
    AppUser instance = new AppUser();
    instance.setUserLoginName("admin");
    instance.setUserPassword("admin");
    instance.setUserEmail("marksong@163.com");
    instance.setUserNickName("马克");
    AppRole role = new AppRole();
    role.setRoleName("管理员");
    instance.getAppRoles().add(role);
    roleService.saveOrUpdate(role);
    userService.saveOrUpdate(instance);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.