Last active
December 10, 2017 23:18
-
-
Save hiranya911/aa5a0bdee5bc9ba1bdee11ca97dd98fa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment