Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. exports.blockUser = functions.https.onCall(async(data, context) => {
  2.  
  3. const user = await admin.auth().getUserByEmail(data['email']);
  4.  
  5. if(context.auth.token.admin){
  6. admin.auth().setCustomUserClaims(user.uid, {
  7. block: true
  8. });
  9. console.log(data['email'] + " has been blocked");
  10. return 1;
  11. }else{
  12.  
  13. return 2;
  14.  
  15. }});
  16.  
  17. allow read: if request.auth.token.block == null;
  18.  
  19. allow read: if request.auth.token.block == true;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement