Add tag support and permission checks for signups, destroy and agreements
This commit is contained in:
1 parent
806bb862c2
commit
c68438a9cf
5 files changed
+24
No files matched your search
@@ -1,4 +1,5 @@
|
||||
class Admin::ActiveAgreementsController < OrbitAdminController
|
||||
before_action :check_manager_for_agreement, only: [:update]
|
||||
|
||||
def initialize
|
||||
super
|
||||
@@ -16,5 +17,11 @@ class Admin::ActiveAgreementsController < OrbitAdminController
|
||||
|
||||
redirect_to admin_active_agreements_path, notice: t('act.save_success')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def check_manager_for_agreement
|
||||
render_401 unless allow?(['managers', 'admin'])
|
||||
end
|
||||
|
||||
end
|
||||
@@ -2,6 +2,7 @@
|
||||
class Admin::ActiveSignupsController < OrbitAdminController
|
||||
include Admin::ActivesHelper
|
||||
before_action ->(module_app = @app_title) { set_variables module_app }
|
||||
before_action :check_permission_for_act_signup, only: [:edit, :update, :destroy]
|
||||
|
||||
def initialize
|
||||
super
|
||||
@@ -41,4 +42,10 @@ class Admin::ActiveSignupsController < OrbitAdminController
|
||||
def act_signup_params
|
||||
params.require(:act_signup).permit!
|
||||
end
|
||||
|
||||
def check_permission_for_act_signup
|
||||
@act_signup = ActSignup.find(params[:id])
|
||||
@act = Act.find(@act_signup.act_id)
|
||||
render_401 unless can_see_act_signup(@act)
|
||||
end
|
||||
end
|
||||
@@ -81,6 +81,7 @@ class Admin::ActivesController < OrbitAdminController
|
||||
end
|
||||
|
||||
def destroy
|
||||
return render_401 unless can_edit_or_delete?(@act)
|
||||
@act.destroy
|
||||
redirect_to "/admin/actives"
|
||||
end
|
||||
|
||||
@@ -6,6 +6,7 @@ class Act
|
||||
# encoding: utf-8
|
||||
|
||||
include OrbitCategory::Categorizable
|
||||
include OrbitTag::Taggable
|
||||
include Slug
|
||||
|
||||
include OrbitModel::Status
|
||||
|
||||
@@ -7,6 +7,7 @@ module Active
|
||||
widget_methods ["widget","widget1"]
|
||||
widget_settings [{"data_count"=>10}]
|
||||
authorizable
|
||||
taggable "Act"
|
||||
categorizable
|
||||
frontend_enabled
|
||||
data_count 1..20
|
||||
@@ -34,6 +35,13 @@ module Active
|
||||
:active_for_action=>{'admin/actives'=>'categories'},
|
||||
:active_for_category => 'Active',
|
||||
:available_for => 'managers'
|
||||
context_link 'tags',
|
||||
:link_path=>"admin_module_app_tags_path" ,
|
||||
:link_arg=>"{:module_app_id=>ModuleApp.find_by(:key=>'active').id}",
|
||||
:priority=>4,
|
||||
:active_for_action=>{'admin/actives'=>'tags'},
|
||||
:active_for_tag => 'Active',
|
||||
:available_for => 'managers'
|
||||
context_link 'act.set_active_agreements',
|
||||
:link_path=>"admin_active_agreements_path" ,
|
||||
:priority=>3,
|
||||
|
||||
Reference in new issue
Block a user