0

We allow users to store data on firebase. Our app is subscription based, so if subscription expires, we delete all firebase database and storage using Cloud Function as admin after sometime. The problem we are facing is that, we are getting all deleted events which is admin deleted. We want either “to stop delete events if deleted by admin but get delete events if deleted by users” or “detect if it is admin deleted”. Is there any way to do so?

Edited :

We want to observe and check whether data deleted by admin or user in swift i.e on iOS device.

We are observing delete event in swift like this:

“Database_Path”.observe(DataEventType.childRemoved, with: { (snap : DataSnapshot) in `Identify here: if its deleted by admin or user and perform action based on it`})
user3519594
  • 387
  • 1
  • 11
  • Yes, while undocumented, this information is available to your function code See https://stackoverflow.com/questions/42750060/getting-the-user-id-from-a-database-trigger-in-cloud-functions-for-firebase – Frank van Puffelen Dec 07 '17 at 15:39
  • Have edited the question. – user3519594 Dec 11 '17 at 07:10
  • The information of who triggered a delete from the realtime database is **only** available in Cloud Functions. It is **not** automatically passed back to your iOS application. If you eed the information in your app, you will need to pass the information in some way, e.g. by explicitly writing who deletes a node into the database. – Frank van Puffelen Dec 11 '17 at 15:12

0 Answers0