Guest User

Untitled

a guest
Dec 12th, 2017
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. public boolean grantModeratorRole(String uid) throws Exception {
  2. FirebaseAuth auth = FirebaseAuth.getInstance();
  3. UserRecord user = auth.getUserAsync(uid).get();
  4. if (user.isEmailVerified()) {
  5. Map<String, Object> claims = new HashMap<>();
  6. claims.put("role", "moderator");
  7. claims.put("level", 5);
  8. auth.setCustomUserClaimsAsync(uid, claims).get();
  9. return true;
  10. }
  11. return false;
  12. }
Add Comment
Please, Sign In to add comment