diff --git a/app/controllers/admin/module_apps_controller.rb b/app/controllers/admin/module_apps_controller.rb index 13075a42..e44be291 100644 --- a/app/controllers/admin/module_apps_controller.rb +++ b/app/controllers/admin/module_apps_controller.rb @@ -2,7 +2,7 @@ class Admin::ModuleAppsController < ApplicationController before_filter :user_has_manager_privilege?, :only => [ :assign_manager, :remove_manager ] before_filter :user_has_sub_manager_privilege?, :only => [ :assign_sub_manager, :remove_sub_manager ] - layout "admin" + layout "new_admin" def index @module_apps = ModuleApp.all.entries diff --git a/app/controllers/admin/object_auths_controller.rb b/app/controllers/admin/object_auths_controller.rb index e8779dc4..ab343360 100644 --- a/app/controllers/admin/object_auths_controller.rb +++ b/app/controllers/admin/object_auths_controller.rb @@ -1,6 +1,6 @@ class Admin::ObjectAuthsController < ApplicationController include OrbitCoreLib::PermissionUnility - layout "admin" + layout "new_admin" before_filter :force_order # before_filter :is_admin? ,:only => :index diff --git a/app/helpers/admin/module_app_helper.rb b/app/helpers/admin/module_app_helper.rb index 0a636e9c..3ac82364 100644 --- a/app/helpers/admin/module_app_helper.rb +++ b/app/helpers/admin/module_app_helper.rb @@ -14,6 +14,7 @@ module Admin::ModuleAppHelper end def get_auth_by(manager_obj) - "-AuthBy: " +( manager_obj.rule_creator==current_user ? t('me') : manager_obj.rule_creator.name) + showing_name = manager_obj.rule_creator==current_user ? t('me') : manager_obj.rule_creator.name + t("admin.user_role.auth.auth_by",:user_display_name => showing_name) end end diff --git a/app/views/admin/components/_user_role_management.html.erb b/app/views/admin/components/_user_role_management.html.erb index cd9ca8ae..6c8e0636 100644 --- a/app/views/admin/components/_user_role_management.html.erb +++ b/app/views/admin/components/_user_role_management.html.erb @@ -1,21 +1,21 @@
-

All User

+

<%= t("admin.user_role.auth.all_member") %>

<%= form_tag(submit_url) do %> - <%= check_box_tag 'auth_all',true,(auth.all rescue true) %><%= submit_tag 'Add Role' %>
+ <%= check_box_tag 'auth_all',true,(auth.all rescue true) %><%= submit_tag t("admin.user_role.auth.all_member") %>
<% end %>
-

User Role

+

<%= t("admin.user_role.auth.user") %>

<%= form_tag(submit_url) do %> <%= collection_select(:new,:role, Role.all, :id, :key, :prompt => true) %> - <%= submit_tag 'Add Role' %>
+ <%= submit_tag t("admin.user_role.auth.by_role") %>
<%= collection_select(:new,:sub_role, SubRole.all, :id, :key, :prompt => true) %> - <%= submit_tag 'Add SubRole' %>
+ <%= submit_tag t("admin.user_role.auth.by_sub_role") %>
<%= collection_select(:new,:privilege_user, User.all, :id, :name, :prompt => true) %> - <%= submit_tag 'Add PrivilegeList' %>
+ <%= submit_tag t("admin.user_role.auth.add_to_privilege_list") %>
<%= collection_select(:new,:blocked_user, User.all, :id, :name, :prompt => true) %> - <%= submit_tag 'Add BlockedList' %>
+ <%= submit_tag t("admin.user_role.auth.add_to_block_list") %>
<% end %> <% unless auth.nil? %> <% auth.roles.each do |role| %> diff --git a/app/views/admin/module_apps/edit.html.erb b/app/views/admin/module_apps/edit.html.erb index 23745806..52142fea 100644 --- a/app/views/admin/module_apps/edit.html.erb +++ b/app/views/admin/module_apps/edit.html.erb @@ -1,37 +1,30 @@ <% content_for :secondary do %> <% end %> - -
-
-
- -

<%= @module_app.title %>

+

<%= @module_app.title%>

-

Manager

