diff --git a/app/helpers/dmsf_folder_permissions_helper.rb b/app/helpers/dmsf_folder_permissions_helper.rb index 29a8bed9..710ae176 100644 --- a/app/helpers/dmsf_folder_permissions_helper.rb +++ b/app/helpers/dmsf_folder_permissions_helper.rb @@ -21,10 +21,11 @@ module DmsfFolderPermissionsHelper - def users_checkboxes(users) + def users_checkboxes(users, inherited = false) s = '' + id = inherited ? 'inherited_permissions[user_ids][]' : 'permissions[user_ids][]' users.each do |user| - content = check_box_tag('permissions[user_ids][]', user.id, true, id: nil) + user.name + content = check_box_tag(id, user.id, true, disabled: inherited, id: nil) + user.name s << content_tag(:label, content, id: "user_permission_ids_#{user.id}", class: 'inline') end s.html_safe diff --git a/app/models/dmsf_folder.rb b/app/models/dmsf_folder.rb index 5196b5f8..af1010ea 100644 --- a/app/models/dmsf_folder.rb +++ b/app/models/dmsf_folder.rb @@ -536,6 +536,19 @@ class DmsfFolder < ActiveRecord::Base Principal.active.where(id: self.dmsf_folder_permissions.users.map{ |p| p.object_id }) end + def inherited_permissions_from + folder = self.dmsf_folder + if folder + if folder.dmsf_folder_permissions.any? + folder + else + folder.inherited_permissions_from + end + else + nil + end + end + private def self.directory_subtree(tree, folder, level, current_folder) diff --git a/app/views/dmsf/edit.html.erb b/app/views/dmsf/edit.html.erb index 08c4083e..5ef66825 100644 --- a/app/views/dmsf/edit.html.erb +++ b/app/views/dmsf/edit.html.erb @@ -75,6 +75,28 @@ <%= f.text_area :description, :rows => 8, :class => 'wiki-edit' %>
+ <% dir = @folder.inherited_permissions_from %>
+ <% if dir %>
+ <%= label_tag '', l(:label_inherited_permissions) %>
+ <% Role.givable.each do |role| %>
+ <% checked = dir.permission_for_role(role) %>
+ <% if checked %>
+
+ <% end %>
+ <% end %>
+
+
+ <% users = dir.permissions_users %>
+ <% checkboxes = users_checkboxes(users, true) %>
+ <%= checkboxes %>
+
+ <% if checkboxes.present? %>
+
+ <% end %>
+ <% end %>
<%= label_tag '', l(:label_permissions) %>
<% Role.givable.each do |role| %>
<% checked = @folder.permission_for_role(role) %>
diff --git a/config/locales/cs.yml b/config/locales/cs.yml
index 81794e60..53797f11 100644
--- a/config/locales/cs.yml
+++ b/config/locales/cs.yml
@@ -411,6 +411,8 @@ cs:
text_dmsf_fast_links_info: Při vytváření odkazů budete moci zadat přímo ID cílového adresáře za účelem zrychlení
procesu vytváření odkazů.
+ label_inherited_permissions: Zděděná práva
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 416af57c..d984ce46 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -411,6 +411,8 @@ de:
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
up the process of creating links.
+ label_inherited_permissions: Inherited permissions
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/en.yml b/config/locales/en.yml
index f1c9a6ce..43c38546 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -411,6 +411,8 @@ en:
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
up the process of creating links.
+ label_inherited_permissions: Inherited permissions
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/es.yml b/config/locales/es.yml
index b65f96b8..dbf1f949 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -411,6 +411,8 @@ es:
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
up the process of creating links.
+ label_inherited_permissions: Inherited permissions
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 7cb17967..42150712 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -411,6 +411,8 @@ fr:
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
up the process of creating links.
+ label_inherited_permissions: Inherited permissions
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/hu.yml b/config/locales/hu.yml
index f667901b..c0777708 100644
--- a/config/locales/hu.yml
+++ b/config/locales/hu.yml
@@ -411,6 +411,8 @@ hu:
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
up the process of creating links.
+ label_inherited_permissions: Inherited permissions
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/it.yml b/config/locales/it.yml
index bcf1ca80..91af7f42 100644
--- a/config/locales/it.yml
+++ b/config/locales/it.yml
@@ -411,6 +411,8 @@ it: # Italian strings thx 2 Matteo Arceci!
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
up the process of creating links.
+ label_inherited_permissions: Inherited permissions
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/ja.yml b/config/locales/ja.yml
index 3c16e538..6aba3553 100644
--- a/config/locales/ja.yml
+++ b/config/locales/ja.yml
@@ -410,6 +410,9 @@ ja:
label_dmsf_fast_links: 高速リンク
text_dmsf_fast_links_info: ターゲットフォルダのIDを手動で入力することで、リンク作成時のプロセスを高速化することができます。
+
+ label_inherited_permissions: Inherited permissions
+
easy_pages:
modules:
dmsf_locked_documents: 自分がロック中の文書
diff --git a/config/locales/ko.yml b/config/locales/ko.yml
index 9e2ca321..2cd279d4 100644
--- a/config/locales/ko.yml
+++ b/config/locales/ko.yml
@@ -411,6 +411,8 @@ ko:
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
up the process of creating links.
+ label_inherited_permissions: Inherited permissions
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/nl.yml b/config/locales/nl.yml
index 7d4454cc..7871b2c1 100644
--- a/config/locales/nl.yml
+++ b/config/locales/nl.yml
@@ -411,6 +411,8 @@ nl:
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
up the process of creating links.
+ label_inherited_permissions: Inherited permissions
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/pl.yml b/config/locales/pl.yml
index ed2dcad0..2a2e068e 100644
--- a/config/locales/pl.yml
+++ b/config/locales/pl.yml
@@ -168,7 +168,6 @@ pl:
permission_email_documents: Email documents
label_file: Plik
field_folder: Folder
-
error_file_commit_require_uploaded_file: Commit pliku wymaga jego uprzedniego przesłania
warning_some_files_were_not_commited: "Niektóre pliki nie zostały zacommitowane ze względu na błędy walidacji:
@@ -412,6 +411,8 @@ pl:
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
up the process of creating links.
+ label_inherited_permissions: Inherited permissions
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml
index 6ad58e5b..1a1bfd25 100644
--- a/config/locales/pt-BR.yml
+++ b/config/locales/pt-BR.yml
@@ -411,6 +411,8 @@ pt-BR:
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
up the process of creating links.
+ label_inherited_permissions: Inherited permissions
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/ru.yml b/config/locales/ru.yml
index 4c5d4678..b669d5cb 100644
--- a/config/locales/ru.yml
+++ b/config/locales/ru.yml
@@ -411,6 +411,8 @@ ru:
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
up the process of creating links.
+ label_inherited_permissions: Inherited permissions
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/sl.yml b/config/locales/sl.yml
index 0baa95a8..35d15677 100644
--- a/config/locales/sl.yml
+++ b/config/locales/sl.yml
@@ -411,6 +411,8 @@ sl:
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
up the process of creating links.
+ label_inherited_permissions: Inherited permissions
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml
index 26de66b7..7bcfc233 100644
--- a/config/locales/zh-TW.yml
+++ b/config/locales/zh-TW.yml
@@ -411,6 +411,8 @@ zh-TW:
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
up the process of creating links.
+ label_inherited_permissions: Inherited permissions
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index b8b2202d..3a04fad8 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -168,7 +168,6 @@ zh:
permission_email_documents: Email documents
label_file: 文件
field_folder: 件夹
- error_contains_invalid_character: 含有无效字符
error_file_commit_require_uploaded_file: 文件提交要求上传文件
warning_some_files_were_not_commited: "某些文件因验证错误未能被提交: %{files}"
@@ -412,6 +411,8 @@ zh:
text_dmsf_fast_links_info: You will be able to manually enter a target folder's ID when creating links in order to speed
up the process of creating links.
+ label_inherited_permissions: Inherited permissions
+
easy_pages:
modules:
dmsf_locked_documents: My locked documents