dm_core 4.2.1.5 → 4.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1cd3a6b0ec02d62a4e814970169c28df82bc97c
4
- data.tar.gz: d6db925f79cc114acbdcee0810858612830b9740
3
+ metadata.gz: bf64b681543b68356a370af815c18901086b47c6
4
+ data.tar.gz: 407e256976d7410197147caeec0127854e2421d5
5
5
  SHA512:
6
- metadata.gz: 4e123d615925bdf29985786f821016173df04be70e866f27478090bf0a6c68e3eee829162386f9fa93c45127840d3b2e579d00120218152ba15039da62423db0
7
- data.tar.gz: 45822143c0aff69acee99eed0a57a790b6eed92a8c1dde915b03919cc5784b9bef5e78ad0fb7bf5dd8f07283a57b0db11059efedb3c3b0867745bc24cc173708
6
+ metadata.gz: 691247dac720f4692cfb5771ac714c6d0997141268bb21c40ed329875decc1532ae4355ad8b7a9a6108aa1041a68b57e94830dcc73df8f22eaf7027e1020b2c7
7
+ data.tar.gz: a7709debf6d65766b7fe39befd8822d6aac6d9ecd10b096f524e8d882735402c9bab38cd4ba6904f59aedbfbcbff53b71798182b721a3f332f26dc40e2034412
@@ -21,7 +21,7 @@ class DmCore::Admin::AdminController < ApplicationController
21
21
  #------------------------------------------------------------------------------
22
22
  def authenticate_admin_user!
23
23
  authenticate_user!
24
- unless can?(:access_admin, :all)
24
+ unless can?(:access_event_section, :all) || can?(:access_admin, :all)
25
25
  flash[:alert] = "Unauthorized Access!"
26
26
  redirect_to current_account.index_path
27
27
  end
@@ -72,21 +72,27 @@ private
72
72
  item[:children] << {text: 'My profile', icon_class: :user, link: dm_core.edit_profile_account_path }
73
73
  item[:children] << {text: 'Logout', icon_class: :exit, link: main_app.destroy_user_session_path, link_options: {method: :delete} }
74
74
  @admin_theme[:top_menu] << item
75
-
75
+
76
76
  #=== Main Menu
77
77
  @admin_theme[:main_menu] << {text: 'Dashboard', icon_class: :dashboard, link: dm_core.admin_dashboard_path, active: admin_path_active_class?(dm_core.admin_dashboard_path) }
78
78
 
79
- if defined?(DmCms) && can?(:manage_content, :all)
80
- @admin_theme[:main_menu] << {text: 'Pages', icon_class: :pages, link: dm_cms.admin_cms_pages_path, active: admin_path_active_class?(dm_cms.admin_cms_pages_path, dm_cms.admin_cms_snippets_path) }
81
- @admin_theme[:main_menu] << {text: 'Blogs', icon_class: :blogs, link: dm_cms.admin_cms_blogs_path, active: admin_path_active_class?(dm_cms.admin_cms_blogs_path) }
82
- @admin_theme[:main_menu] << {text: 'Media Library', icon_class: :media_library, link: dm_cms.admin_media_files_path, active: admin_path_active_class?(dm_cms.admin_media_files_path) }
79
+ if defined?(DmCms)
80
+ if can?(:manage_content, :all)
81
+ @admin_theme[:main_menu] << {text: 'Pages', icon_class: :pages, link: dm_cms.admin_cms_pages_path, active: admin_path_active_class?(dm_cms.admin_cms_pages_path, dm_cms.admin_cms_snippets_path) }
82
+ @admin_theme[:main_menu] << {text: 'Blogs', icon_class: :blogs, link: dm_cms.admin_cms_blogs_path, active: admin_path_active_class?(dm_cms.admin_cms_blogs_path) }
83
+ end
84
+ if can?(:access_media_library, :all)
85
+ @admin_theme[:main_menu] << {text: 'Media Library', icon_class: :media_library, link: dm_cms.admin_media_files_path, active: admin_path_active_class?(dm_cms.admin_media_files_path) }
86
+ end
83
87
  end
84
88
 
85
- if defined?(DmEvent) && can?(:manage_events, :all)
89
+ if defined?(DmEvent) && can?(:access_event_section, :all)
86
90
  item = { text: 'Events', icon_class: :events, children: [], link: '#' }
87
91
  item[:children] << {text: 'Overview', link: dm_event.admin_workshops_path, active: admin_path_active_class?(dm_event.admin_workshops_path) }
88
92
  Workshop.upcoming.each do |workshop|
