diff --git a/app/controllers/admin/announcements_controller.rb b/app/controllers/admin/announcements_controller.rb
index 656b46e..67f2b1d 100644
--- a/app/controllers/admin/announcements_controller.rb
+++ b/app/controllers/admin/announcements_controller.rb
@@ -23,8 +23,7 @@ class Admin::AnnouncementsController < OrbitAdminController
end
def new
- @tags =@module_app.tags
- @categories = @module_app.categories.enabled
+ @tags = @module_app.tags
@statuses = []
@bulletin = Bulletin.new
@bulletin.email_sentdate = Time.now
@@ -46,10 +45,14 @@ class Admin::AnnouncementsController < OrbitAdminController
end
def edit
- @tags =@module_app.tags
- @categories = @module_app.categories.enabled
- @statuses = []
- @bulletin.email_sentdate = Time.now if @bulletin.email_sent == false
+ if can_edit_or_delete?(@bulletin)
+ @tags = @module_app.tags
+ @categories = @module_app.categories.enabled
+ @statuses = []
+ @bulletin.email_sentdate = Time.now if @bulletin.email_sent == false
+ else
+ render_401
+ end
end
def update
diff --git a/app/views/admin/announcements/_index.html.erb b/app/views/admin/announcements/_index.html.erb
index 2af3121..dd45318 100644
--- a/app/views/admin/announcements/_index.html.erb
+++ b/app/views/admin/announcements/_index.html.erb
@@ -19,9 +19,11 @@
<%= b.title %>
diff --git a/lib/announcement/engine.rb b/lib/announcement/engine.rb
index c6db1d5..174c9ad 100644
--- a/lib/announcement/engine.rb
+++ b/lib/announcement/engine.rb
@@ -14,7 +14,7 @@ module Announcement
side_bar do
head_label_i18n 'announcement.announcement', icon_class: "icons-megaphone"
- available_for [:admin,:manager,:sub_manager]
+ available_for "users"
active_for_controllers (['admin/announcements'])
head_link_path "admin_announcements_path"
@@ -22,26 +22,26 @@ module Announcement
:link_path=>"admin_announcements_path" ,
:priority=>1,
:active_for_action=>{'admin/announcements'=>'index'},
- :available_for => [:all]
+ :available_for => 'users'
context_link 'new_',
:link_path=>"new_admin_announcement_path" ,
:priority=>2,
:active_for_action=>{'admin/announcements'=>'new'},
- :available_for => [:sub_manager]
+ :available_for => 'sub_managers'
context_link 'categories',
:link_path=>"admin_module_app_categories_path" ,
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'announcement').id}",
:priority=>3,
:active_for_action=>{'admin/announcements'=>'categories'},
:active_for_category => 'Announcement',
- :available_for => [:manager]
+ :available_for => 'managers'
context_link 'tags',
:link_path=>"admin_module_app_tags_path" ,
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'announcement').id}",
:priority=>4,
:active_for_action=>{'admin/announcements'=>'tags'},
:active_for_tag => 'Announcement',
- :available_for => [:manager]
+ :available_for => 'managers'
end
end