]> source.dussan.org Git - redmine.git/commitdiff
Ask for confirmation when a non-admin users tries to remove himself from a project...
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 26 Dec 2009 15:46:12 +0000 (15:46 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 26 Dec 2009 15:46:12 +0000 (15:46 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3249 e93f8b46-1217-0410-a6f0-8f06a7374b81

38 files changed:
app/models/member.rb
app/views/projects/settings/_members.rhtml
config/locales/bg.yml
config/locales/bs.yml
config/locales/ca.yml
config/locales/cs.yml
config/locales/da.yml
config/locales/de.yml
config/locales/el.yml
config/locales/en.yml
config/locales/es.yml
config/locales/fi.yml
config/locales/fr.yml
config/locales/gl.yml
config/locales/he.yml
config/locales/hu.yml
config/locales/id.yml
config/locales/it.yml
config/locales/ja.yml
config/locales/ko.yml
config/locales/lt.yml
config/locales/nl.yml
config/locales/no.yml
config/locales/pl.yml
config/locales/pt-BR.yml
config/locales/pt.yml
config/locales/ro.yml
config/locales/ru.yml
config/locales/sk.yml
config/locales/sl.yml
config/locales/sr.yml
config/locales/sv.yml
config/locales/th.yml
config/locales/tr.yml
config/locales/uk.yml
config/locales/vi.yml
config/locales/zh-TW.yml
config/locales/zh.yml

index 44a4217458b7c9c732148337c9757f4f9da04c14..3ef1afdef7c0c78f23f129a86d80df174e32acc1 100644 (file)
@@ -57,6 +57,14 @@ class Member < ActiveRecord::Base
     member_roles.detect {|mr| mr.inherited_from}.nil?
   end
   
+  def include?(user)
+    if principal.is_a?(Group)
+      !user.nil? && user.groups.include?(principal)
+    else
+      self.user == user
+    end
+  end
+  
   def before_destroy
     if user
       # remove category based auto assignments for this member
index bfea8675308269918d43e232bdd8919739230467..c0d48b9c26c3b3b096c0eccdecd014d332c55868 100644 (file)
@@ -35,7 +35,8 @@
   <td class="buttons">
       <%= link_to_function l(:button_edit), "$('member-#{member.id}-roles').hide(); $('member-#{member.id}-roles-form').show(); return false;", :class => 'icon icon-edit' %>
       <%= link_to_remote(l(:button_delete), { :url => {:controller => 'members', :action => 'destroy', :id => member},                                              
-                                              :method => :post
+                                              :method => :post,
+                                              :confirm => (!User.current.admin? && member.include?(User.current) ? l(:text_own_membership_delete_confirmation) : nil)
                                             }, :title => l(:button_delete),
                                                :class => 'icon icon-del') if member.deletable? %>
   </td>
index 4be99796146779c533ec7683dd85b516e3e4a739..5d7e23aca589f8b562dfe11b4e120d031cf2b1c5 100644 (file)
@@ -869,3 +869,6 @@ bg:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index 015b05521dcb3c783b2750a7c7cc83a414037511..6013b9ca17e654a7b54cc9318d02f45e7ace8087 100644 (file)
@@ -893,3 +893,6 @@ bs:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index 59b3a44f47869b3130af33f1d54b7c1696e80ee6..4f8193f4637efe4098fbd87d78a3b3b65ab899dc 100644 (file)
@@ -872,3 +872,6 @@ ca:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index bcbf7ac99b5455170d1148213b2c5c596f8c5177..2255ca491b251d71a3f3ce96ee28ecc24ca8f00a 100644 (file)
@@ -875,3 +875,6 @@ cs:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index 5123f241fad567c6bb725be7b534fcf861fdcbfb..87cd0e1cfc683cfb9691c13ed146696a8712f60f 100644 (file)
@@ -895,3 +895,6 @@ da:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index 81e69ef23d638f96128024cee3fecb3bbe5ffe37..79619efbb8c2b0ba4d3fc3c2ce0330d34bb71cd0 100644 (file)
@@ -895,3 +895,6 @@ de:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index 98800250057302d89463b1b96128a762b01bf56e..4a8ffb2b10fa436c9cfd1b51450cbc3cfa992f6b 100644 (file)
@@ -875,3 +875,6 @@ el:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index 1c421cb49e65aaf90b31e506da7312876f7f1d58..c21643c0d8d091944312202c185316e45f956e17 100644 (file)
@@ -848,6 +848,7 @@ en:
   text_wiki_page_nullify_children: "Keep child pages as root pages"
   text_wiki_page_destroy_children: "Delete child pages and all their descendants"
   text_wiki_page_reassign_children: "Reassign child pages to this parent page"
+  text_own_membership_delete_confirmation: "You are about to remove some or all of your permissions and may no longer be able to edit this project after that.\nAre you sure you want to continue?"
   
   default_role_manager: Manager
   default_role_developper: Developer
index bcf8bd21fb080fa7305e1bec4cc812d754526606..dd0ec9dceb21c64325a918dc9b0838ed1c1c7f6f 100644 (file)
@@ -919,3 +919,6 @@ es:
   setting_mail_handler_body_delimiters: Truncar correos tras una de estas líneas
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index 6f255d03e1fcfc47df4089c97ec495b312a132f9..def80f980ad39eac8439f92fc96e7fe722d4efca 100644 (file)
@@ -905,3 +905,6 @@ fi:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index 6ecfc240dbf125e69c88ca2878e3a42ea2313c59..97849b55461c4a9e937098445942aca12ab34c17 100644 (file)
@@ -856,6 +856,7 @@ fr:
   text_wiki_page_nullify_children: "Conserver les sous-pages en tant que pages racines"
   text_wiki_page_destroy_children: "Supprimer les sous-pages et toutes leurs descedantes"
   text_wiki_page_reassign_children: "Réaffecter les sous-pages à cette page"
+  text_own_membership_delete_confirmation: "Vous allez supprimer tout ou partie de vos permissions sur ce projet et ne serez peut-être plus autorisé à modifier ce projet.\nEtes-vous sûr de vouloir continuer ?"
   
   default_role_manager: Manager
   default_role_developper: Développeur
index af1c6eb9a79364cc2ca0dd57a6839ba7d885169c..8f65a701f47957f5109a500ead7b427210196b66 100644 (file)
@@ -895,3 +895,6 @@ gl:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index f66970cc32f7dca2cbd9a661eb0b4f521fe80632..f2429c6075cddb148776307ba7cb35024444f2fa 100644 (file)
@@ -879,3 +879,6 @@ he:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index a48228cdf64d325f92e22b411d18240c4c3d8a5c..70a963d3e02ecd5dbe4dd3d53a3a8723d8cae514 100644 (file)
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index e124764c7a6851a9b651b5c1efd51a4df889769a..59d52f67d6ea381fce7b7da9fd842478e0284cae 100644 (file)
@@ -887,3 +887,6 @@ id:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index b469099e39249fcb734081d346e6ad8104500960..2fc70a5fc3f9198c63ba69aa72545ddb461ead9b 100644 (file)
@@ -882,3 +882,6 @@ it:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index 0de5160e0aea9392bc2c6aab0244b8a6471ad369..324abaaa79db10359691c5e09d89f07d565be587 100644 (file)
@@ -904,3 +904,6 @@ ja:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index 4b82b77f7cf64346d53ed11d0377e2630917d7d5..8c9de9db1dee89f9128fdce3fdeb19819511aff4 100644 (file)
@@ -935,3 +935,6 @@ ko:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index 8c874065f796ac3ba18a5350aa70fcc7c302adc3..60eec6138da3dd8f153ad0534959b8cb2909325c 100644 (file)
@@ -943,3 +943,6 @@ lt:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index 223df9b44792194f04a3debf9d100abff42acca1..b4630b234cc2f73f675e141df29414543636710c 100644 (file)
@@ -857,3 +857,6 @@ nl:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index 461708b3b16f32878acd643ae3b9b19bebc20afd..89c034f22645e36cedb246f36550dd9452ec9559 100644 (file)
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index ad8040aa55f4e5b7cb0ad303e42949dc672cd3f7..4ff9ef255dd1d16d3dd4f8f254dd60de032d482b 100644 (file)
@@ -898,3 +898,6 @@ pl:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index ed8e83e33e01a21153f2a6477f5c5f7680b5675d..2628d81d3b4220dd9b486c970e8e2543d988f52d 100644 (file)
@@ -902,3 +902,6 @@ pt-BR:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index 9441e56c27aa4ec587c50360497cb855a3245abb..cacea62931b8b369dee2e796f5717104f1ac04c6 100644 (file)
@@ -887,3 +887,6 @@ pt:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index f91525b735201e924fef081aafafeff83769f268..59b2a072ae05aeca16503e32607adddd1a566433 100644 (file)
@@ -872,3 +872,6 @@ ro:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index 4c2822504ac5512d7896bd54259a93e7c38f01fa..682a878db41f96705647328acfee2dc510abafa6 100644 (file)
@@ -983,3 +983,6 @@ ru:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index 53b06dc8d88fc2b8181b3dc901b0968e3048a691..cdc04803c57192021255352caccb024ee576aaac 100644 (file)
@@ -874,3 +874,6 @@ sk:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index 852ad6ac33a40cc541c4426a1bde15832b35c2cb..66da1b3c4062bdd1e7162c8406ea92bd61658b02 100644 (file)
@@ -871,3 +871,6 @@ sl:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index fd0a5db92c419ea4b536abb42d25c8d303534e7b..4792ff08dcbceec5d1ae6f413d0c23a5debd1d8b 100644 (file)
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index 109ca7e6edc2a159d0f9eff4b2eec3809e18768d..e6345b4f6854d4fd061642ebfdbe14431bbcbdd9 100644 (file)
@@ -925,3 +925,6 @@ sv:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index 294880baaeeb7be9f2ce47d54012670fd013e096..29f0747391bb32b097e096e5b5baf78a8a5e849d 100644 (file)
@@ -872,3 +872,6 @@ th:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index 42677a8707a6f632eea12a0f7a0491103ef56767..0bc54ad9d1d43548ebaef41bf446cd76692b5085 100644 (file)
@@ -902,3 +902,6 @@ tr:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index 879b0aaa89c1ad334c52bd5480d29ec80cc52240..c6adec84ba5d0a6c4a59dd1ec8a886703e9ed680 100644 (file)
@@ -871,3 +871,6 @@ uk:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index afd63e9b4cb908da2bec82cf29008e0f654b3f1a..ccba5434f66e16825c8b569b90d6a08b826ffb7c 100644 (file)
@@ -934,3 +934,6 @@ vi:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index 44066dbd8d72d4049630b92e63a4bf3941c129f8..54a46fd2d4c78c40fc9721467959639e8349a30e 100644 (file)
   enumeration_system_activity: 系統活動
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?
index 63143e1d9601a37840211435f3af8cbd48a6f17c..a5ecdd08ff121fba7bceeb160983a16b21dbf3e2 100644 (file)
@@ -899,3 +899,6 @@ zh:
   setting_mail_handler_body_delimiters: Truncate emails after one of these lines
   permission_add_subprojects: Create subprojects
   label_subproject_new: New subproject
+  text_own_membership_delete_confirmation: |-
+    You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+    Are you sure you want to continue?