question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Are there any examples of using Emberfire with a multi-tenant application?

I’ve trying adjusting https://www.firebase.com/docs/web/guide/understanding-security.html#section-authorization and am not clear how this fits in to the emberfire portion of reading/writing data. Do I have to adjust the path of each type? If so, how does it authenticate and know it really is the user?

I have this rule setup:

    "clients": {
      "$user_id": {
        ".read": "(auth != null) && ($user_id === auth.uid)",
        ".write": "(auth != null) && ($user_id === auth.uid)"
      }
    }

And when I go to write a new record, I’m getting http://cl.ly/image/032f2Y0B2F0l.

Does the path need to be different to hit that security rule? If so, is there an example of that somewhere?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
tstirratcommented, May 6, 2015

For security, you can nest the rules further down under a tenant variable, that way you can use the tenant variable to check for membership:

{
  "rules": {

     "$tenant_id": {
       "users": {
         "$post_id": {

          // readable by any user who is part of the same tenant
          ".read": "root.child($tenant_id).child('users').child(auth.uid).exists()",

          // writable by original author only
          ".write": "data.child('author').val() === auth.uid"

        },
      }
    }

  }
}

I’ll need more info on the other issue. How and when did you replace the adapter._ref? Did it write the data to the root of the firebase store? or did it correctly namespace the data? What code are you using to query?

Check that the code works without namespacing first

0reactions
tstirratcommented, May 13, 2015

Hey, no problem. I’m glad its sorted out 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is multitenancy? | Multitenant architecture - Cloudflare
Multitenancy is when several different cloud customers are accessing the same computing resources, such as when several different companies are storing data ...
Read more >
Multitenancy - Wikipedia
Software multitenancy is a software architecture in which a single instance of software runs on a server and serves multiple tenants.
Read more >
What is multitenancy? - Red Hat
Multitenancy is a software architecture where a single software instance can serve multiple, distinct user groups.
Read more >
Definition of Multitenancy - IT Glossary - Gartner
Multitenancy is a reference to the mode of operation of software where multiple independent instances of one or multiple applications operate in a...
Read more >
What is multi-tenancy? | Definition from TechTarget
Multi-tenancy is an architecture in which a single instance of a software application serves multiple customers. Each customer is called a tenant.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found