enju_search_log 0.1.0.pre3 → 0.1.0.pre4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/app/models/enju_search_log/ability.rb +22 -0
- data/lib/enju_search_log/user.rb +1 -1
- data/lib/enju_search_log/version.rb +1 -1
- data/spec/dummy/app/models/ability.rb +18 -16
- data/spec/dummy/app/models/user.rb +1 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- metadata +17 -31
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b0b2ad52ff905b45cbc5af81bc7d604756034c7d
|
4
|
+
data.tar.gz: 26785e9bc6aed126f5e963cc12885750311cdc3c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 525dc5d61403bbc97b77034b0ad363cafff1d952d927ec5c798d83a5fb64ffa1b69c3025d5e7d968c0ec88f26235b10b2e38a598a77e8b8c82361c99788e2840
|
7
|
+
data.tar.gz: 287045301c3386fbb196a62e8b3ae92ccadc7e114ecd5707212ef39f4e03d55ec9ef94ed2b558295f2178df20c3e3473bc722eadcc1b61990caa12c3f4c75a5e
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module EnjuSearchLog
|
2
|
+
class Ability
|
3
|
+
include CanCan::Ability
|
4
|
+
|
5
|
+
def initialize(user, ip_address = nil)
|
6
|
+
case user.try(:role).try(:name)
|
7
|
+
when 'Administrator'
|
8
|
+
can :manage, SearchHistory
|
9
|
+
when 'Librarian'
|
10
|
+
can :index, SearchHistory
|
11
|
+
can [:show, :destroy], SearchHistory do |search_history|
|
12
|
+
search_history.user == user
|
13
|
+
end
|
14
|
+
when 'User'
|
15
|
+
can :index, SearchHistory
|
16
|
+
can [:show, :destroy], SearchHistory do |search_history|
|
17
|
+
search_history.user == user
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/enju_search_log/user.rb
CHANGED
@@ -1,20 +1,22 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
#module EnjuSearchLog
|
2
|
+
class Ability
|
3
|
+
include CanCan::Ability
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
5
|
+
def initialize(user, ip_address = nil)
|
6
|
+
case user.try(:role).try(:name)
|
7
|
+
when 'Administrator'
|
8
|
+
can :manage, SearchHistory
|
9
|
+
when 'Librarian'
|
10
|
+
can :index, SearchHistory
|
11
|
+
can [:show, :destroy], SearchHistory do |search_history|
|
12
|
+
search_history.user == user
|
13
|
+
end
|
14
|
+
when 'User'
|
15
|
+
can :index, SearchHistory
|
16
|
+
can [:show, :destroy], SearchHistory do |search_history|
|
17
|
+
search_history.user == user
|
18
|
+
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
20
|
-
end
|
22
|
+
#end
|
@@ -11,7 +11,7 @@ class User < ActiveRecord::Base
|
|
11
11
|
has_one :role, :through => :user_has_role
|
12
12
|
belongs_to :required_role, :class_name => 'Role', :foreign_key => 'required_role_id'
|
13
13
|
|
14
|
-
|
14
|
+
enju_search_log_user_model
|
15
15
|
|
16
16
|
def has_role?(role_in_question)
|
17
17
|
return false unless role
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enju_search_log
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
5
|
-
prerelease: 6
|
4
|
+
version: 0.1.0.pre4
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Kosuke Tanabe
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-03-13 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rails
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,65 +27,57 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: enju_biblio
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
37
|
-
version: 0.1.0.
|
33
|
+
version: 0.1.0.pre23
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
45
|
-
version: 0.1.0.
|
40
|
+
version: 0.1.0.pre23
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: sqlite3
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rspec-rails
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: factory_girl_rails
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
description: Search log management for Next-L Enju
|
@@ -100,6 +89,7 @@ extra_rdoc_files: []
|
|
100
89
|
files:
|
101
90
|
- app/controllers/search_histories_controller.rb
|
102
91
|
- app/helpers/search_histories_helper.rb
|
92
|
+
- app/models/enju_search_log/ability.rb
|
103
93
|
- app/models/search_history.rb
|
104
94
|
- app/views/search_histories/edit.html.erb
|
105
95
|
- app/views/search_histories/index.html.erb
|
@@ -174,32 +164,28 @@ files:
|
|
174
164
|
- spec/spec_helper.rb
|
175
165
|
- spec/support/controller_macros.rb
|
176
166
|
- spec/support/devise.rb
|
177
|
-
homepage: https://github.com/
|
167
|
+
homepage: https://github.com/next-l/enju_search_log
|
178
168
|
licenses: []
|
169
|
+
metadata: {}
|
179
170
|
post_install_message:
|
180
171
|
rdoc_options: []
|
181
172
|
require_paths:
|
182
173
|
- lib
|
183
174
|
required_ruby_version: !ruby/object:Gem::Requirement
|
184
|
-
none: false
|
185
175
|
requirements:
|
186
|
-
- -
|
176
|
+
- - '>='
|
187
177
|
- !ruby/object:Gem::Version
|
188
178
|
version: '0'
|
189
|
-
segments:
|
190
|
-
- 0
|
191
|
-
hash: 3288372946987883857
|
192
179
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
|
-
none: false
|
194
180
|
requirements:
|
195
|
-
- -
|
181
|
+
- - '>'
|
196
182
|
- !ruby/object:Gem::Version
|
197
183
|
version: 1.3.1
|
198
184
|
requirements: []
|
199
185
|
rubyforge_project:
|
200
|
-
rubygems_version:
|
186
|
+
rubygems_version: 2.0.0
|
201
187
|
signing_key:
|
202
|
-
specification_version:
|
188
|
+
specification_version: 4
|
203
189
|
summary: enju_search_log plugin
|
204
190
|
test_files:
|
205
191
|
- spec/controllers/search_histories_controller_spec.rb
|