daily pastebin goal
45%
SHARE
TWEET

Untitled

a guest Mar 20th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top