Example #1
0
  @Test(dataProvider = "C49189", dataProviderClass = TestDataProvider.class)
  public void changeUserPassword(String currency) {
    homePage = new HomePage();
    popUpPage = new PopUpPage();

    homePage.clickAuthBtn();
    popUpPage.authorization(email, password);

    asserts = new Asserts();
    asserts.checkLoginIsSuccessful(currency);

    userPage = new UserPage();
    userPage.clickUserProfile();

    userProfile = new UserProfile();
    userProfile.changePassword("globotest", "globotest1", "globotest1");
    asserts.checkChangePasswordMsg("Ваш пароль был успешно изменен");
    userProfile.clickPopupClose();

    userPage.logOut();

    popUpPage = homePage.clickAuthBtn();
    popUpPage.authorization(email, newPassword);

    asserts.checkLoginIsSuccessful(currency);

    userPage.clickUserProfile();

    userProfile.changePassword("globotest1", "globotest", "globotest");
    asserts.checkChangePasswordMsg("Ваш пароль был успешно изменен");
    userProfile.clickPopupClose();

    userPage.logOut();
  }
    @Override
    protected Void doInBackground(Void... params) {
      // Create the array
      userProfileList = new ArrayList<UserProfile>();
      try {

        // Locate the class table named "Country" in Parse.com
        ParseQuery<ParseUser> query = ParseUser.getQuery();

        Log.d("UserListActivity", "In asynctask.. username - " + currentUser.getUsername());

        query.whereNotEqualTo("username", currentUser.getUsername());

        // by ascending LastName
        query.orderByAscending("lastName");
        ob = query.find();
        for (ParseObject userProfile : ob) {

          UserProfile map = new UserProfile();
          map.setFirstName((String) userProfile.get("firstName"));
          map.setLastName((String) userProfile.get("lastName"));
          map.setDepartment((String) userProfile.get("department"));
          map.setUsername((String) userProfile.get("username"));

          userProfileList.add(map);
        }
      } catch (ParseException e) {
        Log.e("Error", e.getMessage());
        e.printStackTrace();
      }
      return null;
    }
 public ActivityCommentJSON(UserProfile userProfile, String message, Activity activity) {
   this.setCreated(new Date());
   this.setOwnerId(userProfile.getUserId());
   this.setOwnerName(userProfile.getFullName());
   this.setMessage(message);
   this.setActivityId(activity.getId());
 }
  /**
   * Retrieves the user profile information in a manner supported by Ice Cream Sandwich devices.
   *
   * @param context the context from which to retrieve the user's email address and name
   * @return a list of the possible user's email address and name
   */
  @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
  private static UserProfile getUserProfileOnIcsDevice(Context context) throws Exception {
    final ContentResolver content = context.getContentResolver();
    final Cursor cursor =
        content.query(
            // Retrieves data rows for the device user's 'profile' contact
            Uri.withAppendedPath(
                ContactsContract.Profile.CONTENT_URI,
                ContactsContract.Contacts.Data.CONTENT_DIRECTORY),
            ProfileQuery.PROJECTION,

            // Selects only email addresses or names
            ContactsContract.Contacts.Data.MIMETYPE
                + "=? OR "
                + ContactsContract.Contacts.Data.MIMETYPE
                + "=? OR "
                + ContactsContract.Contacts.Data.MIMETYPE
                + "=?"
                + " OR "
                + ContactsContract.Contacts.Data.MIMETYPE
                + "=?",
            new String[] {
              ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE,
              ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE,
              ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE,
              ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE
            },

            // Show primary rows first. Note that there won't be a primary
            // email address if the
            // user hasn't specified one.
            ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");

    UserProfile userProfile = getUserProfileOnGingerbreadDevice(context);
    String mime_type;
    while (cursor != null && cursor.moveToNext()) {
      mime_type = cursor.getString(ProfileQuery.MIME_TYPE);
      if (mime_type.equals(ContactsContract.CommonDataKinds.Email.CONTENT_ITEM_TYPE))
        userProfile.addPossibleEmail(
            cursor.getString(ProfileQuery.EMAIL), cursor.getInt(ProfileQuery.IS_PRIMARY_EMAIL) > 0);
      else if (mime_type.equals(ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE))
        userProfile.addPossibleName(
            cursor.getString(ProfileQuery.GIVEN_NAME)
                + " "
                + cursor.getString(ProfileQuery.FAMILY_NAME));
      else if (mime_type.equals(ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE))
        userProfile.addPossiblePhoneNumber(
            cursor.getString(ProfileQuery.PHONE_NUMBER),
            cursor.getInt(ProfileQuery.IS_PRIMARY_PHONE_NUMBER) > 0);
      else if (mime_type.equals(ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE))
        userProfile.addPossiblePhoto(Uri.parse(cursor.getString(ProfileQuery.PHOTO)));
    }

    if (cursor != null) {
      cursor.close();
    }

    return userProfile;
  }
 @Override
 public boolean isAliasInUse(String alias, String username) {
   UserProfile userProfile = getUserProfileByImId(alias);
   if (userProfile != null && !userProfile.getUserName().equals(username)) {
     return true;
   }
   return false;
 }
 @Override
 public Integer getUserIdByImId(String imId) {
   UserProfile userProfile = getUserProfileByImId(imId);
   if (userProfile != null) {
     return Integer.valueOf(userProfile.getUserId());
   }
   return null;
 }
 @Override
 public String getUsernameByImId(String imId) {
   UserProfile userProfile = getUserProfileByImId(imId);
   if (userProfile != null) {
     return userProfile.getUserName();
   }
   return null;
 }
 @Override
 public boolean isImIdInUse(String imId, Integer userId) {
   UserProfile userProfile = getUserProfileByImId(imId);
   if (userProfile != null && !userProfile.getUserId().equals(userId.toString())) {
     return true;
   }
   return false;
 }
Example #9
0
  public boolean hasPermission(String permissionType) {
    Set<UserProfile> a = getUserProfiles();

    for (UserProfile i : a) {
      if (permissionType.equals(i.getType())) return true;
    }

    return false;
  }
Example #10
0
 public boolean hasGroup(String type) {
   for (UserProfile up : roles) {
     if (up.getType().equals(type)) {
       System.out.println("User get type: " + up.getType() + " role " + type);
       return false;
     }
   }
   return false;
 }
Example #11
0
  public UserCacheMgr(Cognoscenti _cog) throws Exception {
    cog = _cog;
    needsRecalc = new HashSet<String>();

    // now initialize all users as needing a recalc sisce we don't know who
    // needed update at the time the server was last shut down.
    for (UserProfile up : UserManager.getAllUserProfiles()) {
      needsRecalc.add(up.getKey());
    }
  }
 @Override
 public boolean preHandle(HttpServletRequest req, HttpServletResponse response, Object arg2)
     throws Exception {
   logger.info("preHandle uri : {}, method : {}", req.getRequestURI(), req.getMethod());
   UserProfile userprofile = (UserProfile) req.getSession().getAttribute("userprofile");
   // Assert.notNull(userprofile, "请登陆");
   if (userprofile == null
       || userprofile.isPlatformUser()
       || userprofile instanceof GuestProfile) {
     response.sendRedirect("/" + req.getContextPath());
     return false;
   }
   return true;
 }
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    DBSession dbs = (DBSession) incomingRequest.get("dbsession");
    UserProfile userProfile = (UserProfile) incomingRequest.get("userProfile");
    if (userProfile == null) {
      userProfile = new UserProfile();
      String userId = (String) incomingRequest.get("UserProfile_userId");
      userProfile.setUserId(userId);
    }

    dbs.delete(userProfile);
    this.setStatus(dbs.getStatus());
    return userProfile;
  }
 private void ShowCongrats() {
   if (user.isLevelUp()) {
     displayCongratsImage();
     Toast.makeText(getApplicationContext(), "Congratulation! Your level is up", Toast.LENGTH_LONG)
         .show();
   } else speakOut("You're right");
 }
  @Override
  public void openCommonUserProfile(View anchor, User user) {
    if (LayoutSpec.isTablet(getActivity())) {
      IConnectStore.UserRequester userRequester =
          IConnectStore.UserRequester.valueOf(getArguments().getString(ARGUMENT_USER_REQUESTER));
      if (userRequester == IConnectStore.UserRequester.CONVERSATION) {
        // Launch common user in new popover
        getControllerFactory()
            .getConversationScreenController()
            .setPopoverLaunchedMode(DialogLaunchMode.COMMON_USER);
        getControllerFactory().getPickUserController().showUserProfile(user, anchor);
      } else {
        // Lauch common user in existing popover
        getContainer().openCommonUserProfile(anchor, user);
      }
    } else {
      if (isShowingCommonUserProfile) {
        return;
      }

      isShowingCommonUserProfile = true;

      getControllerFactory().getNavigationController().setRightPage(Page.COMMON_USER_PROFILE, TAG);

      UserProfile profileFragment =
          (UserProfile)
              getChildFragmentManager().findFragmentById(R.id.fl__pending_connect_request);
      if (profileFragment != null) {
        profileFragment.isBelowUserProfile(true);
      }

      getStoreFactory().getSingleParticipantStore().setUser(user);

      getChildFragmentManager()
          .beginTransaction()
          .setCustomAnimations(
              R.anim.open_profile, R.anim.close_profile, R.anim.open_profile, R.anim.close_profile)
          .replace(
              R.id.fl__pending_connect_request,
              SingleParticipantFragment.newInstance(true, IConnectStore.UserRequester.SEARCH),
              SingleParticipantFragment.TAG)
          .addToBackStack(SingleParticipantFragment.TAG)
          .commit();
    }
  }
  /**
   * Retrieves the user profile information in a manner supported by Gingerbread devices.
   *
   * @param context the context from which to retrieve the user's email address and name
   * @return a list of the possible user's email address and name
   */
  private static UserProfile getUserProfileOnGingerbreadDevice(Context context) {
    // Other that using Patterns (API level 8) this works on devices down to
    // API level 5
    final Matcher valid_email_address = Patterns.EMAIL_ADDRESS.matcher("");
    final Account[] accounts =
        AccountManager.get(context).getAccountsByType(GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE);
    UserProfile user_profile = new UserProfile();
    // As far as I can tell, there is no way to get the real name or phone
    // number from the Google account
    for (Account account : accounts) {
      if (valid_email_address.reset(account.name).matches())
        user_profile.addPossibleEmail(account.name);
    }
    // Gets the phone number of the device is the device has one
    if (context.getPackageManager().hasSystemFeature(Context.TELEPHONY_SERVICE)) {
      final TelephonyManager telephony =
          (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
      user_profile.addPossiblePhoneNumber(telephony.getLine1Number());
    }

    return user_profile;
  }
Example #17
0
 @Transient
 public ArticleEntityDTO toDTOWithoutPages() {
   ArticleEntityDTO dto = new ArticleEntityDTO();
   dto.setAuthor(author.toDTO());
   dto.setCategory(category.toDTO());
   dto.setCreationDate(creationDate);
   dto.setFirstPublicationDate(firstPublicationDate);
   dto.setId(id);
   dto.setPublished(published);
   dto.setTitle(title);
   dto.setText(text);
   dto.setTeaser(teaser);
   return dto;
 }
  @Override
  protected void onStop() {
    super.onStop();
    // Enlever les listeners
    myFirebaseGroupRef.removeEventListener(mValueEventListener);

    // Enlever l'usager des ready si on ne passe pas au vote
    if (removeLocalUserOnFinish) {
      myFirebaseGroupRef.child("members").child(mCurrentProfile.getSanitizedEmail()).removeValue();
      // Si on était admin, s'enlever aussi comme admin
      if (mCurrentProfile.organizer) {
        myFirebaseGroupRef.child("organizer").removeValue();
      }
    }
    /*
    Query q = myFirebaseGroupRef;
    q.addChildEventListener(new ChildEventListener() {
        public void onChildAdded(DataSnapshot snapshot, String previousChild) {
            System.out.println("LEAVING QUERY");
            if(!snapshot.hasChild("readyState"))
            {
                myFirebaseGroupRef.child("members").child(mCurrentProfile.getSanitizedEmail()).removeValue();
                System.out.println("REMOVED USER");
            }
        }

        @Override
        public void onChildChanged(DataSnapshot dataSnapshot, String s) { }

        @Override
        public void onChildRemoved(DataSnapshot dataSnapshot) { }

        @Override
        public void onChildMoved(DataSnapshot dataSnapshot, String s) { }

        @Override
        public void onCancelled(FirebaseError firebaseError) { }
    });

    System.out.println("ACTIVITY STOPPED, WAITING ROOM");*/
  }
  public UserProfile unmarshall(JsonUnmarshallerContext context) throws Exception {
    UserProfile userProfile = new UserProfile();

    int originalDepth = context.getCurrentDepth();
    String currentParentElement = context.getCurrentParentElement();
    int targetDepth = originalDepth + 1;

    JsonToken token = context.getCurrentToken();
    if (token == null) token = context.nextToken();
    if (token == VALUE_NULL) return null;

    while (true) {
      if (token == null) break;

      if (token == FIELD_NAME || token == START_OBJECT) {
        if (context.testExpression("IamUserArn", targetDepth)) {
          context.nextToken();
          userProfile.setIamUserArn(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("Name", targetDepth)) {
          context.nextToken();
          userProfile.setName(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("SshUsername", targetDepth)) {
          context.nextToken();
          userProfile.setSshUsername(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("SshPublicKey", targetDepth)) {
          context.nextToken();
          userProfile.setSshPublicKey(StringJsonUnmarshaller.getInstance().unmarshall(context));
        }
        if (context.testExpression("AllowSelfManagement", targetDepth)) {
          context.nextToken();
          userProfile.setAllowSelfManagement(
              BooleanJsonUnmarshaller.getInstance().unmarshall(context));
        }
      } else if (token == END_ARRAY || token == END_OBJECT) {
        if (context.getLastParsedParentElement() == null
            || context.getLastParsedParentElement().equals(currentParentElement)) {
          if (context.getCurrentDepth() <= originalDepth) break;
        }
      }
      token = context.nextToken();
    }

    return userProfile;
  }
Example #20
0
 private void sendGetRequest(String urlStr, HashMap<String, String> params) {
   HttpURLConnection urlConnection = null;
   JSONObject json = null;
   URL url;
   try {
     urlStr += "?";
     for (String key : params.keySet()) {
       urlStr += key + "=";
       urlStr += params.get(key);
       urlStr += "&";
     }
     urlStr = urlStr.substring(0, urlStr.length() - 1);
     url = new URL(urlStr);
     InputStream response;
     urlConnection = (HttpURLConnection) url.openConnection();
     response = urlConnection.getInputStream();
     json = convertStreamToJSON(response);
   } catch (Exception e) {
     e.printStackTrace();
   }
   up.handleResponse(responseCode, json);
 }
Example #21
0
  private void sendPostRequest(String urlStr, String urlParams, boolean isJSON) {
    HttpURLConnection urlConnection = null;
    JSONObject json = null;
    URL url;
    try {
      url = new URL(urlStr);

      urlConnection = (HttpURLConnection) url.openConnection();
      urlConnection.setRequestMethod("POST");

      Log.d("kimreik", "isJson " + isJSON);
      if (isJSON) {
        urlConnection.setRequestProperty("Content-Type", "application/json"); // ;
        // charset=utf-8
        urlConnection.setRequestProperty("Accept", "application/json");
      } else {
        // urlConnection.setRequestProperty("Content-Type",
        // "charset=utf-8");
      }
      urlConnection.setDoOutput(true);
      DataOutputStream wr = new DataOutputStream(urlConnection.getOutputStream());
      if (isJSON) {
        wr.write(urlParams.getBytes("UTF-8"));
      } else {
        wr.writeBytes(urlParams);
      }
      wr.flush();
      wr.close();

      InputStream response;
      response = urlConnection.getInputStream();
      json = convertStreamToJSON(response);
    } catch (Exception e) {
      e.printStackTrace();
    }
    up.handleResponse(responseCode, json);
  }
Example #22
0
 private UserProfile getUserProfile(Node profileNode) throws Exception {
   UserProfile userProfile = new UserProfile();
   userProfile.setUserId(profileNode.getName());
   PropertyReader reader = new PropertyReader(profileNode);
   userProfile.setScreenName(
       reader.string(
           ForumNodeTypes.EXO_SCREEN_NAME,
           reader.string(ForumNodeTypes.EXO_FULL_NAME, profileNode.getName())));
   userProfile.setFullName(reader.string(ForumNodeTypes.EXO_FULL_NAME));
   userProfile.setFirstName(reader.string(ForumNodeTypes.EXO_FIRST_NAME));
   userProfile.setLastName(reader.string(ForumNodeTypes.EXO_LAST_NAME));
   userProfile.setEmail(reader.string(ForumNodeTypes.EXO_EMAIL));
   userProfile.setUserRole(reader.l(ForumNodeTypes.EXO_USER_ROLE));
   userProfile.setUserTitle(reader.string(ForumNodeTypes.EXO_USER_TITLE, ""));
   userProfile.setSignature(reader.string(ForumNodeTypes.EXO_SIGNATURE));
   userProfile.setTotalPost(reader.l(ForumNodeTypes.EXO_TOTAL_POST));
   userProfile.setTotalTopic(reader.l(ForumNodeTypes.EXO_TOTAL_TOPIC));
   userProfile.setBookmark(reader.strings(ForumNodeTypes.EXO_BOOKMARK));
   userProfile.setLastLoginDate(reader.date(ForumNodeTypes.EXO_LAST_LOGIN_DATE));
   userProfile.setJoinedDate(reader.date(ForumNodeTypes.EXO_JOINED_DATE));
   userProfile.setLastPostDate(reader.date(ForumNodeTypes.EXO_LAST_POST_DATE));
   userProfile.setIsDisplaySignature(reader.bool(ForumNodeTypes.EXO_IS_DISPLAY_SIGNATURE));
   userProfile.setIsDisplayAvatar(reader.bool(ForumNodeTypes.EXO_IS_DISPLAY_AVATAR));
   userProfile.setShortDateFormat(
       reader.string(ForumNodeTypes.EXO_SHORT_DATEFORMAT, userProfile.getShortDateFormat()));
   userProfile.setLongDateFormat(
       reader.string(ForumNodeTypes.EXO_LONG_DATEFORMAT, userProfile.getLongDateFormat()));
   userProfile.setTimeFormat(
       reader.string(ForumNodeTypes.EXO_TIME_FORMAT, userProfile.getTimeFormat()));
   userProfile.setMaxPostInPage(reader.l(ForumNodeTypes.EXO_MAX_POST, 10));
   userProfile.setMaxTopicInPage(reader.l(ForumNodeTypes.EXO_MAX_TOPIC, 10));
   userProfile.setIsShowForumJump(reader.bool(ForumNodeTypes.EXO_IS_SHOW_FORUM_JUMP, true));
   userProfile.setModerateForums(
       reader.strings(ForumNodeTypes.EXO_MODERATE_FORUMS, new String[] {}));
   userProfile.setModerateCategory(
       reader.strings(ForumNodeTypes.EXO_MODERATE_CATEGORY, new String[] {}));
   userProfile.setNewMessage(reader.l(ForumNodeTypes.EXO_NEW_MESSAGE));
   userProfile.setTimeZone(reader.d(ForumNodeTypes.EXO_TIME_ZONE));
   userProfile.setIsBanned(reader.bool(ForumNodeTypes.EXO_IS_BANNED));
   userProfile.setBanUntil(reader.l(ForumNodeTypes.EXO_BAN_UNTIL));
   userProfile.setBanReason(reader.string(ForumNodeTypes.EXO_BAN_REASON, ""));
   userProfile.setBanCounter(Integer.parseInt(reader.string(ForumNodeTypes.EXO_BAN_COUNTER, "0")));
   userProfile.setBanReasonSummary(
       reader.strings(ForumNodeTypes.EXO_BAN_REASON_SUMMARY, new String[] {}));
   userProfile.setCreatedDateBan(reader.date(ForumNodeTypes.EXO_CREATED_DATE_BAN));
   return userProfile;
 }
Example #23
0
 /**
  * @param pUser the user profile
  * @return true if the user profile has this MP, else return false.
  */
 public boolean isInUserProfile(UserProfile pUser) {
   if (pUser.getMPs().contains(this)) {
     return true;
   }
   return false;
 }
Example #24
0
 public void needRecalc(UserProfile userWhoMightHaveChanges) {
   String aUser = userWhoMightHaveChanges.getKey();
   System.out.println("USERCACHE: this user needs recalc: " + aUser);
   needsRecalc.add(aUser);
 }
 @Override
 public void deleteUserProfile(UserProfile profile) {
   m_template.remove(profile);
   deleteAvatar(profile.getUserName());
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_waiting_room);

    // assigner la référence pour la liste
    mReadyUsersList = (ListView) findViewById(R.id.listView);
    mArrayList = new ArrayList<>();
    mArrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, mArrayList);
    mReadyUsersList.setAdapter(mArrayAdapter);

    // recueillir les valeurs passées
    mCurrentProfile = (UserProfile) getIntent().getExtras().get("profile");
    InitialBatterieLevel = (int) getIntent().getExtras().get("batterie");

    // mettre le bouton continue invisible. On le rendra visible si la BD dit qu'on est admin
    mAdminStartButton = (Button) findViewById(R.id.adminStartButton);
    mAdminStartButton.setVisibility(View.INVISIBLE);

    // setup la connexion à la BD
    Firebase.setAndroidContext(this);

    myFirebaseGroupRef =
        new Firebase("https://sizzling-inferno-7505.firebaseio.com/")
            .child("readyGroups")
            .child(mCurrentProfile.groupName);

    // S'ajouter à la BD si on n'est pas déjà là.
    // Ajouter l'usager à la liste des usagers prêts. La valeur deviendra vraie s'ils sont toujours
    // présents quand l'admin débute la séance.

    myFirebaseGroupRef
        .child("members")
        .runTransaction(
            new Transaction.Handler() {
              @Override
              public Transaction.Result doTransaction(MutableData currentData) {
                if (!currentData.hasChild(mCurrentProfile.getSanitizedEmail())
                    || !((Boolean)
                            currentData.child(mCurrentProfile.getSanitizedEmail()).getValue())
                        .equals(Boolean.TRUE)) {
                  currentData.child(mCurrentProfile.getSanitizedEmail()).setValue(false);
                }
                return Transaction.success(currentData);
              }

              @Override
              public void onComplete(
                  FirebaseError firebaseError, boolean b, DataSnapshot dataSnapshot) {}
            });

    // Si l'usager a coché la case organizer, devenir admin s'il n'y en a pas déjà un sur la bd
    if (mCurrentProfile.organizer) {
      // On décoche le fait qu'on est admin, parce qu'il faut que la bd le confirme
      mCurrentProfile.organizer = false;

      myFirebaseGroupRef
          .child("organizer")
          .runTransaction(
              new Transaction.Handler() {
                @Override
                public Transaction.Result doTransaction(MutableData currentData) {
                  // S'il n'y a pad d'organisateur, on se met comme organisateur
                  if (currentData.getValue() == null) {
                    currentData.setValue(mCurrentProfile.getSanitizedEmail());
                  } else {
                  }
                  return Transaction.success(
                      currentData); // we can also abort by calling Transaction.abort()
                }

                @Override
                public void onComplete(
                    FirebaseError firebaseError, boolean committed, DataSnapshot currentData) {
                  // This method will be called once with the results of the transaction.
                }
              });
    }

    // Ajouter un event listener pour s'il y a changement aux membres prêts pour ce groupe
    myFirebaseGroupRef.addValueEventListener(
        mValueEventListener =
            new ValueEventListener() {
              // TODO: Opter plutot pour onChildAdded et onChildChanged pour éviter d'avoir à
              // réécrire la liste complète à chaque fois?
              @Override
              public void onDataChange(DataSnapshot snapshot) {
                // Ajouter un listener pour savoir si l'admin a décidé de passer au vote.
                if (snapshot.hasChild("readyState")) {
                  // On vérifie si notre valeur a été mis à true
                  if (((Boolean)
                          snapshot
                              .child("members/" + mCurrentProfile.getSanitizedEmail())
                              .getValue())
                      .equals(Boolean.TRUE)) {
                    startVoteMapActivity();
                  } else if ((boolean) snapshot.child("readyState").getValue() == true) {
                    // Move to next activity
                    Toast.makeText(
                            WaitingRoomActivity.this,
                            "Le vote est déjà commencé pour ce groupe.",
                            Toast.LENGTH_LONG)
                        .show();
                  }
                }

                if (snapshot.hasChild("members")) {
                  mArrayList.clear();
                  /*for (DataSnapshot prop : snapshot.child("members").getChildren()) {
                      if (prop.getKey() == "latitude")
                          mCurrentProfile.meetingLatitude += (Double) prop.getValue();//true+true?
                      if (prop.getKey() == "longitude")
                          mCurrentProfile.meetingLongitude += (Double) prop.getValue();
                  }*/
                  mArrayList.addAll(
                      ((Map<String, Object>) snapshot.child("members").getValue()).keySet());
                  mArrayAdapter.notifyDataSetChanged();
                }

                // Si la BD dit qu'on est admin, afficher le bouton
                if (snapshot.hasChild("organizer")) {
                  if (snapshot
                      .child("organizer")
                      .getValue()
                      .toString()
                      .equals(mCurrentProfile.getSanitizedEmail())) {
                    mAdminStartButton.setVisibility(View.VISIBLE);
                    // remettre la valeur à true si la BD la confirmé
                    mCurrentProfile.organizer = true;
                    ((TextView) findViewById(R.id.organizerTextView))
                        .setText(snapshot.child("organizer").getValue().toString());
                  }
                }
              }

              @Override
              public void onCancelled(FirebaseError firebaseError) {
                System.out.println("The read failed: " + firebaseError.getMessage());
              }
            });

    // Ajouter un event listener pour le bouton pour l'admin
    mAdminStartButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            // Marquer, dans la BD, que le groupe est prêt pour passer au vote
            // Trigger l'événement chez tous les clients.
            myFirebaseGroupRef.child("readyState").setValue(true);
            for (String user : mArrayList) {
              myFirebaseGroupRef.child("members").child(user).setValue(true);
            }

            myFirebaseGroupRef.child("VotesDate").child("votes1").setValue(0);
            myFirebaseGroupRef.child("VotesDate").child("votes2").setValue(0);
            myFirebaseGroupRef.child("VotesDate").child("votes3").setValue(0);
            myFirebaseGroupRef.child("VotesMap").child("votes1").setValue(0);
            myFirebaseGroupRef.child("VotesMap").child("votes2").setValue(0);
            myFirebaseGroupRef.child("VotesMap").child("votes3").setValue(0);
          }
        });
  }