adeia 0.11.3 → 0.11.4
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 +4 -4
- data/README.md +10 -3
- data/lib/adeia/controller_methods.rb +2 -2
- data/lib/adeia/controller_resource.rb +1 -1
- data/lib/adeia/engine.rb +4 -9
- data/lib/adeia/guest_user.rb +17 -0
- data/lib/adeia/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81d2d0a434685e7b16bff8d0803c04baa84da393
|
4
|
+
data.tar.gz: a5067a6f38c733b0dfa7462a23765f43358fa598
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aff98a001374ef10190b2a0aea55691838137facab69d94b9408f59db39d48c6030640a85a6e70b26343844d915fdfdc527e1c85a57e4a6f5ff870c41d705c2f
|
7
|
+
data.tar.gz: 7e8c2cd42e38b26e2cf091bcda0ee0bc825fff4849ac5c185ccc17bc4173d82967bbe9ef9431f80736146c9016318e7b53d69bb9a9bc76f54815cb2f16e81691
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Adeia
|
2
2
|
|
3
|
-
An authorization gem for Rails that allows you to have the complete control of your app.
|
3
|
+
An discretionary authorization gem for Rails that allows you to have the complete control of your app.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -29,8 +29,15 @@ mount Adeia::Engine => "/adeia"
|
|
29
29
|
### Tasks
|
30
30
|
|
31
31
|
The first task to run is `rake adeia:permissions elements="first_element, second_element"`. It creates the given elements in the database and a superadmin group which has all the permissions.
|
32
|
-
Then you can run `adeia:superuser user_id=your_id`, which add the given user in the superadmin group.
|
33
|
-
If you need to add new groups, run `adeia:groups groups="first_group, second_group"`.
|
32
|
+
Then you can run `rake adeia:superuser user_id=your_id`, which add the given user in the superadmin group.
|
33
|
+
If you need to add new groups, run `rake adeia:groups groups="first_group, second_group"`.
|
34
|
+
|
35
|
+
For example:
|
36
|
+
|
37
|
+
```
|
38
|
+
rake adeia:permissions elements="admin/galleries, admin/articles, admin/categories"
|
39
|
+
rake adeia:superuser user_id=59
|
40
|
+
```
|
34
41
|
|
35
42
|
## Requirements
|
36
43
|
|
@@ -65,8 +65,8 @@ module Adeia
|
|
65
65
|
# - default path to redirect to
|
66
66
|
# * *Returns* :
|
67
67
|
#
|
68
|
-
def redirect_back_or(default,
|
69
|
-
redirect_to(cookies[:return_to] || default,
|
68
|
+
def redirect_back_or(default, **args)
|
69
|
+
redirect_to(cookies[:return_to] || default, **args)
|
70
70
|
cookies.delete(:return_to)
|
71
71
|
end
|
72
72
|
|
@@ -33,7 +33,7 @@ module Adeia
|
|
33
33
|
@token = args.fetch(:token, @controller.request.GET[:token])
|
34
34
|
@resource = args[:resource]
|
35
35
|
@user = @controller.current_user
|
36
|
-
@controller.current_user ||=
|
36
|
+
@controller.current_user ||= GuestUser.new # if not signed in but authorized
|
37
37
|
@controller.store_location
|
38
38
|
end
|
39
39
|
|
data/lib/adeia/engine.rb
CHANGED
@@ -19,21 +19,16 @@ module Adeia
|
|
19
19
|
initializer 'Adeia.requirements' do |app|
|
20
20
|
begin
|
21
21
|
User
|
22
|
+
require 'adeia/guest_user'
|
22
23
|
rescue NameError
|
23
24
|
raise MissingUserModel
|
24
25
|
end
|
25
26
|
end
|
26
27
|
|
27
|
-
|
28
|
-
User.send :include, Adeia::Helpers::UserHelper
|
29
|
-
end
|
30
|
-
|
31
|
-
initializer 'Adeia.controller_methods' do |app|
|
32
|
-
ActionController::Base.send :include, Adeia::ControllerMethods
|
33
|
-
end
|
34
|
-
|
35
|
-
initializer 'Adeia.sessions_helper' do |app|
|
28
|
+
config.to_prepare do
|
36
29
|
ActionController::Base.send :include, Adeia::Helpers::SessionsHelper
|
30
|
+
ActionController::Base.send :include, Adeia::ControllerMethods
|
31
|
+
User.send :include, Adeia::Helpers::UserHelper
|
37
32
|
end
|
38
33
|
|
39
34
|
end
|
data/lib/adeia/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adeia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- khcr
|
@@ -185,6 +185,7 @@ files:
|
|
185
185
|
- lib/adeia/database.rb
|
186
186
|
- lib/adeia/engine.rb
|
187
187
|
- lib/adeia/exceptions.rb
|
188
|
+
- lib/adeia/guest_user.rb
|
188
189
|
- lib/adeia/helpers/sessions_helper.rb
|
189
190
|
- lib/adeia/helpers/user_helper.rb
|
190
191
|
- lib/adeia/version.rb
|