Modify Firebase security rules from Android

0

Hi, I'm trying to make an app in which an administrator grants privileges to certain users. To do this, users register in FireBase and the Firebase security rules grant whether or not they can access certain nodes. The problem is that I do not know how to modify these rules from Android. If anyone knows what else I could do but always using FireBase to tell me. Thanks!

    
asked by JaviDonisio2 05.03.2017 в 19:58
source

3 answers

0

The rules could be nothing more than a set of "permissions" within each user. That way the admin can modify those permissions and within the rules of the BD you can check that a certain user has a child X in the permission node.

    
answered by 30.05.2017 в 18:12
0

You should not do it like that, for that you should do it from the page, but what you can do is that if you want a particular user to read some type of data you can check a value within the database and if there is to do that the user read it, for example in rules in the reading part you would put a reference

".read" : "root.child('groups').child($groupID).child(auth.userid).exists()"

then this checks that the authenticated user checks for the value within the child groups, if this value exists, then the user can read it, otherwise, if the value is not found, it will not be able to read it.

I hope you serve

    
answered by 31.12.2017 в 16:42
0

enter the description of the image here

Hi, I have a similar problem but when I add the rule it says permission denied.

{"rules":{
    "Actividades": {
        ".read" : "data.child('Autor').val() == auth.uid",
            ".write" : "auth != null"        
        }
    }
}
    
answered by 10.10.2018 в 18:55