fix app sub manager and ask verification code
This commit is contained in:
parent
8f25dc2871
commit
d1fd2b6984
|
@ -15,8 +15,13 @@ class ObjectAuth < PrototypeAuth
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_user_has_can_access_app
|
def check_user_has_can_access_app
|
||||||
sub_managing_users = auth_obj.module_app.sub_managing_users rescue []
|
if auth_obj["_type"] == "PageContext"
|
||||||
module_app = auth_obj.module_app
|
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|
|
self.auth_users.each do |auth_user|
|
||||||
if !sub_managing_users.include? auth_user && !auth_user.admin?
|
if !sub_managing_users.include? auth_user && !auth_user.admin?
|
||||||
module_app.assign_sub_manager(auth_user,User.current)
|
module_app.assign_sub_manager(auth_user,User.current)
|
||||||
|
|
|
@ -55,6 +55,16 @@ class PrototypeAuth
|
||||||
if (self.send item).include? obj.id
|
if (self.send item).include? obj.id
|
||||||
(self.send item).delete obj.id
|
(self.send item).delete obj.id
|
||||||
self.save!
|
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
|
else
|
||||||
false #should put error message for user not existed in list
|
false #should put error message for user not existed in list
|
||||||
end
|
end
|
||||||
|
|
|
@ -85,7 +85,9 @@ $(document).ready(function(){
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
|
<%= f.label t('ask.validate_code'), class: 'control-label required' %>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
|
<label><%= t('ask.validate_code_note') %></label>
|
||||||
<%= gotcha_error %>
|
<%= gotcha_error %>
|
||||||
<%= gotcha%>
|
<%= gotcha%>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -18,6 +18,8 @@ en:
|
||||||
admin: Administrator
|
admin: Administrator
|
||||||
new_question: New question
|
new_question: New question
|
||||||
pending: Pending
|
pending: Pending
|
||||||
|
validate_code: Verification code
|
||||||
|
validate_code_note: Please answer the following verification questions.
|
||||||
mongoid:
|
mongoid:
|
||||||
attributes:
|
attributes:
|
||||||
ask_question:
|
ask_question:
|
||||||
|
|
|
@ -23,6 +23,8 @@ zh_tw:
|
||||||
admin: 管理者
|
admin: 管理者
|
||||||
new_question: 新的發問
|
new_question: 新的發問
|
||||||
pending: 待處理
|
pending: 待處理
|
||||||
|
validate_code: 驗證碼
|
||||||
|
validate_code_note: 請回答下列驗證問句。
|
||||||
mongoid:
|
mongoid:
|
||||||
attributes:
|
attributes:
|
||||||
ask_question:
|
ask_question:
|
||||||
|
|
|
@ -2,7 +2,7 @@ class Panel::PageContent::BackEnd::PageContextsController < OrbitBackendControll
|
||||||
before_filter :force_order_for_visitor,:only=>[:index]
|
before_filter :force_order_for_visitor,:only=>[:index]
|
||||||
before_filter :force_order_for_user,:except => [: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 :for_app_sub_manager,:except => [:index]
|
||||||
|
|
||||||
#before_filter :is_admin?
|
#before_filter :is_admin?
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<%= page_context.page.title %>
|
<%= page_context.page.title %>
|
||||||
<div class="quick-edit">
|
<div class="quick-edit">
|
||||||
<ul class="nav nav-pills hide">
|
<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>
|
<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?) %>
|
<%if (is_manager? || is_admin?) %>
|
||||||
<li><%=show_page_context_edit_auth_link page_context%></li>
|
<li><%=show_page_context_edit_auth_link page_context%></li>
|
||||||
|
|
Loading…
Reference in New Issue