diff --git a/app/models/member.rb b/app/models/member.rb index 44a4217458b7c9c732148337c9757f4f9da04c14..3ef1afdef7c0c78f23f129a86d80df174e32acc1 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -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 diff --git a/app/views/projects/settings/_members.rhtml b/app/views/projects/settings/_members.rhtml index bfea8675308269918d43e232bdd8919739230467..c0d48b9c26c3b3b096c0eccdecd014d332c55868 100644 --- a/app/views/projects/settings/_members.rhtml +++ b/app/views/projects/settings/_members.rhtml @@ -35,7 +35,8 @@ <%= 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? %> diff --git a/config/locales/bg.yml b/config/locales/bg.yml index 4be99796146779c533ec7683dd85b516e3e4a739..5d7e23aca589f8b562dfe11b4e120d031cf2b1c5 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -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? diff --git a/config/locales/bs.yml b/config/locales/bs.yml index 015b05521dcb3c783b2750a7c7cc83a414037511..6013b9ca17e654a7b54cc9318d02f45e7ace8087 100644 --- a/config/locales/bs.yml +++ b/config/locales/bs.yml @@ -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? diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 59b3a44f47869b3130af33f1d54b7c1696e80ee6..4f8193f4637efe4098fbd87d78a3b3b65ab899dc 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -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? diff --git a/config/locales/cs.yml b/config/locales/cs.yml index bcbf7ac99b5455170d1148213b2c5c596f8c5177..2255ca491b251d71a3f3ce96ee28ecc24ca8f00a 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -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? diff --git a/config/locales/da.yml b/config/locales/da.yml index 5123f241fad567c6bb725be7b534fcf861fdcbfb..87cd0e1cfc683cfb9691c13ed146696a8712f60f 100644 --- a/config/locales/da.yml +++ b/config/locales/da.yml @@ -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? diff --git a/config/locales/de.yml b/config/locales/de.yml index 81e69ef23d638f96128024cee3fecb3bbe5ffe37..79619efbb8c2b0ba4d3fc3c2ce0330d34bb71cd0 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -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? diff --git a/config/locales/el.yml b/config/locales/el.yml index 98800250057302d89463b1b96128a762b01bf56e..4a8ffb2b10fa436c9cfd1b51450cbc3cfa992f6b 100644 --- a/config/locales/el.yml +++ b/config/locales/el.yml @@ -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? diff --git a/config/locales/en.yml b/config/locales/en.yml index 1c421cb49e65aaf90b31e506da7312876f7f1d58..c21643c0d8d091944312202c185316e45f956e17 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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 diff --git a/config/locales/es.yml b/config/locales/es.yml index bcf8bd21fb080fa7305e1bec4cc812d754526606..dd0ec9dceb21c64325a918dc9b0838ed1c1c7f6f 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -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? diff --git a/config/locales/fi.yml b/config/locales/fi.yml index 6f255d03e1fcfc47df4089c97ec495b312a132f9..def80f980ad39eac8439f92fc96e7fe722d4efca 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -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? diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 6ecfc240dbf125e69c88ca2878e3a42ea2313c59..97849b55461c4a9e937098445942aca12ab34c17 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -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 diff --git a/config/locales/gl.yml b/config/locales/gl.yml index af1c6eb9a79364cc2ca0dd57a6839ba7d885169c..8f65a701f47957f5109a500ead7b427210196b66 100644 --- a/config/locales/gl.yml +++ b/config/locales/gl.yml @@ -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? diff --git a/config/locales/he.yml b/config/locales/he.yml index f66970cc32f7dca2cbd9a661eb0b4f521fe80632..f2429c6075cddb148776307ba7cb35024444f2fa 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -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? diff --git a/config/locales/hu.yml b/config/locales/hu.yml index a48228cdf64d325f92e22b411d18240c4c3d8a5c..70a963d3e02ecd5dbe4dd3d53a3a8723d8cae514 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -900,3 +900,6 @@ 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? diff --git a/config/locales/id.yml b/config/locales/id.yml index e124764c7a6851a9b651b5c1efd51a4df889769a..59d52f67d6ea381fce7b7da9fd842478e0284cae 100644 --- a/config/locales/id.yml +++ b/config/locales/id.yml @@ -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? diff --git a/config/locales/it.yml b/config/locales/it.yml index b469099e39249fcb734081d346e6ad8104500960..2fc70a5fc3f9198c63ba69aa72545ddb461ead9b 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -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? diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 0de5160e0aea9392bc2c6aab0244b8a6471ad369..324abaaa79db10359691c5e09d89f07d565be587 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -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? diff --git a/config/locales/ko.yml b/config/locales/ko.yml index 4b82b77f7cf64346d53ed11d0377e2630917d7d5..8c9de9db1dee89f9128fdce3fdeb19819511aff4 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -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? diff --git a/config/locales/lt.yml b/config/locales/lt.yml index 8c874065f796ac3ba18a5350aa70fcc7c302adc3..60eec6138da3dd8f153ad0534959b8cb2909325c 100644 --- a/config/locales/lt.yml +++ b/config/locales/lt.yml @@ -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? diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 223df9b44792194f04a3debf9d100abff42acca1..b4630b234cc2f73f675e141df29414543636710c 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -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? diff --git a/config/locales/no.yml b/config/locales/no.yml index 461708b3b16f32878acd643ae3b9b19bebc20afd..89c034f22645e36cedb246f36550dd9452ec9559 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -870,3 +870,6 @@ 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? diff --git a/config/locales/pl.yml b/config/locales/pl.yml index ad8040aa55f4e5b7cb0ad303e42949dc672cd3f7..4ff9ef255dd1d16d3dd4f8f254dd60de032d482b 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -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? diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index ed8e83e33e01a21153f2a6477f5c5f7680b5675d..2628d81d3b4220dd9b486c970e8e2543d988f52d 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -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? diff --git a/config/locales/pt.yml b/config/locales/pt.yml index 9441e56c27aa4ec587c50360497cb855a3245abb..cacea62931b8b369dee2e796f5717104f1ac04c6 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -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? diff --git a/config/locales/ro.yml b/config/locales/ro.yml index f91525b735201e924fef081aafafeff83769f268..59b2a072ae05aeca16503e32607adddd1a566433 100644 --- a/config/locales/ro.yml +++ b/config/locales/ro.yml @@ -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? diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 4c2822504ac5512d7896bd54259a93e7c38f01fa..682a878db41f96705647328acfee2dc510abafa6 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -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? diff --git a/config/locales/sk.yml b/config/locales/sk.yml index 53b06dc8d88fc2b8181b3dc901b0968e3048a691..cdc04803c57192021255352caccb024ee576aaac 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -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? diff --git a/config/locales/sl.yml b/config/locales/sl.yml index 852ad6ac33a40cc541c4426a1bde15832b35c2cb..66da1b3c4062bdd1e7162c8406ea92bd61658b02 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -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? diff --git a/config/locales/sr.yml b/config/locales/sr.yml index fd0a5db92c419ea4b536abb42d25c8d303534e7b..4792ff08dcbceec5d1ae6f413d0c23a5debd1d8b 100644 --- a/config/locales/sr.yml +++ b/config/locales/sr.yml @@ -890,3 +890,6 @@ 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? diff --git a/config/locales/sv.yml b/config/locales/sv.yml index 109ca7e6edc2a159d0f9eff4b2eec3809e18768d..e6345b4f6854d4fd061642ebfdbe14431bbcbdd9 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -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? diff --git a/config/locales/th.yml b/config/locales/th.yml index 294880baaeeb7be9f2ce47d54012670fd013e096..29f0747391bb32b097e096e5b5baf78a8a5e849d 100644 --- a/config/locales/th.yml +++ b/config/locales/th.yml @@ -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? diff --git a/config/locales/tr.yml b/config/locales/tr.yml index 42677a8707a6f632eea12a0f7a0491103ef56767..0bc54ad9d1d43548ebaef41bf446cd76692b5085 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -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? diff --git a/config/locales/uk.yml b/config/locales/uk.yml index 879b0aaa89c1ad334c52bd5480d29ec80cc52240..c6adec84ba5d0a6c4a59dd1ec8a886703e9ed680 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -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? diff --git a/config/locales/vi.yml b/config/locales/vi.yml index afd63e9b4cb908da2bec82cf29008e0f654b3f1a..ccba5434f66e16825c8b569b90d6a08b826ffb7c 100644 --- a/config/locales/vi.yml +++ b/config/locales/vi.yml @@ -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? diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 44066dbd8d72d4049630b92e63a4bf3941c129f8..54a46fd2d4c78c40fc9721467959639e8349a30e 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -968,3 +968,6 @@ 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? diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 63143e1d9601a37840211435f3af8cbd48a6f17c..a5ecdd08ff121fba7bceeb160983a16b21dbf3e2 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -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?