authentication-zero 2.16.30 → 2.16.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d24c61ab47e57ff3f4e61f6871063cc0eddd0bae159bad0a6033c13b6d11d27
4
- data.tar.gz: 5603c75ec12c501b2e4de8165c79fa98011a1509ad9728911a71a2ea5f1ed823
3
+ metadata.gz: 8bff3de0a9b6c8fb09557b580d1f7bc3b9be99f71aadeb4e84d080be2ae022da
4
+ data.tar.gz: f014555758b4bc5d8c5c4f3b7a7eeb3aef9790ef5d0726b56d20ed59e7c2a32c
5
5
  SHA512:
6
- metadata.gz: ef99f6854ac55716a68f6439c14f33d9ad073c87374a2aa5434377d0fdefda107e6311692362c00e0ca9cb6a9b6b304f10a0ffd33b2373b27af0e3a1d32d8584
7
- data.tar.gz: d0d7a47777f70acb660bf9c8865967d6eda63147f764ab15abd3e0f41d119a31ed51553fe2ce132a56c7b3abf0221e82d7f22b4814d54214aae90db332fc71ea
6
+ metadata.gz: d48574ced8a36ac0e2ddb342176558b084f5bf892cf2cce8d8d96ee7183d59850bd170154c76cd6b1092a52bf6184b85353b592c9c395e5139a3536ac5e38468
7
+ data.tar.gz: 83079c90bdee50d97ffb2f9c89dad298491363568784792ca1012683ccca5f4f3203e0eb424a92f61c8c18ffc7783bc252f5c93338fa931fbefc2015682bc323
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- authentication-zero (2.16.30)
4
+ authentication-zero (2.16.31)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -68,13 +68,16 @@ Use `before_action :require_sudo` in controllers with sensitive information, it
68
68
 
69
69
  Some artifacts are generated in the application, which makes it possible to implement row-level multitenancy applications. You should follow some steps to make it work.
70
70
 
71
- - Add `account_id` to each scoped table, ex. `rails g migration projects account:references`.
72
- - Add `include AccountScoped` to scoped models. It set up the relationship with the account and default scope using the current account.
73
- - The `Current.account` is set according to the url ex: `http://mywebsite.com/1234/projects`.
74
- - You should customize the sign-in flow yourself, it means:
75
- - Add the `account_id` column and scope your user model.
76
- - Assign the account when the user is created.
77
- - After sign-in redirect to the correct url, including the `account_id`.
71
+ - Add `account_id` to each scoped table using `rails g migration add_account_to_projects account:references`
72
+ - Add `include AccountScoped` to scoped models. It set up the relationship with the account and default scope using the current account
73
+ - The `Current.account` is set according to the url ex: `http://mywebsite.com/1234/projects`
74
+ - You should customize the authentication flow yourself, it means:
75
+ - Add `account_id` to your users table using `rails g migration add_account_to_users account:references`
76
+ - Add `include AccountScoped` to your user model
77
+ - Use `Session.joins(:user).find_by_id` on `ApplicationController#authenticate`
78
+ - Use `redirect_to "/#{user.account_id}"` after sign-in.
79
+ - Override `Current#user=` to also set the account using `super; self.account = user.account`
80
+ - etc...
78
81
 
79
82
  ## Development
80
83
 
@@ -1,3 +1,3 @@
1
1
  module AuthenticationZero
2
- VERSION = "2.16.30"
2
+ VERSION = "2.16.31"
3
3
  end
@@ -2,10 +2,7 @@ module AccountScoped
2
2
  extend ActiveSupport::Concern
3
3
 
4
4
  included do
5
- belongs_to :account
6
-
7
- default_scope do
8
- where(account: Current.account || raise("You must set an account"))
9
- end
5
+ belongs_to :account
6
+ default_scope { where account: Current.account }
10
7
  end
11
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authentication-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.16.30
4
+ version: 2.16.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nixon