89
- item[:children] << {text: workshop.title, badge: workshop.registrations.number_of(:attending), link: dm_event.admin_workshop_path(workshop), active: admin_path_active_class?(dm_event.admin_workshop_path(workshop)) }
93
+ if can?(:list_events, workshop)
94
+ item[:children] << {text: workshop.title, badge: workshop.registrations.number_of(:attending), link: dm_event.admin_workshop_path(workshop), active: admin_path_active_class?(dm_event.admin_workshop_path(workshop)) }
95
+ end
90
96
  end
91
97
  @admin_theme[:main_menu] << item
92
98
  end
@@ -0,0 +1,22 @@
1
+ # Application's CanCan ability class. Engines will include their ability classes
2
+ #------------------------------------------------------------------------------
3
+ class Ability
4
+ include CanCan::Ability
5
+ include DmCore::Concerns::Ability
6
+
7
+ @@registered_abilities = []
8
+
9
+ #------------------------------------------------------------------------------
10
+ def initialize(user)
11
+ @user_roles = user.roles.all
12
+ @@registered_abilities.each {|method| self.send method, user}
13
+
14
+ dm_core_abilities(user)
15
+ end
16
+
17
+ # allows an engine to register it's ability method
18
+ #------------------------------------------------------------------------------
19
+ def self.register_abilities(method_name)
20
+ @@registered_abilities << method_name
21
+ end
22
+ end
@@ -157,6 +157,7 @@
157
157
  <%= f.input('roles[reviewer]', as: :boolean, label: 'Reviewer', input_html: {checked: @user.has_role?(:reviewer)}, hint: 'will be able to view draft versions of blog entries, as long as they are sent the correct link') %>
158
158
  <%= f.input('roles[content_manager]', as: :boolean, label: 'Content Manager', input_html: {checked: @user.has_role?(:content_manager)}, hint: 'can manage blog and static pages') if defined?(DmCms) %>
159
159
  <%= f.input('roles[event_manager]', as: :boolean, label: 'Event Manager', input_html: {checked: @user.has_role?(:event_manager)}, hint: 'can manage events and workshops') if defined?(DmEvent) %>
160
+ <%= f.input('roles[event_manager_alacarte]',as: :boolean, label: 'Individual Event Management', input_html: {checked: @user.has_role?(:event_manager_alacarte)}, hint: 'grant access to specific events only') if defined?(DmEvent) %>
160
161
  <%= f.input('roles[forum_manager]', as: :boolean, label: 'Forum Manager', input_html: {checked: @user.has_role?(:forum_manager)}, hint: 'can manage forums') if defined?(DmForum) %>
161
162
  <%= f.input('roles[course_manager]', as: :boolean, label: 'Course Manager', input_html: {checked: @user.has_role?(:course_manager)}, hint: 'can manage courses and lessons') if defined?(DmLms) %>
162
163
  <%= f.input('roles[subscription_manager]', as: :boolean, label: 'Subscription Manager', input_html: {checked: @user.has_role?(:course_manager)}, hint: 'can manage site subscriptions') if defined?(DmSubscriptions) %>
@@ -170,6 +171,22 @@
170
171
  <% end %>
171
172
  <% end %>
172
173
  <% end %>
174
+
175
+ <% if defined?(DmEvent) %>
176
+ <%= subsection title: 'Event Permissions' do %>
177
+ <form>
178
+ <div class="form-group">
179
+ <label for="exampleInputEmail1">Select a Current Workshop</label>
180
+ <select class="form-control">
181
+ <% Workshop.upcoming.each do |workshop| %>
182
+ <option><%= workshop.title %></option>
183
+ <% end %>
184
+ </select>
185
+ </div>
186
+ <button type="submit" class="btn btn-default">Grant Access</button>
187
+ </form>
188
+ <% end %>
189
+ <% end %>
173
190
  </div>
174
191
  </div>
175
192
  </div>
@@ -1,3 +1,3 @@
1
1
  module DmCore
2
- VERSION = "4.2.1.5"
2
+ VERSION = "4.2.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.1.5
4
+ version: 4.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Walker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-30 00:00:00.000000000 Z
11
+ date: 2016-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -812,6 +812,7 @@ files:
812
812
  - app/inputs/toggle_checked_input.rb
813
813
  - app/inputs/toggle_input.rb
814
814
  - app/mailers/dm_core/site_mailer.rb
815
+ - app/models/ability.rb
815
816
  - app/models/account.rb
816
817
  - app/models/activity.rb
817
818
  - app/models/address.rb
@@ -882,7 +883,6 @@ files:
882
883
  - app/views/dm_core/admin/shared/_header_stats_new_users.html.erb
883
884
  - app/views/dm_core/admin/shared/_header_stats_user_activity.html.erb
884
885
  - app/views/dm_core/admin/system/show.html.erb
