radiant-reader-extension 3.0.8 → 3.0.9
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.
- data/app/models/reader.rb +2 -2
- data/lib/radiant-reader-extension.rb +1 -1
- data/lib/reader_user.rb +18 -0
- data/radiant-reader-extension-3.0.8.gem +0 -0
- data/reader_extension.rb +2 -5
- data/spec/lib/reader_user_spec.rb +31 -0
- metadata +10 -8
data/app/models/reader.rb
CHANGED
@@ -290,9 +290,9 @@ private
|
|
290
290
|
reader = Reader.find_by_email(self.email)
|
291
291
|
user = User.find_by_email(self.email)
|
292
292
|
if user && user != self.user
|
293
|
-
errors.add :
|
293
|
+
errors.add :email, :taken_by_author
|
294
294
|
elsif reader && reader != self
|
295
|
-
errors.add :
|
295
|
+
errors.add :email, :taken
|
296
296
|
else
|
297
297
|
return true
|
298
298
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module RadiantReaderExtension
|
2
|
-
VERSION = '3.0.
|
2
|
+
VERSION = '3.0.9'
|
3
3
|
SUMMARY = %q{Reader/viewer/visitor registration, login and access-control for Radiant CMS}
|
4
4
|
DESCRIPTION = %q{Provides reader/member/user registration and management functions including password-reminder, group-based page access control and administrative email.}
|
5
5
|
URL = "http://radiant.spanner.org/reader"
|
data/lib/reader_user.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
module ReaderUser
|
2
|
+
|
3
|
+
def self.included(base)
|
4
|
+
base.class_eval do
|
5
|
+
has_one :reader
|
6
|
+
before_update :update_reader
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def update_reader
|
11
|
+
if self.reader
|
12
|
+
Reader.user_columns.each { |att| self.reader.send("#{att.to_s}=", send(att)) if send("#{att.to_s}_changed?") }
|
13
|
+
self.reader.password_confirmation = password_confirmation if password_changed?
|
14
|
+
self.reader.save! if self.reader.changed?
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
Binary file
|
data/reader_extension.rb
CHANGED
@@ -12,8 +12,9 @@ class ReaderExtension < Radiant::Extension
|
|
12
12
|
ActiveRecord::Base.send :include, GroupedModel # has_group mechanism for any model that can belong_to a group
|
13
13
|
ApplicationController.send :include, ControllerExtensions # hooks up reader authentication and layout-chooser
|
14
14
|
SiteController.send :include, SiteControllerExtensions # access control based on group membership
|
15
|
+
User.send :include, ReaderUser # update linked reader when user account values change
|
15
16
|
Page.send :include, GroupedPage # group associations and visibility decisions
|
16
|
-
Site.send :include, ReaderSite if defined? Site # adds site scope and site-based layout-chooser
|
17
|
+
# Site.send :include, ReaderSite if defined? Site # adds site scope and site-based layout-chooser
|
17
18
|
Page.send :include, ReaderTags # a few mailmerge-like radius tags for use in messages, or for greeting readers on (uncached) pages
|
18
19
|
UserActionObserver.instance.send :add_observer!, Reader
|
19
20
|
UserActionObserver.instance.send :add_observer!, Message
|
@@ -38,10 +39,6 @@ class ReaderExtension < Radiant::Extension
|
|
38
39
|
add_item("Readers", "/admin/readers/reader_configuration")
|
39
40
|
end
|
40
41
|
end
|
41
|
-
|
42
|
-
def deactivate
|
43
|
-
|
44
|
-
end
|
45
42
|
end
|
46
43
|
|
47
44
|
module ReaderError
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe User do
|
4
|
+
dataset :readers
|
5
|
+
# activate_authlogic
|
6
|
+
|
7
|
+
let(:user) { users(:existing) }
|
8
|
+
let(:reader) { readers(:user) }
|
9
|
+
|
10
|
+
it "should have an associated reader" do
|
11
|
+
user.reader.should == reader
|
12
|
+
reader.user.should == user
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "on update" do
|
16
|
+
it "should update the attributes of an associated reader" do
|
17
|
+
user.name = "Cardinal Fang"
|
18
|
+
user.save!
|
19
|
+
user.reader.name.should == "Cardinal Fang"
|
20
|
+
Reader.find_by_name("Cardinal Fang").should == readers(:user)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should update the associated reader's credentials" do
|
24
|
+
user.password = user.password_confirmation = 'bl0tto'
|
25
|
+
user.save!
|
26
|
+
user.authenticated?('bl0tto').should be_true
|
27
|
+
user.reader.valid_password?('bl0tto').should be_true
|
28
|
+
# ReaderSession.new(:login => reader.login, :password => 'bl0tto').should be_valid
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: radiant-reader-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 3.0.
|
9
|
+
- 9
|
10
|
+
version: 3.0.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- William Ross
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-10-05 00:00:00
|
19
|
-
default_executable:
|
18
|
+
date: 2011-10-05 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: radiant-layouts-extension
|
@@ -311,6 +310,7 @@ files:
|
|
311
310
|
- lib/reader_admin_ui.rb
|
312
311
|
- lib/reader_site.rb
|
313
312
|
- lib/reader_tags.rb
|
313
|
+
- lib/reader_user.rb
|
314
314
|
- lib/rfc822.rb
|
315
315
|
- lib/sanitize/config/generous.rb
|
316
316
|
- lib/site_controller_extensions.rb
|
@@ -329,6 +329,7 @@ files:
|
|
329
329
|
- public/stylesheets/sass/admin/reader_group.sass
|
330
330
|
- public/stylesheets/sass/reader.sass
|
331
331
|
- radiant-reader-extension-3.0.7.gem
|
332
|
+
- radiant-reader-extension-3.0.8.gem
|
332
333
|
- radiant-reader-extension.gemspec
|
333
334
|
- Rakefile
|
334
335
|
- reader_extension.rb
|
@@ -344,6 +345,7 @@ files:
|
|
344
345
|
- spec/lib/reader_admin_ui_spec.rb
|
345
346
|
- spec/lib/reader_site_spec.rb
|
346
347
|
- spec/lib/reader_tags_spec.rb
|
348
|
+
- spec/lib/reader_user_spec.rb
|
347
349
|
- spec/matchers/reader_login_system_matcher.rb
|
348
350
|
- spec/models/group_spec.rb
|
349
351
|
- spec/models/message_spec.rb
|
@@ -353,11 +355,10 @@ files:
|
|
353
355
|
- spec/models/reader_spec.rb
|
354
356
|
- spec/spec.opts
|
355
357
|
- spec/spec_helper.rb
|
356
|
-
has_rdoc: true
|
357
358
|
homepage: http://radiant.spanner.org/reader
|
358
359
|
licenses: []
|
359
360
|
|
360
|
-
post_install_message: "\n Add this to your radiant project with:\n\n config.gem 'radiant-reader-extension', :version => '~> 3.0.
|
361
|
+
post_install_message: "\n Add this to your radiant project with:\n\n config.gem 'radiant-reader-extension', :version => '~> 3.0.9'\n\n and if you haven't already, remember to enable ActionMailer in your\n project's config/environment.rb.\n "
|
361
362
|
rdoc_options: []
|
362
363
|
|
363
364
|
require_paths:
|
@@ -383,7 +384,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
383
384
|
requirements: []
|
384
385
|
|
385
386
|
rubyforge_project:
|
386
|
-
rubygems_version: 1.
|
387
|
+
rubygems_version: 1.8.10
|
387
388
|
signing_key:
|
388
389
|
specification_version: 3
|
389
390
|
summary: Reader/viewer/visitor registration, login and access-control for Radiant CMS
|
@@ -399,6 +400,7 @@ test_files:
|
|
399
400
|
- spec/lib/reader_admin_ui_spec.rb
|
400
401
|
- spec/lib/reader_site_spec.rb
|
401
402
|
- spec/lib/reader_tags_spec.rb
|
403
|
+
- spec/lib/reader_user_spec.rb
|
402
404
|
- spec/matchers/reader_login_system_matcher.rb
|
403
405
|
- spec/models/group_spec.rb
|
404
406
|
- spec/models/message_spec.rb
|