radiant-reader-extension 3.0.32 → 3.0.33
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/controllers/accounts_controller.rb +1 -1
- data/app/controllers/groups_controller.rb +1 -1
- data/app/models/group.rb +3 -17
- data/app/models/reader.rb +3 -29
- data/app/views/admin/groups/_group.html.haml +0 -2
- data/app/views/admin/messages/edit.html.haml +1 -1
- data/app/views/admin/messages/new.html.haml +1 -1
- data/app/views/admin/messages/show.html.haml +1 -1
- data/app/views/admin/readers/_form.html.haml +25 -1
- data/app/views/groups/_group.html.haml +0 -4
- data/app/views/groups/show.html.haml +4 -10
- data/app/views/memberships/_membership.html.haml +1 -33
- data/app/views/readers/_directory.html.haml +21 -18
- data/app/views/readers/_reader.html.haml +2 -2
- data/app/views/readers/show.html.haml +2 -3
- data/config/locales/en.yml +4 -2
- data/lib/grouped_model.rb +9 -28
- data/lib/grouped_page.rb +5 -5
- data/lib/radiant-reader-extension.rb +1 -1
- data/lib/reader_admin_ui.rb +1 -1
- data/lib/reader_tags.rb +3 -1
- data/public/images/furniture/vcard-16x16.png +0 -0
- data/public/images/furniture/vcard-24x24.png +0 -0
- data/public/images/furniture/vcard-32x32.png +0 -0
- data/public/images/furniture/vcard-48x48.png +0 -0
- data/public/images/furniture/vcards.png +0 -0
- data/spec/datasets/readers_dataset.rb +1 -2
- data/spec/models/group_spec.rb +0 -50
- data/spec/models/reader_page_spec.rb +1 -1
- metadata +10 -7
- data/public/images/furniture/vcard.png +0 -0
- data/radiant-reader-extension-3.0.31.gem +0 -0
data/app/models/group.rb
CHANGED
@@ -2,7 +2,6 @@ require 'ancestry'
|
|
2
2
|
|
3
3
|
class Group < ActiveRecord::Base
|
4
4
|
|
5
|
-
has_ancestry
|
6
5
|
belongs_to :leader, :class_name => 'Reader'
|
7
6
|
belongs_to :created_by, :class_name => 'User'
|
8
7
|
belongs_to :updated_by, :class_name => 'User'
|
@@ -66,7 +65,7 @@ class Group < ActiveRecord::Base
|
|
66
65
|
when 'private'
|
67
66
|
reader ? self.all : self.none
|
68
67
|
when 'grouped'
|
69
|
-
(reader && reader.is_grouped?) ? reader.
|
68
|
+
(reader && reader.is_grouped?) ? reader.groups : self.none
|
70
69
|
else
|
71
70
|
self.none
|
72
71
|
end
|
@@ -75,24 +74,11 @@ class Group < ActiveRecord::Base
|
|
75
74
|
def visible_to?(reader=nil)
|
76
75
|
self.class.visible_to(reader).map(&:id).include? self.id
|
77
76
|
end
|
78
|
-
|
79
|
-
def tree
|
80
|
-
# can't quite do this in one step, but we can return a scope
|
81
|
-
self.root.subtree
|
82
|
-
end
|
83
|
-
|
84
|
-
def tree_ids
|
85
|
-
self.root.subtree_ids
|
86
|
-
end
|
87
77
|
|
88
78
|
def members
|
89
|
-
|
79
|
+
readers
|
90
80
|
end
|
91
81
|
|
92
|
-
def inherited_permissions
|
93
|
-
Permission.to_groups(path)
|
94
|
-
end
|
95
|
-
|
96
82
|
def url
|
97
83
|
homepage.url if homepage
|
98
84
|
end
|
@@ -130,7 +116,7 @@ class Group < ActiveRecord::Base
|
|
130
116
|
def self.define_retrieval_methods(classname)
|
131
117
|
type_scope = "for_#{classname.downcase.pluralize}".intern
|
132
118
|
Permission.send :named_scope, type_scope, :conditions => { :permitted_type => classname }
|
133
|
-
define_method("#{classname.downcase}_permissions") { self.
|
119
|
+
define_method("#{classname.downcase}_permissions") { self.permissions.send type_scope }
|
134
120
|
define_method("#{classname.downcase.pluralize}") {
|
135
121
|
ids = self.send("#{classname.to_s.downcase}_permissions".intern).map(&:permitted_id)
|
136
122
|
classname.constantize.find_these(ids)
|
data/app/models/reader.rb
CHANGED
@@ -93,7 +93,7 @@ class Reader < ActiveRecord::Base
|
|
93
93
|
when 'private'
|
94
94
|
reader ? self.all : self.none
|
95
95
|
when 'grouped'
|
96
|
-
reader ? self.in_groups(reader.
|
96
|
+
reader ? self.in_groups(reader.group_ids) : self.none
|
97
97
|
else
|
98
98
|
self.none
|
99
99
|
end
|
@@ -103,38 +103,12 @@ class Reader < ActiveRecord::Base
|
|
103
103
|
(reader && (reader == self)) || self.class.visible_to(reader).map(&:id).include?(self.id)
|
104
104
|
end
|
105
105
|
|
106
|
-
# returns a useful list of the groups that this person is in and all their ancestor groups.
|
107
|
-
# for most authorisation purposes, that's the set of groups of which this reader is considered a member.
|
108
|
-
#
|
109
|
-
# Returns a scope.
|
110
|
-
#
|
111
|
-
def all_groups
|
112
|
-
Group.find_these(all_group_ids)
|
113
|
-
end
|
114
|
-
|
115
|
-
def all_group_ids
|
116
|
-
self.groups.map(&:path_ids).flatten.uniq
|
117
|
-
end
|
118
|
-
|
119
|
-
# Returns a list of the groups that this person is in along with their whole tree of super and subgroups.
|
120
|
-
# That's the list of groups that this person can see. It is larger than the list of groups that confer permission:
|
121
|
-
# this reader can see subgroups of his own groups in the directory, but he can't see their pages.
|
122
|
-
#
|
123
|
-
def all_visible_groups
|
124
|
-
Group.find_these(all_visible_group_ids)
|
125
|
-
end
|
126
|
-
|
127
|
-
def all_visible_group_ids
|
128
|
-
self.groups.map(&:tree_ids).flatten.uniq
|
129
|
-
end
|
130
|
-
|
131
106
|
def can_see? (this)
|
132
|
-
|
133
|
-
permitted_groups.empty? or in_any_of_these_groups?(permitted_groups)
|
107
|
+
this.groups.empty? or in_any_of_these_groups?(this.groups)
|
134
108
|
end
|
135
109
|
|
136
110
|
def in_any_of_these_groups? (grouplist)
|
137
|
-
(grouplist &
|
111
|
+
(grouplist & groups).any?
|
138
112
|
end
|
139
113
|
|
140
114
|
def membership_of(group)
|
@@ -24,6 +24,4 @@
|
|
24
24
|
= link_to_unless_current image('plus') + ' ' + t('reader_extension.add_subgroup'), new_admin_group_url(:parent_id => group.id), :class => 'action'
|
25
25
|
= link_to_unless_current image('delta') + ' ' + t('reader_extension.edit_group'), edit_admin_group_url(group), :class => 'action'
|
26
26
|
= link_to_unless_current image('minus') + ' ' + t('reader_extension.delete_group'), admin_group_url(group), :method => 'delete', :confirm => t("reader_extension.really_delete_group", :name => group.name), :class => 'action'
|
27
|
-
|
28
|
-
= render :partial => 'group', :collection => group.children, :locals => {:level => level+1}
|
29
27
|
|
@@ -7,7 +7,7 @@
|
|
7
7
|
= t('reader_extension.edit_message')
|
8
8
|
|
9
9
|
- main.edit_form do
|
10
|
-
- form_for :message, @message, :url =>
|
10
|
+
- form_for :message, @message, :url => admin_message_path(@message), :html => {:id => 'message_form', :method => 'put'} do |f|
|
11
11
|
= render :partial => 'form', :object => f
|
12
12
|
|
13
13
|
- main.edit_popups do
|
@@ -8,7 +8,7 @@
|
|
8
8
|
= t('reader_extension.create_message')
|
9
9
|
|
10
10
|
- main.edit_form do
|
11
|
-
- form_for :message, @message, :url =>
|
11
|
+
- form_for :message, @message, :url => admin_messages_path, :html => {:id => 'message_form', :method => 'post'} do |f|
|
12
12
|
= render :partial => 'form', :object => f
|
13
13
|
|
14
14
|
- main.edit_popups do
|
@@ -48,7 +48,7 @@
|
|
48
48
|
|
49
49
|
- delivery.options do
|
50
50
|
- unless @message.administrative?
|
51
|
-
- form_for :message, @message, :url =>
|
51
|
+
- form_for :message, @message, :url => deliver_admin_message_path(@message), :html => {"data-onsubmit_status"=>"Sending email messages…"} do |f|
|
52
52
|
%h3
|
53
53
|
= t("reader_extension.send_to").titlecase + ":"
|
54
54
|
.radio_group
|
@@ -5,7 +5,7 @@
|
|
5
5
|
= render_region :form_top, :locals => {:f => f}
|
6
6
|
|
7
7
|
- render_region :form, :locals => {:f => f} do |form|
|
8
|
-
- form.
|
8
|
+
- form.edit_name do
|
9
9
|
%p
|
10
10
|
= f.label :forename
|
11
11
|
= f.text_field :forename, :class => "textbox activate", :size => 32, :maxlength => 100
|
@@ -26,6 +26,30 @@
|
|
26
26
|
- form.edit_password do
|
27
27
|
= render "password_fields", :f => f
|
28
28
|
|
29
|
+
- form.edit_phone do
|
30
|
+
%p
|
31
|
+
= f.label :phone
|
32
|
+
= f.text_field :phone, :class => 'textbox'
|
33
|
+
%p
|
34
|
+
= f.label :mobile
|
35
|
+
= f.text_field :mobile, :class => 'textbox'
|
36
|
+
|
37
|
+
- form.edit_address do
|
38
|
+
%p
|
39
|
+
= f.label :post_line1, t('activerecord.attributes.reader.postal_address')
|
40
|
+
= f.text_field :post_line1, :class => 'textbox'
|
41
|
+
%br
|
42
|
+
= f.text_field :post_line2, :class => 'textbox'
|
43
|
+
%p
|
44
|
+
= f.label :post_city
|
45
|
+
= f.text_field :post_city, :class => 'textbox'
|
46
|
+
%p
|
47
|
+
= f.label :post_province
|
48
|
+
= f.text_field :post_province, :class => 'textbox'
|
49
|
+
%p
|
50
|
+
= f.label :postcode
|
51
|
+
= f.text_field :postcode, :class => 'textbox'
|
52
|
+
|
29
53
|
- form.edit_description do
|
30
54
|
- if Radiant.config['reader.show_descriptions?']
|
31
55
|
%p
|
@@ -3,9 +3,6 @@
|
|
3
3
|
= t('reader_extension.separator')
|
4
4
|
= link_to t('reader_extension.groups').titlecase, groups_url
|
5
5
|
= t('reader_extension.separator')
|
6
|
-
- if @group.parent
|
7
|
-
= link_to @group.parent.name, group_url(@group.parent)
|
8
|
-
= t('reader_extension.separator')
|
9
6
|
|
10
7
|
- content_for :title do
|
11
8
|
= @group.name
|
@@ -20,18 +17,15 @@
|
|
20
17
|
|
21
18
|
= render :partial => 'shared/standard_reader_parts'
|
22
19
|
|
23
|
-
- content_for :
|
20
|
+
- content_for :introduction do
|
24
21
|
%p
|
25
22
|
= t('reader_extension.download_group_as')
|
26
23
|
= link_to t("reader_extension.csv_file"), group_url(@group, :format => :csv), :class => 'csv'
|
27
24
|
= t('or')
|
28
|
-
= link_to t("reader_extension.vcard_file"), group_url(@group, :format => :vcard), :class => '
|
29
|
-
|
30
|
-
- if @group.children.any?
|
31
|
-
%h2
|
32
|
-
= t('reader_extension.subgroups', :name => @group.name)
|
33
|
-
= render :partial => 'groups/group', :collection => @group.children
|
25
|
+
= link_to t("reader_extension.vcard_file"), group_url(@group, :format => :vcard), :class => 'vcards'
|
26
|
+
= t('reader_extension.or_individual_card')
|
34
27
|
|
28
|
+
- content_for :main do
|
35
29
|
- if @group.memberships.any?
|
36
30
|
%h2
|
37
31
|
= t('reader_extension.group_members')
|
@@ -1,36 +1,4 @@
|
|
1
1
|
- if membership
|
2
2
|
- group = membership.group
|
3
3
|
- reader = membership.reader
|
4
|
-
|
5
|
-
%tr.reader
|
6
|
-
- if reader.unshareable?
|
7
|
-
%td{:colspan => 8}
|
8
|
-
= t("reader_extension.listing_denied")
|
9
|
-
- else
|
10
|
-
%td.gravatar
|
11
|
-
= link_to gravatar_for(reader, {:size => 18}, {:class => 'gravatar'}), reader_url(reader), :title => reader.preferred_name
|
12
|
-
%td.name
|
13
|
-
%h3
|
14
|
-
= link_to reader.preferred_name, reader_url(reader)
|
15
|
-
%td.role
|
16
|
-
%p
|
17
|
-
%span.role
|
18
|
-
= membership.role
|
19
|
-
%td.email
|
20
|
-
%p
|
21
|
-
= mail_to reader.email, nil, :encode => 'hex', :replace_at => " #{t('reader_extension.at')} "
|
22
|
-
|
23
|
-
- [:phone, :mobile].each do |field|
|
24
|
-
- value = reader.send(field)
|
25
|
-
- unless value.blank?
|
26
|
-
%td{:class => field.to_s}
|
27
|
-
%p
|
28
|
-
= value
|
29
|
-
- else
|
30
|
-
%td.missing
|
31
|
-
%p
|
32
|
-
= t("reader_extension.no_#{field}")
|
33
|
-
|
34
|
-
%td.vcard
|
35
|
-
%p
|
36
|
-
= link_to " ", reader_url(reader, :format => :vcard), :class => 'vcard'
|
4
|
+
= render :partial => 'readers/reader', :object => reader
|
@@ -1,27 +1,30 @@
|
|
1
1
|
- case Radiant.config['reader.directory_visibility']
|
2
2
|
- when 'public'
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
.groups
|
4
|
+
- if @groups.any?
|
5
|
+
%h2
|
6
|
+
= t('reader_extension.groups').titlecase
|
7
|
+
= render :partial => 'groups/group', :collection => @groups
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
.readers
|
10
|
+
- if @readers.any?
|
11
|
+
%h2
|
12
|
+
= t('reader_extension.people').titlecase
|
13
|
+
= render :partial => 'readers/list', :locals => {:readers => @readers}
|
12
14
|
|
13
15
|
- when 'grouped'
|
14
|
-
|
15
|
-
= t('reader_extension.your_groups')
|
16
|
-
- if @groups.any
|
17
|
-
= render :partial => 'groups/group', :collection => @groups
|
18
|
-
- else
|
19
|
-
= t('reader_extension.no_groups')
|
20
|
-
|
21
|
-
- if @readers.any?
|
16
|
+
.groups
|
22
17
|
%h2
|
23
|
-
= t('reader_extension.
|
24
|
-
|
18
|
+
= t('reader_extension.your_groups')
|
19
|
+
- if @groups.any
|
20
|
+
= render :partial => 'groups/group', :collection => @groups
|
21
|
+
- else
|
22
|
+
= t('reader_extension.no_groups')
|
23
|
+
.readers
|
24
|
+
- if @readers.any?
|
25
|
+
%h2
|
26
|
+
= t('reader_extension.your_group_members')
|
27
|
+
= render :partial => 'readers/list', :locals => {:readers => @readers}
|
25
28
|
|
26
29
|
- else
|
27
30
|
= t('reader_extension.no_directory')
|
@@ -7,10 +7,10 @@
|
|
7
7
|
= link_to gravatar_for(reader, {:size => 18}, {:class => 'gravatar'}), reader_url(reader), :title => reader.preferred_name
|
8
8
|
%td.name
|
9
9
|
%h3
|
10
|
-
= link_to reader.
|
10
|
+
= link_to reader.name, reader_url(reader)
|
11
11
|
- if reader.preferred_name != reader.name
|
12
12
|
%span.note
|
13
|
-
= reader.
|
13
|
+
= reader.preferred_name
|
14
14
|
%td.email
|
15
15
|
%p
|
16
16
|
= mail_to reader.email, nil, :encode => 'hex', :replace_at => " #{t('reader_extension.at')} "
|
@@ -1,16 +1,15 @@
|
|
1
1
|
- content_for :breadhead do
|
2
|
-
= link_to t('reader_extension.
|
2
|
+
= link_to t('reader_extension.readers_title').titlecase, reader_index_url
|
3
3
|
= t('reader_extension.separator')
|
4
4
|
|
5
5
|
- content_for :title do
|
6
|
-
= @reader.
|
6
|
+
= @reader.name
|
7
7
|
|
8
8
|
- content_for :introduction do
|
9
9
|
- if Radiant.config['reader.show_descriptions?']
|
10
10
|
= @reader.description
|
11
11
|
%p
|
12
12
|
= link_to t('reader_extension.edit_profile'), reader_edit_profile_url
|
13
|
-
|
14
13
|
|
15
14
|
- content_for :breadcrumbs do
|
16
15
|
= yield :breadhead
|
data/config/locales/en.yml
CHANGED
@@ -153,7 +153,7 @@ en:
|
|
153
153
|
create_message: "create message"
|
154
154
|
create_new_message: "Send a new message"
|
155
155
|
create_welcome: "create welcome"
|
156
|
-
csv_file: "
|
156
|
+
csv_file: "csv data"
|
157
157
|
dashboard:
|
158
158
|
account: "Account settings"
|
159
159
|
directory: "Directory"
|
@@ -185,7 +185,7 @@ en:
|
|
185
185
|
vcard_link: "vcard"
|
186
186
|
dont_fill: "Don't fill this in!"
|
187
187
|
download_as: "Download as"
|
188
|
-
download_group_as: "
|
188
|
+
download_group_as: "You can download the whole group as"
|
189
189
|
download_vcard: "Download vcard"
|
190
190
|
edit_group: "edit group"
|
191
191
|
edit_message: "Edit message"
|
@@ -280,6 +280,7 @@ en:
|
|
280
280
|
message_preview_introduction: "This is a snapshot of the message that was delivered to you %{date}. If it contains instructions they may now be out of date."
|
281
281
|
mistaken_access_error: "If you think that's a mistake, and that you should be allowed to do whatever it was you just tried to do, please contact your site administrator."
|
282
282
|
must_be_empty: "must be empty"
|
283
|
+
name: "Name"
|
283
284
|
name_and_login: "Name and Login"
|
284
285
|
navigation:
|
285
286
|
account: "Preferences"
|
@@ -319,6 +320,7 @@ en:
|
|
319
320
|
optional_phone: "[phone]"
|
320
321
|
or_edit_preferences: 'You can also <a href="%{url}">edit your account preferences</a>.'
|
321
322
|
or_edit_profile: 'You can also <a href="%{url}">edit your profile</a> to add more information about yourself.'
|
323
|
+
or_individual_card: ' or click on an individual <img src="/images/furniture/vcard-16x16.png" /> to get their card.'
|
322
324
|
other_messages: "Ad-hoc messages"
|
323
325
|
page_access_explanation: "To restrict access to one or more groups, select them from the list below."
|
324
326
|
page_not_public: "The page you have requested is not public. Please log in. If your account has the necessary permission you will be taken straight there."
|
data/lib/grouped_model.rb
CHANGED
@@ -54,7 +54,7 @@ module GroupedModel
|
|
54
54
|
named_scope :visible_to, lambda { |reader|
|
55
55
|
conditions = "pp.group_id IS NULL"
|
56
56
|
if reader && reader.is_grouped?
|
57
|
-
ids = reader.
|
57
|
+
ids = reader.group_ids
|
58
58
|
conditions = ["#{conditions} OR pp.group_id IS NULL OR pp.group_id IN(#{ids.map{"?"}.join(',')})", *ids]
|
59
59
|
end
|
60
60
|
{
|
@@ -94,11 +94,10 @@ module GroupedModel
|
|
94
94
|
end
|
95
95
|
|
96
96
|
named_scope :belonging_to, lambda { |group|
|
97
|
-
group_ids = group.subtree_ids
|
98
97
|
{
|
99
98
|
:joins => "INNER JOIN permissions as pp on pp.permitted_id = #{self.table_name}.id AND pp.permitted_type = '#{self.to_s}'",
|
100
99
|
:group => column_names.map { |n| self.table_name + '.' + n }.join(','),
|
101
|
-
:conditions => ["pp.group_id
|
100
|
+
:conditions => ["pp.group_id = ?", group.id],
|
102
101
|
:readonly => false
|
103
102
|
}
|
104
103
|
}
|
@@ -114,49 +113,31 @@ module GroupedModel
|
|
114
113
|
|
115
114
|
module GroupedInstanceMethods
|
116
115
|
|
117
|
-
# The list of groups that is allowed to see this object. This will include the groups directly
|
118
|
-
# associated and their descendant subgroups.
|
119
|
-
#
|
120
|
-
def permitted_groups
|
121
|
-
if permitted_group_ids.any?
|
122
|
-
Group.find(permitted_group_ids)
|
123
|
-
else
|
124
|
-
[]
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
def permitted_group_ids
|
129
|
-
# in GroupedPage this is chained to include groups inherited from ancestor pages
|
130
|
-
# while here the subtrees provide inheritance from ancestor groups.
|
131
|
-
#
|
132
|
-
groups.map(&:subtree_ids).flatten.uniq
|
133
|
-
end
|
134
|
-
|
135
116
|
def visible_to?(reader)
|
136
|
-
return true if self.
|
117
|
+
return true if self.groups.empty?
|
137
118
|
return false if reader.nil?
|
138
119
|
return true if reader.is_admin?
|
139
|
-
return (reader.groups & self.
|
120
|
+
return (reader.groups & self.groups).any?
|
140
121
|
end
|
141
122
|
|
142
123
|
def group
|
143
|
-
if self.
|
144
|
-
self.
|
124
|
+
if self.groups.length == 1
|
125
|
+
self.groups.first
|
145
126
|
else
|
146
127
|
nil
|
147
128
|
end
|
148
129
|
end
|
149
130
|
|
150
131
|
def visible?
|
151
|
-
|
132
|
+
groups.empty?
|
152
133
|
end
|
153
134
|
|
154
135
|
def permitted_readers
|
155
|
-
|
136
|
+
groups.any? ? Reader.in_groups(groups) : Reader.scoped({})
|
156
137
|
end
|
157
138
|
|
158
139
|
def has_group?(group)
|
159
|
-
return self.
|
140
|
+
return self.groups.include?(group)
|
160
141
|
end
|
161
142
|
|
162
143
|
def permit(group)
|
data/lib/grouped_page.rb
CHANGED
@@ -5,7 +5,7 @@ module GroupedPage
|
|
5
5
|
has_groups
|
6
6
|
has_one :homegroup, :foreign_key => 'homepage_id', :class_name => 'Group'
|
7
7
|
include InstanceMethods
|
8
|
-
alias_method_chain :
|
8
|
+
alias_method_chain :group_ids, :inheritance
|
9
9
|
alias_method_chain :cache?, :restrictions
|
10
10
|
}
|
11
11
|
end
|
@@ -23,15 +23,15 @@ module GroupedPage
|
|
23
23
|
self.ancestors.map(&:group_ids).flatten.uniq
|
24
24
|
end
|
25
25
|
|
26
|
-
def
|
27
|
-
(
|
26
|
+
def group_ids_with_inheritance
|
27
|
+
(group_ids_without_inheritance + inherited_group_ids).flatten.uniq
|
28
28
|
end
|
29
29
|
|
30
30
|
# this is regrettably expensive and I plan to replace it with a
|
31
|
-
# private?
|
31
|
+
# private? setter that would be cascaded on page update
|
32
32
|
#
|
33
33
|
def restricted?
|
34
|
-
self.
|
34
|
+
self.groups.any?
|
35
35
|
end
|
36
36
|
|
37
37
|
def cache_with_restrictions?
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module RadiantReaderExtension
|
2
|
-
VERSION = '3.0.
|
2
|
+
VERSION = '3.0.33'
|
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_admin_ui.rb
CHANGED
@@ -29,7 +29,7 @@ module ReaderAdminUI
|
|
29
29
|
OpenStruct.new.tap do |reader|
|
30
30
|
reader.edit = Radiant::AdminUI::RegionSet.new do |edit|
|
31
31
|
edit.main.concat %w{edit_header edit_form}
|
32
|
-
edit.form.concat %w{edit_name edit_email edit_nickname edit_password reader_groups edit_description edit_notes}
|
32
|
+
edit.form.concat %w{edit_name edit_email edit_nickname edit_password reader_groups edit_address edit_phone edit_description edit_notes}
|
33
33
|
edit.form_bottom.concat %w{edit_timestamp edit_buttons}
|
34
34
|
end
|
35
35
|
reader.index = Radiant::AdminUI::RegionSet.new do |index|
|
data/lib/reader_tags.rb
CHANGED
@@ -36,6 +36,8 @@ module ReaderTags
|
|
36
36
|
end
|
37
37
|
tag 'readers:each' do |tag|
|
38
38
|
tag.locals.readers = get_readers(tag)
|
39
|
+
|
40
|
+
Rails.logger.warn "readers:each: tlr has #{tag.locals.readers.size} readers"
|
39
41
|
tag.render('reader_list', tag.attr.dup, &tag.block)
|
40
42
|
end
|
41
43
|
|
@@ -73,7 +75,7 @@ module ReaderTags
|
|
73
75
|
we are on an uncached page.
|
74
76
|
}
|
75
77
|
tag 'reader' do |tag|
|
76
|
-
tag.expand if tag.locals.reader
|
78
|
+
tag.expand if tag.locals.reader ||= get_reader(tag)
|
77
79
|
end
|
78
80
|
|
79
81
|
[:name, :forename, :surname, :nickname, :preferred_name, :preferred_informal_name, :email, :description, :login, :honorific].each do |field|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -86,8 +86,7 @@ From <r:sender:name />
|
|
86
86
|
create_model :group, symbol, {
|
87
87
|
:name => name,
|
88
88
|
:slug => name.downcase,
|
89
|
-
:description => "#{name} group"
|
90
|
-
:parent_id => @group_id
|
89
|
+
:description => "#{name} group"
|
91
90
|
}.merge(attributes)
|
92
91
|
if block_given?
|
93
92
|
@group_id = group_id(symbol)
|
data/spec/models/group_spec.rb
CHANGED
@@ -49,45 +49,7 @@ describe Group do
|
|
49
49
|
g.slug.should == 'testy-group'
|
50
50
|
end
|
51
51
|
end
|
52
|
-
|
53
|
-
describe "in a hierarchy" do
|
54
|
-
it "should have parent and children relations" do
|
55
|
-
group = groups(:subgroup)
|
56
|
-
group.respond_to?(:parent).should be_true
|
57
|
-
group.respond_to?(:children).should be_true
|
58
|
-
group.children.should =~ [groups(:subsubgroup), groups(:anothersubsubgroup)]
|
59
|
-
group.parent.should == groups(:supergroup)
|
60
|
-
end
|
61
|
-
|
62
|
-
it "should have descendants and ancestors" do
|
63
|
-
groups(:subsubgroup).path.should == [groups(:supergroup), groups(:subgroup), groups(:subsubgroup)]
|
64
|
-
groups(:subsubgroup).root.should == groups(:supergroup)
|
65
|
-
groups(:supergroup).subtree.should =~ [groups(:supergroup), groups(:subgroup), groups(:subsubgroup), groups(:anothersubsubgroup)]
|
66
|
-
end
|
67
|
-
|
68
|
-
it "should have a root group" do
|
69
|
-
[:supergroup, :subgroup, :subsubgroup].each do |g|
|
70
|
-
groups(g).root.should == groups(:supergroup)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
it "should inherit memberships from descendants" do
|
75
|
-
groups(:supergroup).members.should =~ [readers(:normal), readers(:another)]
|
76
|
-
end
|
77
|
-
|
78
|
-
it "should not inherit memberships from ancestors" do
|
79
|
-
groups(:subsubgroup).members.should be_empty
|
80
|
-
end
|
81
52
|
|
82
|
-
it "should inherit permissions from ancestors" do
|
83
|
-
groups(:subsubgroup).pages.should =~ [pages(:child), pages(:child_2)]
|
84
|
-
end
|
85
|
-
|
86
|
-
it "should not inherit permissions from descendants" do
|
87
|
-
groups(:supergroup).pages.should be_empty
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
53
|
describe "directory visibility" do
|
92
54
|
describe "when directory is grouped" do
|
93
55
|
before do
|
@@ -98,18 +60,6 @@ describe Group do
|
|
98
60
|
groups(:subgroup).visible_to?(readers(:normal)).should be_true
|
99
61
|
end
|
100
62
|
|
101
|
-
it "should be visible to members of ancestor groups" do
|
102
|
-
groups(:supergroup).visible_to?(readers(:normal)).should be_true
|
103
|
-
end
|
104
|
-
|
105
|
-
it "should be visible to members of descendant groups" do
|
106
|
-
groups(:subsubgroup).visible_to?(readers(:normal)).should be_true
|
107
|
-
end
|
108
|
-
|
109
|
-
it "should not be visible to members of groups outside the family" do
|
110
|
-
groups(:subgroup).visible_to?(readers(:inactive)).should be_false
|
111
|
-
end
|
112
|
-
|
113
63
|
it "should not be visible to readers without groups" do
|
114
64
|
groups(:subgroup).visible_to?(readers(:ungrouped)).should be_false
|
115
65
|
end
|
@@ -114,7 +114,7 @@ describe ReaderPage do
|
|
114
114
|
it "should allow access only to groups to which the reader belongs" do
|
115
115
|
lambda { Page.find_by_path("/directory/normal") }.should_not raise_error
|
116
116
|
lambda { Page.find_by_path("/directory/special") }.should raise_error(ReaderError::AccessDenied)
|
117
|
-
Page.find_by_path("/directory").groups.should =~ readers(:normal).
|
117
|
+
Page.find_by_path("/directory").groups.should =~ readers(:normal).groups
|
118
118
|
end
|
119
119
|
|
120
120
|
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: 69
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 3.0.
|
9
|
+
- 33
|
10
|
+
version: 3.0.33
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- William Ross
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-11-
|
18
|
+
date: 2011-11-21 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -325,14 +325,17 @@ files:
|
|
325
325
|
- public/images/furniture/csv.png
|
326
326
|
- public/images/furniture/csv_tiny.png
|
327
327
|
- public/images/furniture/no_gravatar.png
|
328
|
-
- public/images/furniture/vcard.png
|
328
|
+
- public/images/furniture/vcard-16x16.png
|
329
|
+
- public/images/furniture/vcard-24x24.png
|
330
|
+
- public/images/furniture/vcard-32x32.png
|
331
|
+
- public/images/furniture/vcard-48x48.png
|
329
332
|
- public/images/furniture/vcard_tiny.png
|
333
|
+
- public/images/furniture/vcards.png
|
330
334
|
- public/javascripts/admin/reader.js
|
331
335
|
- public/javascripts/reader.js
|
332
336
|
- public/stylesheets/sass/admin/reader.sass
|
333
337
|
- public/stylesheets/sass/admin/reader_group.sass
|
334
338
|
- public/stylesheets/sass/reader.sass
|
335
|
-
- radiant-reader-extension-3.0.31.gem
|
336
339
|
- radiant-reader-extension.gemspec
|
337
340
|
- Rakefile
|
338
341
|
- reader_extension.rb
|
@@ -362,7 +365,7 @@ has_rdoc: true
|
|
362
365
|
homepage: http://radiant.spanner.org/reader
|
363
366
|
licenses: []
|
364
367
|
|
365
|
-
post_install_message: "\n Add this to your radiant project with a line in your Gemfile:\n\n gem 'radiant-reader-extension', '~> 3.0.
|
368
|
+
post_install_message: "\n Add this to your radiant project with a line in your Gemfile:\n\n gem 'radiant-reader-extension', '~> 3.0.33'\n\n and if you haven't already, remember to enable ActionMailer in your\n project's config/environment.rb.\n "
|
366
369
|
rdoc_options: []
|
367
370
|
|
368
371
|
require_paths:
|
Binary file
|
Binary file
|