Examples of ILocalAccountPerson


Examples of org.jasig.portal.persondir.ILocalAccountPerson

    public void testAccountSearch() throws Exception {
        //Create users
        this.execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                final ILocalAccountPerson user1 = localAccountDao.createPerson("user1");
                user1.setAttribute("attr1", "value1", "ValUe2", "blue");
                user1.setAttribute("attr2", "foobar");
                localAccountDao.updateAccount(user1);
               
                final ILocalAccountPerson user2 = localAccountDao.createPerson("user2");
                user2.setAttribute("attr1", "blue");
                user2.setAttribute("attr2", "barrun");
                localAccountDao.updateAccount(user2);
               
                return null;
            }
        });
       
        //Direct Access
        this.execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
               
                final ILocalAccountPerson user1 = localAccountDao.getPerson("user1");
                assertNotNull(user1);
                assertEquals("user1", user1.getName());
               
                final Map<String, List<Object>> attributes = user1.getAttributes();
                assertNotNull(attributes);
                assertEquals(2, attributes.size());
               
                return null;
            }
View Full Code Here

Examples of org.jasig.portal.persondir.ILocalAccountPerson

        final String toAddress = "to@test.com";
        final String subject = "i18nSubject";
        final String resetUrl = "http://localhost/testing";
        final String displayName = "displayName";

        ILocalAccountPerson person = mock(ILocalAccountPerson.class);
        when(person.getAttributeValue(eq(ILocalAccountPerson.ATTR_DISPLAY_NAME))).thenReturn(displayName);
        when(person.getAttributeValue(eq(ILocalAccountPerson.ATTR_MAIL))).thenReturn(toAddress);

        MimeMessage mockedMimeMessage = mock(MimeMessage.class);
        when(mailSender.createMimeMessage()).thenReturn(mockedMimeMessage);

        URL url = new URL(resetUrl);
View Full Code Here

Examples of org.jasig.portal.persondir.ILocalAccountPerson

     * @link org.jasig.portal.persondir.dao.jpa.JpaLocalAccountDaoImplTest
     */
        this.execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                final ILocalAccountPerson user1 = localAccountDao.createPerson("user1");;
                localAccountDao.updateAccount(user1);
               
                final ILocalAccountPerson user2 = localAccountDao.createPerson("user2");
                localAccountDao.updateAccount(user2);
                return null;
            }
        });
       
View Full Code Here

Examples of org.jasig.portal.persondir.ILocalAccountPerson

                  "VALUES(?, ?, 1, ?, ?)",
                  userId, defaultUserId, nextStructId, username);
      }

     
      ILocalAccountPerson account = this.localAccountDao.getPerson(username);
      final String password = userType.getPassword();
      final List<Attribute> attributes = userType.getAttributes();
      if (password == null && attributes.isEmpty()) {
          //No local account data, clean up the DB
          if (account != null) {
              this.localAccountDao.deleteAccount(account);
          }
      }
      else {
          //Create or Update local account info
            if (account == null) {
                account = this.localAccountDao.createPerson(username);
            }
            account.setPassword(password);
            final Calendar lastPasswordChange = userType.getLastPasswordChange();
            if (lastPasswordChange != null) {
                account.setLastPasswordChange(lastPasswordChange.getTime());
            }
   
            account.removeAttribute(username);
            for (final Attribute attribute : attributes) {
                account.setAttribute(attribute.getName(), attribute.getValues());
            }
           
            this.localAccountDao.updateAccount(account);
      }
  }
View Full Code Here

Examples of org.jasig.portal.persondir.ILocalAccountPerson

          userType = new ExternalUser();
      }
      userType.setUsername(userName);
      userType.setDefaultUser(defaultUserName);
     
      final ILocalAccountPerson localAccountPerson = this.localAccountDao.getPerson(userName);
      if (localAccountPerson != null) {
          userType.setPassword(localAccountPerson.getPassword());
         
          final Date lastPasswordChange = localAccountPerson.getLastPasswordChange();
          if (lastPasswordChange != null) {
              final Calendar lastPasswordChangeCal = Calendar.getInstance();
                lastPasswordChangeCal.setTime(lastPasswordChange);
              userType.setLastPasswordChange(lastPasswordChangeCal);
          }
           
            final List<Attribute> externalAttributes = userType.getAttributes();
            for (final Map.Entry<String, List<Object>> attributeEntry : localAccountPerson.getAttributes().entrySet()) {
                final String name = attributeEntry.getKey();
                final List<Object> values = attributeEntry.getValue();
               
                final Attribute externalAttribute = new Attribute();
                externalAttribute.setName(name);
View Full Code Here

Examples of org.jasig.portal.persondir.ILocalAccountPerson

       
        // check to see if the provided password matches the current account
        // password
        else {
           
            ILocalAccountPerson account = accountDao.getPerson(form.getUserId());
            if (!passwordService.validatePassword(form.getCurrentPassword(), account.getPassword())) {
                context.addMessage(new MessageBuilder().error().source("currentPassword")
                        .code("current.password.doesnt.match")
                        .defaultText("Provided password does not match the current account password").build());
            }
View Full Code Here

Examples of org.jasig.portal.persondir.ILocalAccountPerson

    /*
     * Implementation
     */

    private void sendResetPasswordEmail(final ITenant tenant) {
        ILocalAccountPerson admin = localAccountDao.getPerson(tenant.getAttribute(ADMIN_CONTACT_USERNAME));
        admin.setAttribute("loginToken", userAccountHelper.getRandomToken());
        final HttpServletRequest http = portalRequestUtils.getCurrentPortalRequest();
        this.userAccountHelper.sendLoginToken(http, admin, passwordResetNotification);
        localAccountDao.updateAccount(admin);
    }
View Full Code Here

Examples of org.jasig.portal.persondir.ILocalAccountPerson

                final List<? extends IStylesheetUserPreferences> stylesheetUserPreferences = stylesheetUserPreferencesDao.getStylesheetUserPreferencesForUser(userId);
                for (final IStylesheetUserPreferences stylesheetUserPreference : stylesheetUserPreferences) {
                    stylesheetUserPreferencesDao.deleteStylesheetUserPreferences(stylesheetUserPreference);
                }

                final ILocalAccountPerson person = localAccountDao.getPerson(userName);
                if (person != null) {
                    localAccountDao.deleteAccount(person);
                }
            }
        });
View Full Code Here

Examples of org.jasig.portal.persondir.ILocalAccountPerson

    }
   
    @Override
    @PortalTransactional
    public ILocalAccountPerson createPerson(String username) {
        final ILocalAccountPerson person = new LocalAccountPersonImpl(username);
       
        this.getEntityManager().persist(person);
       
        return person;
    }
View Full Code Here

Examples of org.jasig.portal.persondir.ILocalAccountPerson

    public void deleteAccount(ILocalAccountPerson account) {
        Validate.notNull(account, "definition can not be null");
       
        final EntityManager entityManager = this.getEntityManager();
       
        final ILocalAccountPerson persistentAccount;
        if (entityManager.contains(account)) {
            persistentAccount = account;
        }
        else {
            persistentAccount = entityManager.merge(account);
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.