-
-
Manager +
<%= t("admin.user_role.auth.manager") %> <% @module_app.managers.each do |manager| %>
<%= manager.user.name %> <%= get_auth_by(manager) %> <%= link_to '[X]',remove_manager_admin_module_app_path(@module_app,manager),:method => :delete if if_permit_to_delete(:manager) && manager.user != current_user %>
<% end %> -
Add: +
<%= form_tag(assign_manager_admin_module_app_path) do %> <%= collection_select(:manager,:id, User.all, :id, :name, :prompt => true,:disabled => !if_permit_to_assign(:manager))%> - <%= submit_tag 'Add Manager' %> + <%= submit_tag t("admin.user_role.auth.add_manager") %> <% end %>
-
Sub Manager +
<%= t("admin.user_role.auth.sub_manager") %> <% @module_app.sub_managers.each do |manager| %> -
<%= manager.user.name %> -AuthBy:<%= manager.rule_creator.name %> <%= link_to '[X]',remove_sub_manager_admin_module_app_path(@module_app,manager),:method => :delete if if_permit_to_delete(:sub_manager) && manager.user != current_user %>
+
<%= manager.user.name %> <%= get_auth_by(manager) %><%= link_to '[X]',remove_sub_manager_admin_module_app_path(@module_app,manager),:method => :delete if if_permit_to_delete(:sub_manager) && manager.user != current_user %>
<% end %> -
Add: +
<%= form_tag(assign_sub_manager_admin_module_app_path) do %> <%= collection_select(:sub_manager,:id, User.all, :id, :name, :prompt => true,:disabled => !if_permit_to_assign(:sub_manager))%> - <%= submit_tag 'Add Sub Manager' %> + <%= submit_tag t("admin.user_role.auth.add_sub_manager") %> <% end %>
diff --git a/app/views/admin/object_auths/edit.html.erb b/app/views/admin/object_auths/edit.html.erb index fc824a64..3c391ef9 100644 --- a/app/views/admin/object_auths/edit.html.erb +++ b/app/views/admin/object_auths/edit.html.erb @@ -1,11 +1,6 @@ <% content_for :secondary do %> <% end %> - -
-
-
-

<%= @object_auth.title %>

