enju_seed 0.2.0.beta.3 → 0.2.0.beta.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/concerns/enju_seed/enju_user.rb +309 -0
- data/lib/enju_seed.rb +1 -0
- data/lib/enju_seed/engine.rb +2 -0
- data/lib/enju_seed/localized_name.rb +15 -0
- data/lib/enju_seed/version.rb +1 -1
- data/lib/tasks/enju_seed_tasks.rake +7 -0
- data/spec/controllers/profiles_controller_spec.rb +1 -5
- data/spec/dummy/app/helpers/application_helper.rb +0 -1
- data/spec/dummy/app/models/user.rb +1 -3
- data/spec/dummy/config/application.rb +1 -1
- data/spec/models/user_spec.rb +175 -0
- data/spec/views/my_accounts/show.html.erb_spec.rb +0 -2
- data/spec/views/profiles/show.html.erb_spec.rb +0 -7
- metadata +19 -45
- data/spec/dummy/config/initializers/enju_leaf.rb +0 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a96125489ac0d079b2bb9baa785cd6e91dee805e
|
4
|
+
data.tar.gz: 8c3751cdaade27f93111bc092d709d72a24ad870
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 897bcd1ae924752e683f7533b1754291a5b86e7a01ebe93264c8f6ee0c94a71a4a8569c0768536022a6dd0b6b1b5bd9d12c43827d4147fd9aea3635ee70c6389
|
7
|
+
data.tar.gz: b50b9b80357cdb12457299fe7756783a1546c6c13ec41f353557de80a5335a6944a838b6c8f35164a83f388769a919009d4e79abb145aedbadf0ceda4e11113f
|
@@ -0,0 +1,309 @@
|
|
1
|
+
module EnjuSeed
|
2
|
+
module EnjuUser
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
scope :administrators, -> { joins(:role).where('roles.name = ?', 'Administrator') }
|
7
|
+
scope :librarians, -> { joins(:role).where('roles.name = ? OR roles.name = ?', 'Administrator', 'Librarian') }
|
8
|
+
scope :suspended, -> { where('locked_at IS NOT NULL') }
|
9
|
+
has_one :profile
|
10
|
+
if defined?(EnjuBiblio)
|
11
|
+
has_many :import_requests
|
12
|
+
has_many :picture_files, as: :picture_attachable, dependent: :destroy
|
13
|
+
end
|
14
|
+
has_one :user_has_role, dependent: :destroy
|
15
|
+
has_one :role, through: :user_has_role
|
16
|
+
belongs_to :user_group
|
17
|
+
belongs_to :library
|
18
|
+
belongs_to :required_role, class_name: 'Role', foreign_key: 'required_role_id'
|
19
|
+
accepts_nested_attributes_for :user_has_role
|
20
|
+
|
21
|
+
validates :username, presence: true, uniqueness: true, format: {
|
22
|
+
with: /\A[0-9A-Za-z][0-9A-Za-z_\-]*[0-9A-Za-z]\z/
|
23
|
+
}
|
24
|
+
validates :email, format: Devise::email_regexp, allow_blank: true, uniqueness: true
|
25
|
+
validates_date :expired_at, allow_blank: true
|
26
|
+
|
27
|
+
with_options if: :password_required? do |v|
|
28
|
+
v.validates_presence_of :password
|
29
|
+
v.validates_confirmation_of :password
|
30
|
+
v.validates_length_of :password, allow_blank: true,
|
31
|
+
within: Devise::password_length
|
32
|
+
end
|
33
|
+
|
34
|
+
before_validation :set_lock_information
|
35
|
+
before_destroy :check_role_before_destroy
|
36
|
+
before_save :check_expiration
|
37
|
+
after_create :set_confirmation
|
38
|
+
|
39
|
+
extend FriendlyId
|
40
|
+
friendly_id :username
|
41
|
+
strip_attributes only: :username
|
42
|
+
strip_attributes only: :email, allow_empty: true
|
43
|
+
|
44
|
+
attr_accessor :password_not_verified,
|
45
|
+
:update_own_account, :auto_generated_password,
|
46
|
+
:locked, :current_password #, :agent_id
|
47
|
+
|
48
|
+
paginates_per 10
|
49
|
+
|
50
|
+
def send_devise_notification(notification, *args)
|
51
|
+
devise_mailer.send(notification, self, *args).deliver_later
|
52
|
+
end
|
53
|
+
|
54
|
+
# 有効期限切れのユーザを一括で使用不可にします。
|
55
|
+
def self.lock_expired_users
|
56
|
+
User.find_each do |user|
|
57
|
+
user.lock_access! if user.expired? and user.active_for_authentication?
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# ユーザの情報をエクスポートします。
|
62
|
+
# @param [Hash] options
|
63
|
+
def self.export(options = {format: :txt})
|
64
|
+
header = %w(
|
65
|
+
username
|
66
|
+
full_name
|
67
|
+
full_name_transcription
|
68
|
+
email
|
69
|
+
user_number
|
70
|
+
role
|
71
|
+
user_group
|
72
|
+
library
|
73
|
+
locale
|
74
|
+
locked
|
75
|
+
required_role
|
76
|
+
created_at
|
77
|
+
updated_at
|
78
|
+
expired_at
|
79
|
+
keyword_list
|
80
|
+
note
|
81
|
+
)
|
82
|
+
header += %w(
|
83
|
+
checkout_icalendar_token
|
84
|
+
save_checkout_history
|
85
|
+
) if defined? EnjuCirculation
|
86
|
+
header << "save_search_history" if defined? EnjuSearchLog
|
87
|
+
header << "share_bookmarks" if defined? EnjuBookmark
|
88
|
+
lines = []
|
89
|
+
User.find_each.map{|u|
|
90
|
+
line = []
|
91
|
+
line << u.username
|
92
|
+
line << u.try(:profile).try(:full_name)
|
93
|
+
line << u.try(:profile).try(:full_name_transcription)
|
94
|
+
line << u.email
|
95
|
+
line << u.try(:profile).try(:user_number)
|
96
|
+
line << u.role.try(:name)
|
97
|
+
line << u.try(:profile).try(:user_group).try(:name)
|
98
|
+
line << u.try(:profile).try(:library).try(:name)
|
99
|
+
line << u.try(:profile).try(:locale)
|
100
|
+
line << u.access_locked?
|
101
|
+
line << u.try(:profile).try(:required_role).try(:name)
|
102
|
+
line << u.created_at
|
103
|
+
line << u.updated_at
|
104
|
+
line << u.try(:profile).try(:expired_at)
|
105
|
+
line << u.try(:profile).try(:keyword_list).try(:split).try(:join, "//")
|
106
|
+
line << u.try(:profile).try(:note)
|
107
|
+
if defined? EnjuCirculation
|
108
|
+
line << u.try(:profile).try(:checkout_icalendar_token)
|
109
|
+
line << u.try(:profile).try(:save_checkout_history)
|
110
|
+
end
|
111
|
+
if defined? EnjuSearchLog
|
112
|
+
line << u.try(:profile).try(:save_search_history)
|
113
|
+
end
|
114
|
+
if defined? EnjuBookmark
|
115
|
+
line << u.try(:profile).try(:share_bookmarks)
|
116
|
+
end
|
117
|
+
lines << line
|
118
|
+
}
|
119
|
+
if options[:format] == :txt
|
120
|
+
lines.map{|line| line.to_csv(col_sep: "\t")}.unshift(header.to_csv(col_sep: "\t")).join
|
121
|
+
else
|
122
|
+
lines
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
# ユーザにパスワードが必要かどうかをチェックします。
|
128
|
+
# @return [Boolean]
|
129
|
+
def password_required?
|
130
|
+
if Devise.mappings[:user].modules.include?(:database_authenticatable)
|
131
|
+
!persisted? || !password.nil? || !password_confirmation.nil?
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
# ユーザが特定の権限を持っているかどうかをチェックします。
|
136
|
+
# @param [String] role_in_question 権限名
|
137
|
+
# @return [Boolean]
|
138
|
+
def has_role?(role_in_question)
|
139
|
+
return false unless role
|
140
|
+
return true if role.name == role_in_question
|
141
|
+
case role.name
|
142
|
+
when 'Administrator'
|
143
|
+
return true
|
144
|
+
when 'Librarian'
|
145
|
+
return true if role_in_question == 'User'
|
146
|
+
else
|
147
|
+
false
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
# ユーザに使用不可の設定を反映させます。
|
152
|
+
def set_lock_information
|
153
|
+
if locked == '1' and self.active_for_authentication?
|
154
|
+
lock_access!
|
155
|
+
elsif locked == '0' and !self.active_for_authentication?
|
156
|
+
unlock_access!
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
def set_confirmation
|
161
|
+
if respond_to?(:confirm!)
|
162
|
+
reload
|
163
|
+
confirm!
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
# ユーザが有効期限切れかどうかをチェックし、期限切れであれば使用不可に設定します。
|
168
|
+
# @return [Object]
|
169
|
+
def check_expiration
|
170
|
+
return if has_role?('Administrator')
|
171
|
+
if expired_at
|
172
|
+
if expired_at.beginning_of_day < Time.zone.now.beginning_of_day
|
173
|
+
lock_access! if active_for_authentication?
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
# ユーザの削除前に、管理者ユーザが不在にならないかどうかをチェックします。
|
179
|
+
# @return [Object]
|
180
|
+
def check_role_before_destroy
|
181
|
+
if has_role?('Administrator')
|
182
|
+
if Role.where(name: 'Administrator').first.users.count == 1
|
183
|
+
raise username + 'This is the last administrator in this system.'
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
# ユーザに自動生成されたパスワードを設定します。
|
189
|
+
# @return [String]
|
190
|
+
def set_auto_generated_password
|
191
|
+
password = Devise.friendly_token[0..7]
|
192
|
+
self.password = password
|
193
|
+
self.password_confirmation = password
|
194
|
+
end
|
195
|
+
|
196
|
+
# ユーザが有効期限切れかどうかをチェックします。
|
197
|
+
# @return [Boolean]
|
198
|
+
def expired?
|
199
|
+
if expired_at
|
200
|
+
true if expired_at.beginning_of_day < Time.zone.now.beginning_of_day
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
# ユーザが管理者かどうかをチェックします。
|
205
|
+
# @return [Boolean]
|
206
|
+
def is_admin?
|
207
|
+
return true if has_role?('Administrator')
|
208
|
+
false
|
209
|
+
end
|
210
|
+
|
211
|
+
# ユーザがシステム上の最後のLibrarian権限ユーザかどうかをチェックします。
|
212
|
+
# @return [Boolean]
|
213
|
+
def last_librarian?
|
214
|
+
if has_role?('Librarian')
|
215
|
+
role = Role.where(name: 'Librarian').first
|
216
|
+
return true if role.users.count == 1
|
217
|
+
false
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
def send_confirmation_instructions
|
222
|
+
Devise::Mailer.confirmation_instructions(self).deliver if email.present?
|
223
|
+
end
|
224
|
+
|
225
|
+
# ユーザが削除可能かどうかをチェックします。
|
226
|
+
# @param [User] current_user ユーザ
|
227
|
+
# @return [Object]
|
228
|
+
def deletable_by?(current_user)
|
229
|
+
return nil unless current_user
|
230
|
+
if defined?(EnjuCirculation)
|
231
|
+
# 未返却の資料のあるユーザを削除しようとした
|
232
|
+
if checkouts.count > 0
|
233
|
+
errors[:base] << I18n.t('user.this_user_has_checked_out_item')
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
if has_role?('Librarian')
|
238
|
+
# 管理者以外のユーザが図書館員を削除しようとした。図書館員の削除は管理者しかできない
|
239
|
+
unless current_user.has_role?('Administrator')
|
240
|
+
errors[:base] << I18n.t('user.only_administrator_can_destroy')
|
241
|
+
end
|
242
|
+
# 最後の図書館員を削除しようとした
|
243
|
+
if last_librarian?
|
244
|
+
errors[:base] << I18n.t('user.last_librarian')
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
# 最後の管理者を削除しようとした
|
249
|
+
if has_role?('Administrator')
|
250
|
+
if Role.where(name: 'Administrator').first.users.count == 1
|
251
|
+
errors[:base] << I18n.t('user.last_administrator')
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
if errors[:base] == []
|
256
|
+
true
|
257
|
+
else
|
258
|
+
false
|
259
|
+
end
|
260
|
+
end
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
|
265
|
+
# == Schema Information
|
266
|
+
#
|
267
|
+
# Table name: users
|
268
|
+
#
|
269
|
+
# id :integer not null, primary key
|
270
|
+
# email :string(255) default(""), not null
|
271
|
+
# encrypted_password :string(255) default(""), not null
|
272
|
+
# reset_password_token :string(255)
|
273
|
+
# reset_password_sent_at :datetime
|
274
|
+
# remember_created_at :datetime
|
275
|
+
# sign_in_count :integer default(0)
|
276
|
+
# current_sign_in_at :datetime
|
277
|
+
# last_sign_in_at :datetime
|
278
|
+
# current_sign_in_ip :string(255)
|
279
|
+
# last_sign_in_ip :string(255)
|
280
|
+
# password_salt :string(255)
|
281
|
+
# confirmation_token :string(255)
|
282
|
+
# confirmed_at :datetime
|
283
|
+
# confirmation_sent_at :datetime
|
284
|
+
# unconfirmed_email :string(255)
|
285
|
+
# failed_attempts :integer default(0)
|
286
|
+
# unlock_token :string(255)
|
287
|
+
# locked_at :datetime
|
288
|
+
# authentication_token :string(255)
|
289
|
+
# created_at :datetime not null
|
290
|
+
# updated_at :datetime not null
|
291
|
+
# deleted_at :datetime
|
292
|
+
# username :string(255) not null
|
293
|
+
# library_id :integer default(1), not null
|
294
|
+
# user_group_id :integer default(1), not null
|
295
|
+
# expired_at :datetime
|
296
|
+
# required_role_id :integer default(1), not null
|
297
|
+
# note :text
|
298
|
+
# keyword_list :text
|
299
|
+
# user_number :string(255)
|
300
|
+
# state :string(255)
|
301
|
+
# locale :string(255)
|
302
|
+
# enju_access_key :string(255)
|
303
|
+
# save_checkout_history :boolean
|
304
|
+
# checkout_icalendar_token :string(255)
|
305
|
+
# share_bookmarks :boolean
|
306
|
+
# save_search_history :boolean
|
307
|
+
# answer_feed_token :string(255)
|
308
|
+
#
|
309
|
+
|
data/lib/enju_seed.rb
CHANGED
data/lib/enju_seed/engine.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
module LocalizedName
|
2
|
+
def localize(locale = I18n.locale)
|
3
|
+
string = YAML.load(self)
|
4
|
+
if string.is_a?(Hash) and string[locale.to_s]
|
5
|
+
return string[locale.to_s]
|
6
|
+
end
|
7
|
+
self
|
8
|
+
rescue NoMethodError
|
9
|
+
self
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class String
|
14
|
+
include LocalizedName
|
15
|
+
end
|
data/lib/enju_seed/version.rb
CHANGED
@@ -2,3 +2,10 @@
|
|
2
2
|
# task :enju_seed do
|
3
3
|
# # Task goes here
|
4
4
|
# end
|
5
|
+
namespace :enju_seed do
|
6
|
+
desc "upgrade enju_seed"
|
7
|
+
task :upgrade => :environment do
|
8
|
+
Rake::Task['statesman:backfill_most_recent'].invoke('UserExportFile')
|
9
|
+
Rake::Task['statesman:backfill_most_recent'].invoke('UserImportFile')
|
10
|
+
end
|
11
|
+
end
|
@@ -196,17 +196,13 @@ describe ProfilesController do
|
|
196
196
|
response.should_not be_forbidden
|
197
197
|
assigns(:profile).should eq librarian
|
198
198
|
end
|
199
|
+
|
199
200
|
it "should get edit page for other librarian user" do
|
200
201
|
admin = FactoryGirl.create(:admin_profile, required_role_id: Role.where(name: 'Librarian').first.id)
|
201
202
|
get :edit, id: admin.id
|
202
203
|
response.should be_forbidden
|
203
204
|
assigns(:profile).should eq admin
|
204
205
|
end
|
205
|
-
|
206
|
-
it "should show icalendar feed" do
|
207
|
-
get :edit, id: profiles(:user1).id, mode: 'feed_token'
|
208
|
-
response.should render_template("profiles/_feed_token")
|
209
|
-
end
|
210
206
|
end
|
211
207
|
|
212
208
|
describe "When logged in as User" do
|
@@ -3,7 +3,5 @@ class User < ActiveRecord::Base
|
|
3
3
|
:recoverable, :rememberable, :trackable, #, :validatable
|
4
4
|
:lockable, :lock_strategy => :none, :unlock_strategy => :none
|
5
5
|
|
6
|
-
include
|
7
|
-
include EnjuCirculation::EnjuUser
|
8
|
-
include EnjuMessage::EnjuUser
|
6
|
+
include EnjuSeed::EnjuUser
|
9
7
|
end
|
@@ -0,0 +1,175 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require 'rails_helper'
|
3
|
+
|
4
|
+
describe User do
|
5
|
+
#pending "add some examples to (or delete) #{__FILE__}"
|
6
|
+
fixtures :all
|
7
|
+
|
8
|
+
it 'should create an user' do
|
9
|
+
FactoryGirl.create(:user)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should destroy an user' do
|
13
|
+
user = FactoryGirl.create(:user)
|
14
|
+
user.destroy.should be_truthy
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should respond to has_role(Administrator)' do
|
18
|
+
admin = FactoryGirl.create(:admin)
|
19
|
+
admin.has_role?('Administrator').should be_truthy
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should respond to has_role(Librarian)' do
|
23
|
+
librarian = FactoryGirl.create(:librarian)
|
24
|
+
librarian.has_role?('Administrator').should be_falsy
|
25
|
+
librarian.has_role?('Librarian').should be_truthy
|
26
|
+
librarian.has_role?('User').should be_truthy
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should respond to has_role(User)' do
|
30
|
+
user = FactoryGirl.create(:user)
|
31
|
+
user.has_role?('Administrator').should be_falsy
|
32
|
+
user.has_role?('Librarian').should be_falsy
|
33
|
+
user.has_role?('User').should be_truthy
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should lock an user' do
|
37
|
+
user = FactoryGirl.create(:user)
|
38
|
+
user.locked = '1'
|
39
|
+
user.save
|
40
|
+
user.active_for_authentication?.should be_falsy
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'should unlock an user' do
|
44
|
+
user = FactoryGirl.create(:user)
|
45
|
+
user.lock_access!
|
46
|
+
user.locked = '0'
|
47
|
+
user.save
|
48
|
+
user.active_for_authentication?.should be_truthy
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should create user" do
|
52
|
+
user = FactoryGirl.create(:user)
|
53
|
+
assert !user.new_record?, "#{user.errors.full_messages.to_sentence}"
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should require username" do
|
57
|
+
old_count = User.count
|
58
|
+
user = FactoryGirl.build(:user, :username => nil)
|
59
|
+
user.save
|
60
|
+
user.errors[:username].should be_truthy
|
61
|
+
User.count.should eq old_count
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should require password" do
|
65
|
+
user = FactoryGirl.build(:user, :password => nil)
|
66
|
+
user.save
|
67
|
+
user.errors[:password].should be_truthy
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should not require password_confirmation on create" do
|
71
|
+
user = FactoryGirl.build(:user, :password => 'new_password', :password_confirmation => nil)
|
72
|
+
user.save
|
73
|
+
user.errors[:email].should be_empty
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should reset password" do
|
77
|
+
users(:user1).password = 'new password'
|
78
|
+
users(:user1).password_confirmation = 'new password'
|
79
|
+
users(:user1).save
|
80
|
+
users(:user1).valid_password?('new password').should be_truthy
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should set temporary_password" do
|
84
|
+
user = users(:user1)
|
85
|
+
old_password = user.encrypted_password
|
86
|
+
user.set_auto_generated_password
|
87
|
+
user.save
|
88
|
+
old_password.should_not eq user.encrypted_password
|
89
|
+
user.valid_password?('user1password').should be_falsy
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should get highest_role" do
|
93
|
+
users(:admin).role.name.should eq 'Administrator'
|
94
|
+
end
|
95
|
+
|
96
|
+
it "should lock all expired users" do
|
97
|
+
User.lock_expired_users
|
98
|
+
users(:user4).active_for_authentication?.should be_falsy
|
99
|
+
end
|
100
|
+
|
101
|
+
it "should lock_expired users" do
|
102
|
+
user = users(:user1)
|
103
|
+
users(:user1).active_for_authentication?.should be_truthy
|
104
|
+
user.expired_at = 1.day.ago
|
105
|
+
user.save
|
106
|
+
users(:user1).active_for_authentication?.should be_falsy
|
107
|
+
end
|
108
|
+
|
109
|
+
if defined?(EnjuQuestion)
|
110
|
+
it "should reset answer_feed_token" do
|
111
|
+
users(:user1).reset_answer_feed_token
|
112
|
+
users(:user1).answer_feed_token.should be_truthy
|
113
|
+
end
|
114
|
+
|
115
|
+
it "should delete answer_feed_token" do
|
116
|
+
users(:user1).delete_answer_feed_token
|
117
|
+
users(:user1).answer_feed_token.should be_nil
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
describe ".export" do
|
122
|
+
it "should export all user's information" do
|
123
|
+
lines = User.export
|
124
|
+
CSV.parse(lines, col_sep: "\t")
|
125
|
+
expect(lines).not_to be_empty
|
126
|
+
expect(lines.split(/\n/).size).to eq User.count + 1
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
# == Schema Information
|
132
|
+
#
|
133
|
+
# Table name: users
|
134
|
+
#
|
135
|
+
# id :integer not null, primary key
|
136
|
+
# email :string(255) default(""), not null
|
137
|
+
# encrypted_password :string(255) default(""), not null
|
138
|
+
# reset_password_token :string(255)
|
139
|
+
# reset_password_sent_at :datetime
|
140
|
+
# remember_created_at :datetime
|
141
|
+
# sign_in_count :integer default(0)
|
142
|
+
# current_sign_in_at :datetime
|
143
|
+
# last_sign_in_at :datetime
|
144
|
+
# current_sign_in_ip :string(255)
|
145
|
+
# last_sign_in_ip :string(255)
|
146
|
+
# password_salt :string(255)
|
147
|
+
# confirmation_token :string(255)
|
148
|
+
# confirmed_at :datetime
|
149
|
+
# confirmation_sent_at :datetime
|
150
|
+
# unconfirmed_email :string(255)
|
151
|
+
# failed_attempts :integer default(0)
|
152
|
+
# unlock_token :string(255)
|
153
|
+
# locked_at :datetime
|
154
|
+
# authentication_token :string(255)
|
155
|
+
# created_at :datetime not null
|
156
|
+
# updated_at :datetime not null
|
157
|
+
# deleted_at :datetime
|
158
|
+
# username :string(255) not null
|
159
|
+
# library_id :integer default(1), not null
|
160
|
+
# user_group_id :integer default(1), not null
|
161
|
+
# expired_at :datetime
|
162
|
+
# required_role_id :integer default(1), not null
|
163
|
+
# note :text
|
164
|
+
# keyword_list :text
|
165
|
+
# user_number :string(255)
|
166
|
+
# state :string(255)
|
167
|
+
# locale :string(255)
|
168
|
+
# enju_access_key :string(255)
|
169
|
+
# save_checkout_history :boolean default(FALSE), not null
|
170
|
+
# checkout_icalendar_token :string(255)
|
171
|
+
# share_bookmarks :boolean
|
172
|
+
# save_search_history :boolean default(FALSE), not null
|
173
|
+
# answer_feed_token :string(255)
|
174
|
+
#
|
175
|
+
|
@@ -18,7 +18,6 @@ describe "my_accounts/show" do
|
|
18
18
|
allow(view).to receive(:policy).and_return double(update?: true, destroy?: true)
|
19
19
|
render
|
20
20
|
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
21
|
-
rendered.should match(/Checkout/)
|
22
21
|
end
|
23
22
|
|
24
23
|
it "cannot be deletable by other librarian" do
|
@@ -37,7 +36,6 @@ describe "my_accounts/show" do
|
|
37
36
|
it "renders attributes in <p>" do
|
38
37
|
allow(view).to receive(:policy).and_return double(update?: true, destroy?: true)
|
39
38
|
render
|
40
|
-
rendered.should match(/Checkout/)
|
41
39
|
end
|
42
40
|
end
|
43
41
|
end
|
@@ -8,13 +8,6 @@ describe "profiles/show" do
|
|
8
8
|
view.stub(:current_user).and_return(User.friendly.find('enjuadmin'))
|
9
9
|
end
|
10
10
|
|
11
|
-
it "renders attributes in <p>" do
|
12
|
-
allow(view).to receive(:policy).and_return double(update?: true, destroy?: true)
|
13
|
-
render
|
14
|
-
# Run the generator again with the --webrat flag if you want to use webrat matchers
|
15
|
-
rendered.should match(/Checkout/)
|
16
|
-
end
|
17
|
-
|
18
11
|
describe "when logged in as Librarian" do
|
19
12
|
before(:each) do
|
20
13
|
@profile = assign(:profile, profiles(:librarian2))
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enju_seed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.0.beta.
|
4
|
+
version: 0.2.0.beta.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kosuke Tanabe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -235,75 +235,47 @@ dependencies:
|
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: 1.8.3
|
237
237
|
- !ruby/object:Gem::Dependency
|
238
|
-
name:
|
239
|
-
requirement: !ruby/object:Gem::Requirement
|
240
|
-
requirements:
|
241
|
-
- - "~>"
|
242
|
-
- !ruby/object:Gem::Version
|
243
|
-
version: 1.2.0.beta.1
|
244
|
-
type: :development
|
245
|
-
prerelease: false
|
246
|
-
version_requirements: !ruby/object:Gem::Requirement
|
247
|
-
requirements:
|
248
|
-
- - "~>"
|
249
|
-
- !ruby/object:Gem::Version
|
250
|
-
version: 1.2.0.beta.1
|
251
|
-
- !ruby/object:Gem::Dependency
|
252
|
-
name: enju_library
|
253
|
-
requirement: !ruby/object:Gem::Requirement
|
254
|
-
requirements:
|
255
|
-
- - "~>"
|
256
|
-
- !ruby/object:Gem::Version
|
257
|
-
version: 0.2.0.beta.2
|
258
|
-
type: :development
|
259
|
-
prerelease: false
|
260
|
-
version_requirements: !ruby/object:Gem::Requirement
|
261
|
-
requirements:
|
262
|
-
- - "~>"
|
263
|
-
- !ruby/object:Gem::Version
|
264
|
-
version: 0.2.0.beta.2
|
265
|
-
- !ruby/object:Gem::Dependency
|
266
|
-
name: enju_biblio
|
238
|
+
name: simple_form
|
267
239
|
requirement: !ruby/object:Gem::Requirement
|
268
240
|
requirements:
|
269
|
-
- - "
|
241
|
+
- - ">="
|
270
242
|
- !ruby/object:Gem::Version
|
271
|
-
version: 0
|
272
|
-
type: :
|
243
|
+
version: '0'
|
244
|
+
type: :runtime
|
273
245
|
prerelease: false
|
274
246
|
version_requirements: !ruby/object:Gem::Requirement
|
275
247
|
requirements:
|
276
|
-
- - "
|
248
|
+
- - ">="
|
277
249
|
- !ruby/object:Gem::Version
|
278
|
-
version: 0
|
250
|
+
version: '0'
|
279
251
|
- !ruby/object:Gem::Dependency
|
280
|
-
name:
|
252
|
+
name: validates_timeliness
|
281
253
|
requirement: !ruby/object:Gem::Requirement
|
282
254
|
requirements:
|
283
255
|
- - "~>"
|
284
256
|
- !ruby/object:Gem::Version
|
285
|
-
version:
|
286
|
-
type: :
|
257
|
+
version: '4.0'
|
258
|
+
type: :runtime
|
287
259
|
prerelease: false
|
288
260
|
version_requirements: !ruby/object:Gem::Requirement
|
289
261
|
requirements:
|
290
262
|
- - "~>"
|
291
263
|
- !ruby/object:Gem::Version
|
292
|
-
version:
|
264
|
+
version: '4.0'
|
293
265
|
- !ruby/object:Gem::Dependency
|
294
|
-
name:
|
266
|
+
name: enju_leaf
|
295
267
|
requirement: !ruby/object:Gem::Requirement
|
296
268
|
requirements:
|
297
269
|
- - "~>"
|
298
270
|
- !ruby/object:Gem::Version
|
299
|
-
version:
|
271
|
+
version: 1.2.0.beta.2
|
300
272
|
type: :development
|
301
273
|
prerelease: false
|
302
274
|
version_requirements: !ruby/object:Gem::Requirement
|
303
275
|
requirements:
|
304
276
|
- - "~>"
|
305
277
|
- !ruby/object:Gem::Version
|
306
|
-
version:
|
278
|
+
version: 1.2.0.beta.2
|
307
279
|
- !ruby/object:Gem::Dependency
|
308
280
|
name: sqlite3
|
309
281
|
requirement: !ruby/object:Gem::Requirement
|
@@ -415,6 +387,7 @@ files:
|
|
415
387
|
- app/controllers/my_accounts_controller.rb
|
416
388
|
- app/controllers/profiles_controller.rb
|
417
389
|
- app/controllers/roles_controller.rb
|
390
|
+
- app/models/concerns/enju_seed/enju_user.rb
|
418
391
|
- app/models/concerns/master_model.rb
|
419
392
|
- app/models/identity.rb
|
420
393
|
- app/models/profile.rb
|
@@ -456,6 +429,7 @@ files:
|
|
456
429
|
- db/migrate/20151126005552_add_provider_to_identity.rb
|
457
430
|
- lib/enju_seed.rb
|
458
431
|
- lib/enju_seed/engine.rb
|
432
|
+
- lib/enju_seed/localized_name.rb
|
459
433
|
- lib/enju_seed/version.rb
|
460
434
|
- lib/tasks/enju_seed_tasks.rake
|
461
435
|
- spec/controllers/my_accounts_controller_spec.rb
|
@@ -485,7 +459,6 @@ files:
|
|
485
459
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
486
460
|
- spec/dummy/config/initializers/cookies_serializer.rb
|
487
461
|
- spec/dummy/config/initializers/devise.rb
|
488
|
-
- spec/dummy/config/initializers/enju_leaf.rb
|
489
462
|
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
490
463
|
- spec/dummy/config/initializers/friendly_id.rb
|
491
464
|
- spec/dummy/config/initializers/inflections.rb
|
@@ -701,6 +674,7 @@ files:
|
|
701
674
|
- spec/models/profile_spec.rb
|
702
675
|
- spec/models/role_spec.rb
|
703
676
|
- spec/models/user_has_role_spec.rb
|
677
|
+
- spec/models/user_spec.rb
|
704
678
|
- spec/rails_helper.rb
|
705
679
|
- spec/requests/profiles_spec.rb
|
706
680
|
- spec/routing/profiles_routing_spec.rb
|
@@ -762,7 +736,6 @@ test_files:
|
|
762
736
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
763
737
|
- spec/dummy/config/initializers/cookies_serializer.rb
|
764
738
|
- spec/dummy/config/initializers/devise.rb
|
765
|
-
- spec/dummy/config/initializers/enju_leaf.rb
|
766
739
|
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
767
740
|
- spec/dummy/config/initializers/friendly_id.rb
|
768
741
|
- spec/dummy/config/initializers/inflections.rb
|
@@ -981,6 +954,7 @@ test_files:
|
|
981
954
|
- spec/models/profile_spec.rb
|
982
955
|
- spec/models/role_spec.rb
|
983
956
|
- spec/models/user_has_role_spec.rb
|
957
|
+
- spec/models/user_spec.rb
|
984
958
|
- spec/rails_helper.rb
|
985
959
|
- spec/requests/profiles_spec.rb
|
986
960
|
- spec/routing/profiles_routing_spec.rb
|