Package org.damour.base.client.objects

Examples of org.damour.base.client.objects.UserGroup


      admin.setSignupDate(System.currentTimeMillis());
      admin.setAdministrator(true);
      admin.setValidated(true);
      session.save(admin);

      UserGroup group = new UserGroup();
      group.setName("admin-group");
      group.setOwner(admin);
      session.save(group);

      GroupMembership membership = new GroupMembership();
      membership.setUser(admin);
      membership.setUserGroup(group);
      session.save(membership);

      File f = new File();
      f.setName("Test File");
      f.setOwner(admin);
      session.save(f);
    }
    User anonymous = UserHelper.getUser(session, "anonymous");
    if (anonymous == null) {
      anonymous = new User();
      anonymous.setUsername("anonymous");
      MD5 md5 = new MD5();
      md5.Update("s,!5C6xAwM");
      anonymous.setPasswordHash(md5.asHex());
      anonymous.setFirstname("anonymous");
      anonymous.setLastname("anonymous");
      anonymous.setPasswordHint("default");
      anonymous.setSignupDate(System.currentTimeMillis());
      anonymous.setAdministrator(false);
      anonymous.setValidated(true);
      session.save(anonymous);

      UserGroup group = new UserGroup();
      group.setName("anonymous-group");
      group.setOwner(anonymous);
      session.save(group);

      GroupMembership membership = new GroupMembership();
      membership.setUser(anonymous);
      membership.setUserGroup(group);
View Full Code Here


      perm.setSecurityPrincipal(user);
      perm.setPermissibleObject(folder);
      session.save(perm);
    }   

    UserGroup group = new UserGroup();
    group.setName("blah");
    session.save(group);
    GroupMembership membership = new GroupMembership();
    membership.setUser(user2);
    membership.setUserGroup(group);
    session.save(membership);
View Full Code Here

      session.save(user);
    }
    int NUM_GROUPS = 100;
    List<User> users = SecurityHelper.getUsers(session);
    for (int i = 0; i < NUM_GROUPS; i++) {
      UserGroup group = new UserGroup();
      group.setName("group" + i);
      session.save(group);
      for (User user : users) {
        GroupMembership groupMembership = new GroupMembership();
        groupMembership.setUser(user);
        groupMembership.setUserGroup(group);
View Full Code Here

      session.save(user);
    }
    int NUM_GROUPS = 10;
    List<User> users = SecurityHelper.getUsers(session);
    for (int i = 0; i < NUM_GROUPS; i++) {
      UserGroup group = new UserGroup();
      group.setName("group" + i);
      session.save(group);
      for (User user : users) {
        GroupMembership groupMembership = new GroupMembership();
        groupMembership.setUser(user);
        groupMembership.setUserGroup(group);
View Full Code Here

      session.save(user);
    }
    int NUM_GROUPS = 10;
    List<User> users = SecurityHelper.getUsers(session);
    for (int i = 0; i < NUM_GROUPS; i++) {
      UserGroup group = new UserGroup();
      group.setName("group" + i);
      session.save(group);
      for (User user : users) {
        GroupMembership groupMembership = new GroupMembership();
        groupMembership.setUser(user);
        groupMembership.setUserGroup(group);
View Full Code Here

      Session session = HibernateUtil.getInstance().getSession();
      Transaction tx = session.beginTransaction();
      User user = new User();
      user.setUsername("username");
      session.save(user);
      UserGroup group = new UserGroup();
      group.setName("group");
      session.save(group);
      tx.commit();
      session.close();
      for (int i = 0; i < 2; i++) {
        session = HibernateUtil.getInstance().getSession();
View Full Code Here

  @Test
  public void createDuplicateGroupTest() {
    try {
      Session session = HibernateUtil.getInstance().getSession();
      Transaction tx = session.beginTransaction();
      UserGroup group1 = new UserGroup();
      group1.setName("group");
      session.save(group1);
      UserGroup group2 = new UserGroup();
      group2.setName("group");
      session.save(group2);
      tx.commit();
      session.close();
      throw new AssertionError("Created duplicate users!");
    } catch (ConstraintViolationException e) {
View Full Code Here

    String username = "testuser";
    User user = new User();
    user.setUsername(username);
    session.save(user);

    UserGroup group = new UserGroup();
    group.setName("group");
    session.save(group);

    GroupMembership membership = new GroupMembership();
    membership.setUser(user);
    membership.setUserGroup(group);
View Full Code Here

    String username = "testuser";
    User user = new User();
    user.setUsername(username);
    session.save(user);

    UserGroup group = new UserGroup();
    group.setName("group");
    session.save(group);

    GroupMembership membership = new GroupMembership();
    membership.setUser(user);
    membership.setUserGroup(group);
View Full Code Here

          newUser.setValidated(true);
        }

        session.get().save(newUser);

        UserGroup userGroup = new UserGroup();
        userGroup.setName(newUser.getUsername());
        userGroup.setVisible(true);
        userGroup.setAutoJoin(false);
        userGroup.setLocked(false);
        userGroup.setOwner(newUser);

        session.get().save(userGroup);

        GroupMembership groupMembership = new GroupMembership();
        groupMembership.setUser(newUser);
View Full Code Here

TOP

Related Classes of org.damour.base.client.objects.UserGroup

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.