1

I want to keep my specific rules regarding the users and players, but I want a suprior rule that we allow an admin user to write without limitation, it should be as "OR" , meaning either you're an admin or the rules below. (Without starting to edit every table below)

  "rules": {   
      "scores": {
          "$sid": {
                ".read": true,
                ".write": "root.child('game').child($sid).child(auth.uid).exists()&& 
                auth!=null"
              }
            },...
SHAI
  • 789
  • 3
  • 10
  • 43

1 Answers1

2

You can add a rule at a higher level for admin users, for example if you recognize an admin by their UID, you can do:

{
  "rules": { 
    ".write": "auth.uid === 'theuidofheadmin'",
    "scores": {
      "$sid": {
        ".read": true,
        ".write": "root.child('game').child($sid).child(auth.uid).exists()&& 
                  auth!=null"
      }
    },...

So now the admin has write permissions on anything under the root, and you can't take those away anymore, but anyone else still needs to meet the requirements for each specific node.

Also see:

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807