fix app sub manager and ask verification code

This commit is contained in:
Spen 2013-11-07 12:13:16 +08:00 committed by Manson Wang
parent b3894c4ada
commit 3ec3479d66
7 changed files with 25 additions and 4 deletions

View File

@ -15,8 +15,13 @@ class ObjectAuth < PrototypeAuth
end
def check_user_has_can_access_app
if auth_obj["_type"] == "PageContext"
module_app = ModuleApp.where(:key=>'page_content').first
sub_managing_users = module_app.sub_managing_users rescue []
else
sub_managing_users = auth_obj.module_app.sub_managing_users rescue []
module_app = auth_obj.module_app
end
self.auth_users.each do |auth_user|
if !sub_managing_users.include? auth_user && !auth_user.admin?
module_app.assign_sub_manager(auth_user,User.current)

View File

@ -55,6 +55,16 @@ class PrototypeAuth
if (self.send item).include? obj.id
(self.send item).delete obj.id
self.save!
if auth_obj["_type"] == "PageContext"
module_app = ModuleApp.where(:key=>'page_content').first
else
module_app = auth_obj.module_app
end
module_app.remove_sub_manager(obj)
module_app.save
else
false #should put error message for user not existed in list
end

View File

@ -85,7 +85,9 @@ $(document).ready(function(){
</div>
</div>
<div class="control-group">
<%= f.label t('ask.validate_code'), class: 'control-label required' %>
<div class="controls">
<label><%= t('ask.validate_code_note') %></label>
<%= gotcha_error %>
<%= gotcha%>
</div>

View File

@ -18,6 +18,8 @@ en:
admin: Administrator
new_question: New question
pending: Pending
validate_code: Verification code
validate_code_note: Please answer the following verification questions.
mongoid:
attributes:
ask_question:

View File

@ -23,6 +23,8 @@ zh_tw:
admin: 管理者
new_question: 新的發問
pending: 待處理
validate_code: 驗證碼
validate_code_note: 請回答下列驗證問句。
mongoid:
attributes:
ask_question:

View File

@ -2,7 +2,7 @@ class Panel::PageContent::BackEnd::PageContextsController < OrbitBackendControll
before_filter :force_order_for_visitor,:only=>[:index]
before_filter :force_order_for_user,:except => [:index]
before_filter :for_app_manager,:except => [:index]
# before_filter :for_app_manager,:except => [:index]
before_filter :for_app_sub_manager,:except => [:index]
#before_filter :is_admin?

View File

@ -4,7 +4,7 @@
<%= page_context.page.title %>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<%if is_manager? || is_admin? || page_context.authed_users(:edit).include?(current_user)%>
<%if is_manager? || is_admin? || page_context.authed_users("Edit").include?(current_user)%>
<li><%= link_to t(:edit), edit_panel_page_content_back_end_page_context_path(page_context, page: params[:page], sort: params[:sort], direction: params[:direction], sort_options: params[:sort_options]) %></li>
<%if (is_manager? || is_admin?) %>
<li><%=show_page_context_edit_auth_link page_context%></li>