authentication-zero 2.16.33 → 2.16.35
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c7d60c02b34ef5a758e474ff9c232390714ef5ad51150caad56162b97f40011
|
4
|
+
data.tar.gz: b694f2271ad4fe2674e804f7c03076ce76ebee3ab69c06e900677524b3d576b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 206d5ce3e2fd996040b3e446ca7e32ccdfaf5bc94a430ec9ae177b1398bfbaeaca5ad60bdbf3158895668cdb1bb7f1cb3accfc6c88c5a2f04d2bde0aa96cc054
|
7
|
+
data.tar.gz: 03c6c97e0793685cdc45b49783224ece1833af84cf7de6b8d40640efe5530c8d6cf26542661c4ca4b30d455a60e56b65d8f5bc5250c43f52574d2d3d24a58f97
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -66,15 +66,18 @@ Use `before_action :require_sudo` in controllers with sensitive information, it
|
|
66
66
|
|
67
67
|
### Tenantable
|
68
68
|
|
69
|
-
Some artifacts are generated in the application, which makes it possible to implement row-level multitenancy applications.
|
69
|
+
Some artifacts are generated in the application, which makes it possible to implement row-level multitenancy applications. The `Current.account` is set using the current user account.
|
70
70
|
|
71
|
-
|
71
|
+
You should follow some steps to make it work:
|
72
|
+
|
73
|
+
- Add `account_id` to each scoped table. ex: `rails g migration add_account_to_projects account:references`.
|
72
74
|
- Add `include AccountScoped` to scoped models. It set up the account relationship and default scope using the current account.
|
73
75
|
|
74
|
-
|
76
|
+
Set `Current.account` through the URL. `http://myapp.com/:account_id`. (optional)
|
75
77
|
|
76
78
|
- Add `require_relative "../lib/account_middleware"` to `config/application.rb`.
|
77
79
|
- Add `config.middleware.use AccountMiddleware` to your application class.
|
80
|
+
- More customization is required...
|
78
81
|
|
79
82
|
## Development
|
80
83
|
|
@@ -8,7 +8,7 @@ class AccountMiddleware
|
|
8
8
|
|
9
9
|
_, account_id, request_path = request.path.split("/", 3)
|
10
10
|
|
11
|
-
if
|
11
|
+
if account_id !~ /\D/
|
12
12
|
set_current_account(account_id)
|
13
13
|
|
14
14
|
request.script_name = "/#{account_id}"
|
@@ -20,11 +20,7 @@ class AccountMiddleware
|
|
20
20
|
end
|
21
21
|
|
22
22
|
private
|
23
|
-
def identifier?(value)
|
24
|
-
Integer(value, exception: false) != nil
|
25
|
-
end
|
26
|
-
|
27
23
|
def set_current_account(account_id)
|
28
|
-
Current.account = Account.
|
24
|
+
Current.account = Account.find(account_id)
|
29
25
|
end
|
30
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authentication-zero
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.16.
|
4
|
+
version: 2.16.35
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nixon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06
|
11
|
+
date: 2023-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|