Add key in module_app.rb to use instead of title for authorization
This commit is contained in:
parent
7f999f20ab
commit
762c2f5e8a
|
@ -7,7 +7,7 @@ class ApplicationController < ActionController::Base
|
|||
before_filter :set_locale, :set_site
|
||||
|
||||
def front_end_available(module_app_title='')
|
||||
app_controller = ModuleApp.first(conditions: {:title => module_app_title} )
|
||||
app_controller = ModuleApp.first(conditions: {:key => module_app_title} )
|
||||
unless app_controller.enable_frontend?
|
||||
render :nothing => true
|
||||
end
|
||||
|
|
|
@ -2,6 +2,7 @@ class ModuleApp
|
|||
include Mongoid::Document
|
||||
include Mongoid::Timestamps
|
||||
|
||||
field :key
|
||||
field :title
|
||||
field :version
|
||||
field :organization
|
||||
|
@ -19,6 +20,8 @@ class ModuleApp
|
|||
|
||||
has_one :app_auth,dependent: :delete
|
||||
|
||||
before_save :set_key
|
||||
|
||||
def managing_users
|
||||
self.managers.collect{ |t| t.user }
|
||||
end
|
||||
|
@ -61,8 +64,10 @@ class ModuleApp
|
|||
end
|
||||
end
|
||||
|
||||
field :app_pages ,type: Array
|
||||
protected
|
||||
|
||||
has_one :app_auth,dependent: :delete
|
||||
def set_key
|
||||
self.key = self.title.underscore if self.title
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -105,7 +105,8 @@ namespace :dev do
|
|||
|
||||
home = Page.create!( :i18n_variable_id => var_10.id, :design_id => design_1.id, :name => 'home', :is_published => true, :theme_id => theme.id )
|
||||
home.page_parts.create!( :name => 'content_1', :content => File.open("#{Rails.root}/lib/template/home.page").read, :kind => 'text', :i18n_variable_id => var_13.id )
|
||||
ModuleApp.create.from_json(File.open("#{Rails.root}/vendor/built_in_modules/new_blog/new_blog.json").read).save
|
||||
ModuleApp.new.from_json(File.open("#{Rails.root}/vendor/built_in_modules/new_blog/new_blog.json").read).save
|
||||
ModuleApp.new.from_json(File.open("#{Rails.root}/vendor/built_in_modules/announcement/announcement.json").read).save
|
||||
Post.create(:title=>"1st post",:body=>"Long long time ago.....")
|
||||
Post.create(:title=>"2ec post",:body=>"And?.....")
|
||||
|
||||
|
|
|
@ -6,5 +6,6 @@
|
|||
"intro": "A simple blog……",
|
||||
"update_info": "Some info",
|
||||
"create_date": "11-11-2011",
|
||||
"app_pages": ["/panel/announcement/front_end/"]
|
||||
"app_pages": ["/panel/announcement/front_end/"],
|
||||
"enable_frontend": true
|
||||
}
|
||||
|
|
Reference in New Issue