885
- - app/views/dm_core/admin/users/_form.html.erb
886
886
  - app/views/dm_core/admin/users/edit.html.erb
887
887
  - app/views/dm_core/admin/users/index.html.erb
888
888
  - app/views/dm_core/profile/_profile_sidebar.html.erb
@@ -1067,7 +1067,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1067
1067
  version: '0'
1068
1068
  requirements: []
1069
1069
  rubyforge_project:
1070
- rubygems_version: 2.5.1
1070
+ rubygems_version: 2.4.5
1071
1071
  signing_key:
1072
1072
  specification_version: 4
1073
1073
  summary: Part of MokshaCms, providing core functionality
@@ -1,44 +0,0 @@
1
- <% # if a manager is trying to edit an admin account %>
2
- <% disable_fields = @user.has_role?(:admin) && !is_admin? %>
3
- <%= simple_form_for(@user, :url => dm_core.admin_user_path,
4
- html: { class: 'form-horizontal' }, wrapper: :bs3_horizontal_form, wrapper_mappings: DmAdmin::FormWrapperMappings) do |f| %>
5
-
6
- <%= f.error_notification :message => "Please review the problems below" %>
7
-
8
- <%= panel header: false do %>
9
-
10
- <%#= f.input :first_name %>
11
- <%#= f.input :last_name %>
12
- <%= f.input :email, disabled: disable_fields, hint: 'Note: If you change the email address, a confirmation email will be sent to the new address. The email
13
- address will look unchanged until it is confirmed' %>
14
- <%= f.input(:unconfirmed_email, disabled: true, hint: 'The user needs to re-confirm this email address - an email has already been sent, or
15
- you can use the Confirm This User button') if @user.unconfirmed_email %>
16
- <%#= f.input :country_id, :wrapper_html => { :class => 'searchDrop' }, :input_html => { :class => 'chosen_select' },
17
- :collection => ut_country_select_collection, :label_method => lambda {|t| t[0]}, :value_method => lambda {|t| t[1]},
18
- :label => "Country" %>
19
-
20
- <%= subsection title: 'Access Permissions' do %>
21
- <p>Choose which permissions to grant to this user</p>
22
- <% if disable_fields %>
23
- <%= f.input 'roles[admin]', as: :boolean, label: 'Administrator', input_html: {checked: @user.has_role?(:admin)}, disabled: true, hint: 'access to entire website' %>
24
- <% else %>
25
- <%= f.input('roles[reviewer]', as: :boolean, label: 'Reviewer', input_html: {checked: @user.has_role?(:reviewer)}, hint: 'will be able to view draft versions of blog entries, as long as they are sent the correct link') %>
26
- <%= f.input('roles[content_manager]', as: :boolean, label: 'Content Manager', input_html: {checked: @user.has_role?(:content_manager)}, hint: 'can manage blog and static pages') if defined?(DmCms) %>
27
- <%= f.input('roles[event_manager]', as: :boolean, label: 'Event Manager', input_html: {checked: @user.has_role?(:event_manager)}, hint: 'can manage events and workshops') if defined?(DmEvent) %>
28
- <%= f.input('roles[forum_manager]', as: :boolean, label: 'Forum Manager', input_html: {checked: @user.has_role?(:forum_manager)}, hint: 'can manage forums') if defined?(DmForum) %>
29
- <%= f.input('roles[course_manager]', as: :boolean, label: 'Course Manager', input_html: {checked: @user.has_role?(:course_manager)}, hint: 'can manage courses and lessons') if defined?(DmLms) %>
30
- <%= f.input('roles[subscription_manager]', as: :boolean, label: 'Subscription Manager', input_html: {checked: @user.has_role?(:course_manager)}, hint: 'can manage site subscriptions') if defined?(DmSubscriptions) %>
31
- <%#= f.input 'roles[newsletter_manager]', as: :boolean, label: 'Newsletter Manager', input_html: {checked: @user.has_role?(:newsletter_manager)}, hint: 'can manage newsletters' %>
32
- <hr>
33
- <%= f.input 'roles[manager]', as: :boolean, label: 'Manager', input_html: {checked: @user.has_role?(:manager)}, hint: 'can manage all areas except for global account settings and deleting users' %>
34
- <% if is_admin? %>
35
- <%= f.input 'roles[admin]', as: :boolean, label: 'Administrator', input_html: {checked: @user.has_role?(:admin)}, hint: 'access to entire website' %>
36
- <% end %>
37
- <% end %>
38
- <% end %>
39
-
40
- <%= submit_or_cancel :cancel_url => dm_core.admin_users_url %>
41
-
42
- <% end %>
43
-
44
- <% end %>