the_role_api 3.0.3 → 3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -8
- data/app/controllers/concerns/the_role/controller.rb +6 -1
- data/app/models/concerns/the_role/api/role.rb +2 -1
- data/app/models/concerns/the_role/api/user.rb +3 -0
- data/config/locales/zh_CN.the_role.yml +10 -1
- data/gem_version.rb +1 -1
- data/lib/the_role_api.rb +1 -7
- data/the_role_api.gemspec +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a844d9bf293e91485ac8d799c3290c7d0bb2632
|
4
|
+
data.tar.gz: 089fa53faea125dfea6ffe8beb4d6643cb57c09b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d3d457ce0c1978db76cc1d7204a7ba65e148d1f6ee896da9a0f1209a4addb94fd98826f9685d88b70c4721a6b8f5afbb9785f8f1ef959e3c9ce5c33669c3035
|
7
|
+
data.tar.gz: 54d290cd963068817beedc68097786cbaca2fc2d0509655425dfe75bd682be3077ff20b9389a3cb1db2e5887ef21d71cac4cebfe3a08cdc56140192c253adee4
|
data/README.md
CHANGED
@@ -16,14 +16,11 @@
|
|
16
16
|
</p>
|
17
17
|
|
18
18
|
<div align="center" class='center' style="text-align:center">
|
19
|
-
|
20
|
-
<a href="http://badge.fury.io/rb/
|
21
|
-
|
22
|
-
<a href="https://travis-ci.org/TheRole/DummyApp"><img src="https://travis-ci.org/TheRole/DummyApp.svg?branch=master" alt="Build Status" height="18"></a>
|
23
|
-
 
|
24
|
-
<a href="https://codeclimate.com/github/TheRole/TheRoleApi"><img src="https://codeclimate.com/github/TheRole/TheRoleApi/badges/gpa.svg" /></a>
|
25
|
-
|
26
|
-
<a href="https://www.ruby-toolbox.com/categories/rails_authorization">ruby-toolbox</a>
|
19
|
+
TheRole: <a href="http://badge.fury.io/rb/the_role"><img src="https://badge.fury.io/rb/the_role.svg" alt="Gem Version" height="18"></a>
|
20
|
+
API: <a href="http://badge.fury.io/rb/the_role_api"><img src="https://badge.fury.io/rb/the_role_api.svg" alt="Gem Version" height="18"></a>
|
21
|
+
GUI: <a href="http://badge.fury.io/rb/the_role_management_panel"><img src="https://badge.fury.io/rb/the_role_management_panel.svg" alt="Gem Version" height="18"></a>
|
22
|
+
CI: <a href="https://travis-ci.org/TheRole/DummyApp"><img src="https://travis-ci.org/TheRole/DummyApp.svg?branch=master" alt="Build Status" height="18"></a>
|
23
|
+
<a href="https://www.ruby-toolbox.com/categories/rails_authorization">ruby-toolbox</a>
|
27
24
|
</div>
|
28
25
|
|
29
26
|
<hr>
|
@@ -46,7 +46,12 @@ module TheRole
|
|
46
46
|
has_access_to_object: current_user.try(:owner?, @owner_check_object)
|
47
47
|
}, status: 401
|
48
48
|
else
|
49
|
-
|
49
|
+
# When the user paste non authorized URL in browser the REFERER is blank and application crash
|
50
|
+
if request.env["HTTP_REFERER"].present? and request.env["HTTP_REFERER"] != request.env["REQUEST_URI"]
|
51
|
+
redirect_to :back, flash: { error: access_denied_msg }
|
52
|
+
else
|
53
|
+
redirect_to root_path, flash: { error: access_denied_msg }
|
54
|
+
end
|
50
55
|
end
|
51
56
|
end
|
52
57
|
end
|
@@ -27,6 +27,7 @@ module TheRole
|
|
27
27
|
def to_json
|
28
28
|
the_role
|
29
29
|
end
|
30
|
+
|
30
31
|
# ~ HELPERS
|
31
32
|
|
32
33
|
alias_method :has?, :has_role?
|
@@ -55,7 +56,7 @@ module TheRole
|
|
55
56
|
end
|
56
57
|
|
57
58
|
after_create do
|
58
|
-
|
59
|
+
if based_on_role.present?
|
59
60
|
if base_role = self.class.where(id: based_on_role).first
|
60
61
|
update_role base_role.to_hash
|
61
62
|
end
|
@@ -6,11 +6,14 @@ module TheRole
|
|
6
6
|
include TheRole::Api::BaseMethods
|
7
7
|
|
8
8
|
# HELPERS
|
9
|
+
|
9
10
|
# version for `User` model
|
10
11
|
def role_hash
|
11
12
|
@role_hash ||= role.try(:to_hash) || {}
|
12
13
|
end
|
13
14
|
|
15
|
+
# ~ HELPERS
|
16
|
+
|
14
17
|
included do
|
15
18
|
belongs_to :role
|
16
19
|
before_validation :set_default_role, on: :create
|
data/gem_version.rb
CHANGED
data/lib/the_role_api.rb
CHANGED
@@ -30,17 +30,11 @@ module TheRole
|
|
30
30
|
%w[ base_methods role user ].each do |file|
|
31
31
|
require_dependency "#{ app }/models/concerns/the_role/api/#{ file }.rb"
|
32
32
|
end
|
33
|
-
|
34
|
-
|
35
|
-
if Rails::VERSION::MAJOR == 4
|
33
|
+
else
|
36
34
|
config.autoload_paths << "#{ config.root }/app/models/concerns/**"
|
37
35
|
config.autoload_paths << "#{ config.root }/app/controllers/concerns/**"
|
38
36
|
end
|
39
37
|
|
40
|
-
if Rails::VERSION::MAJOR == 5
|
41
|
-
raise Exception.new("TheRole 3. Version for Rails 5 not tested yet")
|
42
|
-
end
|
43
|
-
|
44
38
|
initializer "the_role_precompile_hook", group: :all do |app|
|
45
39
|
app.config.assets.precompile += %w(
|
46
40
|
the_role_management_panel.js
|
data/the_role_api.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: the_role_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: '3.5'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya N. Zykin [the-teacher]
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -47,7 +47,7 @@ dependencies:
|
|
47
47
|
version: '3.2'
|
48
48
|
- - "<"
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: '
|
50
|
+
version: '6'
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -57,7 +57,7 @@ dependencies:
|
|
57
57
|
version: '3.2'
|
58
58
|
- - "<"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
60
|
+
version: '6'
|
61
61
|
description: Authorization for Rails with Web Interface
|
62
62
|
email:
|
63
63
|
- zykin-ilya@ya.ru
|
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
version: '0'
|
116
116
|
requirements: []
|
117
117
|
rubyforge_project:
|
118
|
-
rubygems_version: 2.
|
118
|
+
rubygems_version: 2.5.0
|
119
119
|
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: Authorization for Rails
|