{"action":"created","issue":{"url":"https://api.github.com/repos/ManageIQ/manageiq/issues/3336","labels_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/3336/labels{/name}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/3336/comments","events_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/3336/events","html_url":"https://github.com/ManageIQ/manageiq/pull/3336","id":92384402,"number":3336,"title":"link url to tenant_object","user":{"login":"kbrock","id":1930,"avatar_url":"https://avatars.githubusercontent.com/u/1930?v=3","gravatar_id":"","url":"https://api.github.com/users/kbrock","html_url":"https://github.com/kbrock","followers_url":"https://api.github.com/users/kbrock/followers","following_url":"https://api.github.com/users/kbrock/following{/other_user}","gists_url":"https://api.github.com/users/kbrock/gists{/gist_id}","starred_url":"https://api.github.com/users/kbrock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kbrock/subscriptions","organizations_url":"https://api.github.com/users/kbrock/orgs","repos_url":"https://api.github.com/users/kbrock/repos","events_url":"https://api.github.com/users/kbrock/events{/privacy}","received_events_url":"https://api.github.com/users/kbrock/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ManageIQ/manageiq/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/ManageIQ/manageiq/labels/gem%20changes","name":"gem changes","color":"6A92BC"},{"url":"https://api.github.com/repos/ManageIQ/manageiq/labels/tenancy","name":"tenancy","color":"5319e7"}],"state":"open","locked":false,"assignee":{"login":"kbrock","id":1930,"avatar_url":"https://avatars.githubusercontent.com/u/1930?v=3","gravatar_id":"","url":"https://api.github.com/users/kbrock","html_url":"https://github.com/kbrock","followers_url":"https://api.github.com/users/kbrock/followers","following_url":"https://api.github.com/users/kbrock/following{/other_user}","gists_url":"https://api.github.com/users/kbrock/gists{/gist_id}","starred_url":"https://api.github.com/users/kbrock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kbrock/subscriptions","organizations_url":"https://api.github.com/users/kbrock/orgs","repos_url":"https://api.github.com/users/kbrock/repos","events_url":"https://api.github.com/users/kbrock/events{/privacy}","received_events_url":"https://api.github.com/users/kbrock/received_events","type":"User","site_admin":false},"milestone":null,"comments":9,"created_at":"2015-07-01T13:24:49Z","updated_at":"2015-07-10T21:54:52Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ManageIQ/manageiq/pulls/3336","html_url":"https://github.com/ManageIQ/manageiq/pull/3336","diff_url":"https://github.com/ManageIQ/manageiq/pull/3336.diff","patch_url":"https://github.com/ManageIQ/manageiq/pull/3336.patch"},"body":"**NOTE:** Though this PR is ready to merge, it is blocked on conversations. Do not merge w/o approval from @Fryguy and @chessbyte \r\n\r\nThis maps the url to the current tenant.\r\n\r\n`acts_as_tenant` determines the tenant by the [domain or subdomain] of the url and sets a global `tenant` variable.\r\n\r\nThe [current_tenant] helper method gives controllers, views, and models access to the current tenant to implement filtering how ever we see fit.\r\n\r\n\r\n/cc @gmcculloug @Fryguy \r\n\r\n---\r\n\r\nThis PR is only interested in the url to tenant mapping, but I know there are a bunch of questions around the `acts_as_tenant` gem in general. I'll include a few more details about that gem, but if possible, I'd like to focus on the url mapping and move the conversation about our walls and sharing mechanism to when we actually implement it. This current PR does not limit models in any way.\r\n\r\nOut of the box, `act_as_tenant` does provide the ability to set hard walls based upon the current tenant by adding a [default query] to filter queries by tenant. It also [sets the tenant_id] in models when they are created. In the short term we may want to leverage this until we nail down actual requirements.\r\n\r\nOf note, there are other plugins that have different sharing policy. [acts_as_loose_tenant] has a model associated with many tenants. Take away: we can implement what ever sharing mechanism we see fit and are not limited to `acts_as_tenant`'s default implementation.\r\n\r\n---\r\nupdate: added acts_as_tenant description in response to @Fryguy \r\nupdate: added `default_scope` in response to @matthewd \r\nupdate: pulled out tenant_object into separate PR\r\nupdate: rewrote acts_as_tenant description with links to actual plugin source code.\r\n\r\n[here]: https://github.com/rpearce/acts_as_loose_tenant/blob/master/lib/acts_as_loose_tenant.rb\r\n[domain or subdomain]: https://github.com/ErwinM/acts_as_tenant/blob/master/lib/acts_as_tenant/controller_extensions.rb#L48\r\n[current_tenant]: https://github.com/ErwinM/acts_as_tenant/blob/master/lib/acts_as_tenant/controller_extensions.rb#L51-L53\r\n[default query]: https://github.com/ErwinM/acts_as_tenant/blob/master/lib/acts_as_tenant/model_extensions.rb#L56-L65\r\n[acts_as_loose_tenant]: https://github.com/rpearce/acts_as_loose_tenant/blob/master/lib/acts_as_loose_tenant.rb#L22-L24\r\n[sets the tenant_id]: https://github.com/ErwinM/acts_as_tenant/blob/master/lib/acts_as_tenant/model_extensions.rb#L71-L75"},"comment":{"url":"https://api.github.com/repos/ManageIQ/manageiq/issues/comments/120537981","html_url":"https://github.com/ManageIQ/manageiq/pull/3336#issuecomment-120537981","issue_url":"https://api.github.com/repos/ManageIQ/manageiq/issues/3336","id":120537981,"user":{"login":"miq-bot","id":7806257,"avatar_url":"https://avatars.githubusercontent.com/u/7806257?v=3","gravatar_id":"","url":"https://api.github.com/users/miq-bot","html_url":"https://github.com/miq-bot","followers_url":"https://api.github.com/users/miq-bot/followers","following_url":"https://api.github.com/users/miq-bot/following{/other_user}","gists_url":"https://api.github.com/users/miq-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/miq-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miq-bot/subscriptions","organizations_url":"https://api.github.com/users/miq-bot/orgs","repos_url":"https://api.github.com/users/miq-bot/repos","events_url":"https://api.github.com/users/miq-bot/events{/privacy}","received_events_url":"https://api.github.com/users/miq-bot/received_events","type":"User","site_admin":false},"created_at":"2015-07-10T21:54:52Z","updated_at":"2015-07-10T21:54:52Z","body":"<gemfile_checker />@JPrause @jvlcek Gemfile changes detected in commit https://github.com/kbrock/manageiq/commit/b7d94598de0b1bc5d992b33d52644fb69eb45a93.  Please review."}}