<%= render :partial => "admin/components/user_role_management", :locals => { diff --git a/app/views/layouts/_side_bar.html.erb b/app/views/layouts/_side_bar.html.erb index e740fe7b..96e0e2a8 100644 --- a/app/views/layouts/_side_bar.html.erb +++ b/app/views/layouts/_side_bar.html.erb @@ -2,7 +2,7 @@ <%#= link_to content_tag(:i, nil, :class => 'icons-purchase') + t('admin.purchase'), admin_purchases_path %> <%# end -%> -<%= content_tag :li, :class => active_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals') do -%> +<%= content_tag :li, :class => active_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys','module_apps', 'approvals') do -%> <%= link_to content_tag(:i, nil, :class => 'icons-announcement') + t('admin.announcement'), panel_announcement_back_end_bulletins_path %> <%= content_tag :ul, :class => ("nav nav-list " + visible_for_controllers('bulletins', '/panel/announcement/back_end/tags', 'bulletin_categorys', 'approvals')) do -%> <%= content_tag :li, link_to(t('announcement.all_articles'), panel_announcement_back_end_bulletins_path), :class => active_for_action('bulletins', 'index') %> @@ -10,6 +10,8 @@ <%= content_tag :li, link_to(t('announcement.categories'), panel_announcement_back_end_bulletin_categorys_path), :class => active_for_action('bulletin_categorys', 'index') %> <%= content_tag :li, link_to(t('announcement.tags'), panel_announcement_back_end_tags_path), :class => active_for_action('/panel/announcement/back_end/tags', 'index') %> <%= content_tag :li, link_to(t('announcement.bulletin.approval_setting'), panel_announcement_back_end_approval_setting_path), :class => active_for_action('approvals', 'setting') if (is_manager? rescue nil) %> + <%= content_tag :li, link_to(t('admin.module.authorization'),edit_admin_module_app_path(ModuleApp.first(conditions: {title: "Announcement"}))), :class => active_for_action('module_apps', 'edit') if (is_admin? rescue nil) %> + <% end -%> <% end -%> diff --git a/config/locales/en.yml b/config/locales/en.yml index 8564c364..76a94b68 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -125,6 +125,8 @@ en: list_infos: User information list list_roles: User roles list member: Member + module: + authorization: Module Authorization move_down: Move down move_up: Move up multilingual: Multilingual @@ -177,6 +179,20 @@ en: upload_design: Upload design url: URL user: User + user_role: + auth: + all_member: All Member + manager: Manager + sub_mamanger: SubManager + by_role: By Role + by_sub_role: By SubRole + block_list: Block List + privilege_list: Privilege List + add_manager: Add Manager + add_sub_manager: Add SubManager + add_to_block_list: Add to block List + add_to_privilege_list: Add to privilege List + auth_by: -AuthBy %{user_display_name} info: User information panel: User panel role: User role diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index af36d7bc..b5577f8a 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -98,7 +98,7 @@ zh_tw: editing_page: 編輯頁面 editing_snippet: 編輯片段 editing_info: 編輯用戶資料 - editing_role: 編輯用戶角色 + editing_role: 編輯用戶身份 email: Email enable_language: 啟用語言 file_name: 檔名 @@ -123,8 +123,10 @@ zh_tw: list_snippets: 斷片列表 list_users: 使用列表 list_infos: 用戶資料列表 - list_roles: 用戶角色列表 + list_roles: 用戶身份列表 member: 會員 + module: + authorization: 模組授權 move_down: 往下移 move_up: 往上移 multilingual: 多種語言 @@ -143,7 +145,7 @@ zh_tw: new_snippet: 新增片段 new_user: 新增使用 new_info: 新增用戶資料 - new_role: 新增用戶角色 + new_role: 新增用戶身份 non_multilingual: 非多種語言 options: 選項 orig_upload_file: 原上傳檔名 @@ -151,8 +153,8 @@ zh_tw: position: 位置 published?: 發布? purchase: 購買 - role: 角色 - roles: 角色 + role: 身份 + roles: 身份 site_settings: 基本設定 setup_member: 成員設置 setup_translations: 語系設定 @@ -177,9 +179,23 @@ zh_tw: upload_design: 上傳設計 url: URL user: 用戶 + user_role: + auth: + all_member: 所有會員 + manager: 管理員 + sub_manager: 次管理員 + by_role: 根據身份 + by_sub_role: 根據次身份 + block_list: 封鎖名單 + add_manager: 增加到管理員 + add_sub_manager: 增加到次管理員 + add_to_block_list: 封鎖名單 + add_to_privilege_list: 特許名單 + auth_by: -由%{user_display_name}授權 + user: 使用會員 info: 用戶資料 panel: 用戶面板 - role: 用戶角色 + role: 用戶身份 panel: diff --git a/lib/orbit_core_lib.rb b/lib/orbit_core_lib.rb index bcde17e0..b92f4eca 100644 --- a/lib/orbit_core_lib.rb +++ b/lib/orbit_core_lib.rb @@ -19,6 +19,10 @@ module OrbitCoreLib end + def get_object_auth_by_title(title) + self.object_auths.where({title: title }).first + end + def authed_users(title=nil) users = [] users = case title @@ -33,7 +37,7 @@ module OrbitCoreLib [] end else - self.object_auths.where(title: title).first.auth_users rescue [] + get_object_auth_by_title(title).auth_users rescue [] end users end diff --git a/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletin_categorys_helper.rb b/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletin_categorys_helper.rb new file mode 100644 index 00000000..27dbe8f0 --- /dev/null +++ b/vendor/built_in_modules/announcement/app/helpers/panel/announcement/back_end/bulletin_categorys_helper.rb @@ -0,0 +1,14 @@ +module Panel::Announcement::BackEnd::BulletinCategorysHelper +include ActionView::Helpers::UrlHelper + + + def show_submit_permission_link(bulletin_category) + oa = bulletin_category.get_object_auth_by_title('submit') + if oa.nil? + bulletin_category.object_auths.new(title: 'submit' ).save + oa = bulletin_category.get_object_auth_by_title('submit') + end + link_to t('announcement.bulletin.cate_auth'), edit_admin_object_auth_path(oa) + end + +end \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/_modal_list.html.erb b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/_modal_list.html.erb index 0885ea65..e51a11d6 100644 --- a/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/_modal_list.html.erb +++ b/vendor/built_in_modules/announcement/app/views/panel/announcement/back_end/approvals/_modal_list.html.erb @@ -7,7 +7,7 @@