Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean grantModeratorRole(String uid) throws Exception {
- FirebaseAuth auth = FirebaseAuth.getInstance();
- UserRecord user = auth.getUserAsync(uid).get();
- if (user.isEmailVerified()) {
- Map<String, Object> claims = new HashMap<>();
- claims.put("role", "moderator");
- claims.put("level", 5);
- auth.setCustomUserClaimsAsync(uid, claims).get();
- return true;
- }
- return false;
- }
Add Comment
Please, Sign In to add comment