Package org.olat.basesecurity

Examples of org.olat.basesecurity.Manager.findIdentityByName()


    assertFalse("Wrong equals implementation, different types are recognized as equals ",ident1.equals(new Integer(1)));
    assertFalse("Wrong equals implementation, different users are recognized as equals ",ident1.equals(ident2));
    assertFalse("Wrong equals implementation, null value is recognized as equals ",ident1.equals(null));
    assertTrue("Wrong equals implementation, same users are NOT recognized as equals ",ident1.equals(ident1));
    Manager ma = ManagerFactory.getManager();
    Identity ident1_2 = ma.findIdentityByName(identityTest1Name);
    assertTrue("Wrong equals implementation, same users are NOT recognized as equals ",ident1.equals(ident1_2));
  }
 
  public void testHashCode() {
    assertTrue("Wrong hashCode implementation, same users have NOT same hash-code ",ident1.hashCode() == ident1.hashCode());
View Full Code Here


 
  public void testHashCode() {
    assertTrue("Wrong hashCode implementation, same users have NOT same hash-code ",ident1.hashCode() == ident1.hashCode());
    assertFalse("Wrong hashCode implementation, different users have same hash-code",ident1.hashCode() == ident2.hashCode());
    Manager ma = ManagerFactory.getManager();
    Identity ident1_2 = ma.findIdentityByName(identityTest1Name);
    assertTrue("Wrong hashCode implementation, same users have NOT same hash-code ",ident1.hashCode() == ident1_2.hashCode());
  }

  /**
   * Export all test cases as suite. Make sure you add your testcase to
View Full Code Here

    String userPW = "olat";
    LDAPError errors = new LDAPError();
   
    boolean usersSyncedAtStartup = LDAPLoginModule.isLdapSyncOnStartup();
    //user should not exits in OLAT when not synced during startup
    assertEquals(usersSyncedAtStartup, (securityManager.findIdentityByName(uid) != null));
    // bind user
    Attributes attrs = ldapManager.bindUser(uid, userPW, errors);
    assertEquals(usersSyncedAtStartup, (securityManager.findIdentityByName(uid) != null));
    //user should be created
    ldapManager.createAndPersistUser(attrs);
View Full Code Here

    boolean usersSyncedAtStartup = LDAPLoginModule.isLdapSyncOnStartup();
    //user should not exits in OLAT when not synced during startup
    assertEquals(usersSyncedAtStartup, (securityManager.findIdentityByName(uid) != null));
    // bind user
    Attributes attrs = ldapManager.bindUser(uid, userPW, errors);
    assertEquals(usersSyncedAtStartup, (securityManager.findIdentityByName(uid) != null));
    //user should be created
    ldapManager.createAndPersistUser(attrs);
    assertEquals(true, (securityManager.findIdentityByName(uid) != null));

    //should fail, user is existing
View Full Code Here

    // bind user
    Attributes attrs = ldapManager.bindUser(uid, userPW, errors);
    assertEquals(usersSyncedAtStartup, (securityManager.findIdentityByName(uid) != null));
    //user should be created
    ldapManager.createAndPersistUser(attrs);
    assertEquals(true, (securityManager.findIdentityByName(uid) != null));

    //should fail, user is existing
    ldapManager.createAndPersistUser(attrs);
    assertEquals(true, (securityManager.findIdentityByName(uid) != null));
  }
View Full Code Here

    ldapManager.createAndPersistUser(attrs);
    assertEquals(true, (securityManager.findIdentityByName(uid) != null));

    //should fail, user is existing
    ldapManager.createAndPersistUser(attrs);
    assertEquals(true, (securityManager.findIdentityByName(uid) != null));
  }

 
  public void testUserBind() throws NamingException {
    if (!LDAPLoginModule.isLDAPEnabled()) return;
View Full Code Here

      } catch (Exception e) {
        // success, this is what we expected
      }
      //changedAttrMap empty since already synchronized
      Attributes attrs = ldapManager.bindUser(uid, pwd, errors);
      Identity identitys = securityManager.findIdentityByName(uid);
      Map<String, String> changedAttrMap = ldapManager.prepareUserPropertyForSync(attrs, identitys);
      // map is empty - no attributes to sync
      assertNull(changedAttrMap);
    } else {
      //create user but with different attributes - must fail since user already exists
View Full Code Here

      // simulate closed session (user adding from startup job)
      DBFactory.getInstance().intermediateCommit();
     
      //changedAttrMap has 2 changes and uid as entrys (Klaus!=klaus, klaus@olat.org!=klaus@meier.ch)
      Attributes attrs = ldapManager.bindUser(uid, pwd, errors);
      Identity identitys = securityManager.findIdentityByName(uid);
      Map<String, String> changedAttrMap = ldapManager.prepareUserPropertyForSync(attrs, identitys);
      // result must be 3: 2 changed plus the user ID which is always in the map
      assertEquals(3, changedAttrMap.keySet().size());
    }
   
View Full Code Here

    }
   
    //nothing to change for this user
    uid= "mrohrer";
    Attributes attrs = ldapManager.bindUser(uid, pwd, errors);
    Identity identitys = securityManager.findIdentityByName(uid);
    Map<String, String> changedAttrMap = ldapManager.prepareUserPropertyForSync(attrs, identitys);
    assertEquals(true, (changedAttrMap==null));
  }
 
  public void testSyncUser(){
View Full Code Here

    changedMap.put("userID", "kmeier");
    changedMap.put("firstName", "Klaus");
    changedMap.put("email", "kmeier@olat.org");
    changedMap.put("institutionalName", "Informatik");
    changedMap.put("homepage", "http://www.olat.org");
    Identity identity = securityManager.findIdentityByName("kmeier");
    ldapManager.syncUser(changedMap, identity);
   
   
    changedMap.put("userID", "kmeier");
    Attributes attrs = ldapManager.bindUser("kmeier", "olat", errors);
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.