diff --git a/ui/src/main/resources/XWiki/AccountRejectionTemplate.xml b/ui/src/main/resources/XWiki/AccountRejectionTemplate.xml new file mode 100644 index 00000000..d6fea385 --- /dev/null +++ b/ui/src/main/resources/XWiki/AccountRejectionTemplate.xml @@ -0,0 +1,130 @@ + + + + + + XWiki + AccountRejectionTemplate + + + 0 + xwiki:XWiki.Admin + 1447440844000 + XWiki.WebHome + xwiki:XWiki.Admin + xwiki:XWiki.Admin + 1447443328000 + 1447440844000 + 1.1 + + <comment/> + <minorEdit>false</minorEdit> + <syntaxId>xwiki/2.1</syntaxId> + <hidden>false</hidden> + <content/> + <object> + <name>XWiki.AccountRejectionTemplate</name> + <number>0</number> + <className>XWiki.Mail</className> + <guid>2f7675be-7afc-4b1b-991f-b2758022c2b2</guid> + <class> + <name>XWiki.Mail</name> + <customClass/> + <customMapping/> + <defaultViewSheet/> + <defaultEditSheet/> + <defaultWeb/> + <nameField/> + <validationScript/> + <html> + <disabled>0</disabled> + <name>html</name> + <number>4</number> + <prettyName>HTML</prettyName> + <rows>15</rows> + <size>80</size> + <unmodifiable>0</unmodifiable> + <classType>com.xpn.xwiki.objects.classes.TextAreaClass</classType> + </html> + <language> + <disabled>0</disabled> + <name>language</name> + <number>2</number> + <prettyName>Language</prettyName> + <size>5</size> + <unmodifiable>0</unmodifiable> + <classType>com.xpn.xwiki.objects.classes.StringClass</classType> + </language> + <subject> + <disabled>0</disabled> + <name>subject</name> + <number>1</number> + <prettyName>Subject</prettyName> + <size>40</size> + <unmodifiable>0</unmodifiable> + <classType>com.xpn.xwiki.objects.classes.StringClass</classType> + </subject> + <text> + <disabled>0</disabled> + <name>text</name> + <number>3</number> + <prettyName>Text</prettyName> + <rows>15</rows> + <size>80</size> + <unmodifiable>0</unmodifiable> + <classType>com.xpn.xwiki.objects.classes.TextAreaClass</classType> + </text> + </class> + <property> + <html><p>Dear ${userRealName},</p> +<p>Thank you for your interest in a ${platformName} account. Based on the information you provided, we do not have sufficient grounds to provide you with an account.</p> +<p>${platformName} is a repository for secure data sharing that encourages global scientific collaboration within the rare disease community while respecting the privacy of patients profiled. Accounts are appropriate for clinicians and scientists who can contribute phenotype and genotype information about patients with genetic disorders in their care. When an account holder enters a patient's data, this information is used to query the data entered in the repository by other contributors to find similar patients based on phenotype and genotype information. Without entering patient data, ${platformName} will have limited utility for you. We encourage you to browse through the information provided on <a href="https://phenomecentral.org/PhenomeCentral/About">https://phenomecentral.org/PhenomeCentral/About</a>.</p> +<p>We would like to bring to your attention that the phenotyping software embedded in ${platformName} is based on PhenoTips, a freely available software tool for collecting and analyzing phenotypic information for patients with genetic disorders. You can learn more about PhenoTips, demo the software and download it at <a href="http://phenotips.org/">http://phenotips.org/</a>. PhenoTips may be appropriate for users who have private patient data and wish to establish a personal/local phenotyping database.</p> +<p>If you believe you do meet the conditions for a ${platformName} account, please do not hesitate to contact us with additional information.</p> +<p>Sincerely,<br> +${adminName}<br> +${platformName} Support Team</p> +</html> + </property> + <parent>XWiki.WebHome</parent> + <property> + <language/> + </property> + <property> + <subject>${platformName} account status</subject> + </property> + <property> + <text>Dear ${userRealName}, + +Thank you for your interest in a ${platformName} account. Based on the information you provided, we do not have sufficient grounds to provide you with an account. + +${platformName} is a repository for secure data sharing that encourages global scientific collaboration within the rare disease community while respecting the privacy of patients profiled. Accounts are appropriate for clinicians and scientists who can contribute phenotype and genotype information about patients with genetic disorders in their care. When an account holder enters a patient's data, this information is used to query the data entered in the repository by other contributors to find similar patients based on phenotype and genotype information. Without entering patient data, ${platformName} will have limited utility for you. We encourage you to browse through the information provided on https://phenomecentral.org/PhenomeCentral/About. + +We would like to bring to your attention that the phenotyping software embedded in ${platformName} is based on PhenoTips, a freely available software tool for collecting and analyzing phenotypic information for patients with genetic disorders. You can learn more about PhenoTips, demo the software and download it at http://phenotips.org/. PhenoTips may be appropriate for users who have private patient data and wish to establish a personal/local phenotyping database. + +If you believe you do meet the conditions for a ${platformName} account, please do not hesitate to contact us with additional information. + +Sincerely, + +${adminName} +${platformName} Support Team +</text> + </property> + </object> +</xwikidoc> diff --git a/ui/src/main/resources/XWiki/ManualAccountValidation.xml b/ui/src/main/resources/XWiki/ManualAccountValidation.xml index ebcab05d..a018f27c 100644 --- a/ui/src/main/resources/XWiki/ManualAccountValidation.xml +++ b/ui/src/main/resources/XWiki/ManualAccountValidation.xml @@ -38,23 +38,68 @@ <syntaxId>xwiki/2.0</syntaxId> <hidden>true</hidden> <content>{{velocity}} -#if ("$!{request.xwikiname}" != '') -$response.setContentType("application/json") +#if ("$!{request.xwikiname}" != '' && "$!{request.action}" != '') + $response.setContentType("application/json") #set ($userDoc = $xwiki.getDocument(${request.xwikiname})) #set ($user = $userDoc.getObject('XWiki.XWikiUsers')) - $user.set('active', 1) + #set ($firstName = $user.getValue('first_name')) + #set ($lastName = $user.getValue('last_name')) + #set ($realName = "$!{firstName} $!{lastName}") #set ($email = $user.getProperty('email').getValue()) #if ("$!{email}" != '') - #set ($emailStatus = $xwiki.mailsender.sendMessageFromTemplate('PhenomeCentral <noreply@phenomecentral.org>', $email, $NULL, $NULL, '', 'XWiki.ManualAccountValidation', { - "userName": $xwiki.getDocument($request.xwikiname).name, + + #set ($adminGroupName = 'XWiki.SignUpAdmins') + #set ($adminsGroupDoc = $xwiki.getDocument($adminGroupName)) + #set ($adminObjects = $adminsGroupDoc.getObjects('XWiki.XWikiGroups')) + #set($cc = '') + #set($mainAdminEmail = '') + #set($mainAdminName = '') + #set($first = true) + #foreach ($adminObj in $adminObjects) + #set($v = $adminObj.getValue('member')) + #if ($!v != '') + #set($adminDoc = $xwiki.getDocument($v)) + #set($adminUser = $adminDoc.getObject('XWiki.XWikiUsers')) + #set($adminEmail = $adminUser.getValue('email')) + #if($first) + #set($first = $adminUser.getValue('first_name')) + #set($last = $adminUser.getValue('last_name')) + #set($mainAdminName = "$first $last") + #set($mainAdminEmail = $adminEmail) + #set($first = false) + #set($cc = $mainAdminEmail) + #else + #set($cc = "${cc}, ${adminEmail}") + #end + #end + #end + + #if ("$!{request.action}" == 'accept') + #set($emailTemplate = 'XWiki.ManualAccountValidation') + #elseif("$!{request.action}" == 'reject') + #set($emailTemplate = 'XWiki.AccountRejectionTemplate') + #end + + #set ($emailStatus = $xwiki.mailsender.sendMessageFromTemplate('PhenomeCentral <noreply@phenomecentral.org>', $email, $cc, $NULL, '', $emailTemplate, { + "userRealName": $realName.trim(), + "userName": $userDoc.name, + "adminName": $mainAdminName, + "adminEmail": $mainAdminEmail, "platformName": "PhenomeCentral", "loginURL": $xwiki.getDocument($services.model.resolveDocument('', 'default', $doc.documentReference.extractReference('WIKI'))).getExternalURL()})) + #else #set ($emailStatus = 0) #end + #if ($emailStatus == 0) - $userDoc.save() + #if ("$!{request.action}" == 'accept') + $user.set('active', 1) + $userDoc.save() + #elseif("$!{request.action}" == 'reject') + $userDoc.delete() + #end true #else false @@ -116,26 +161,71 @@ false </text> </class> <property> - <html><p>Hello,</p> -<p>Your account ${userName} has been activated.</p> -<p>You can now log in at <a href="${loginURL}">${platformName}</a>.</p> - -<p>Best wishes,<br> -The ${platformName} team</p></html> + <html><p>Dear ${userRealName},</p> +<p>An account has been created for you on ${platformName}. If you forgot your password, please visit <a href="https://phenomecentral.org/XWiki/ResetPassword">https://phenomecentral.org/XWiki/ResetPassword</a> and enter your username ${userName}. Please do not hesitate to contact us if you experience any difficulties with your account.</p> +<p>You can view your closest matches immediately after entering your patient into ${platformName}! Simply create the patient record, click Save and View Summary and scroll down to Similar Cases Available in the Database. You will be able to find similar cases in ${platformName}, DECIPHER and GeneMatcher based on phenotype and candidate genes.</p> +<p>For more detailed instructions, please visit: <a href="http://monarch-initiative.blogspot.ca/2015/01/how-to-annotate-patients-phenotypic.html">http://monarch-initiative.blogspot.ca/2015/01/how-to-annotate-patients-phenotypic.html</a>. You can contact me at ${adminEmail} if you want tips on how to effectively enter your patients into the database.</p> +<p>If you are submitting a case for the Clinical Genetics journal, please follow the instructions listed at <a href="https://phenomecentral.org/PhenomeCentral/Instructions+for+Submitting+to+Clinical+Genetics">https://phenomecentral.org/PhenomeCentral/Instructions+for+Submitting+to+Clinical+Genetics</a></p> +<p>We look forward to collaborating with you through ${platformName}.</p> +<p>Sincerely,<br> +${adminName}<br> +${platformName} Team</p> +<br> +<span style="color: darkgray; font-size: small"> +<p style="display: none">====================================</p> +<p><b>TERMS AND CONDITIONS OF REGISTRATION</b></p> +<p>1. I confirm that I am a doctor, clinical geneticist or scientist working with patients affected by rare disorders.</p> +<p>2. ${platformName} provides data in good faith as a research tool, but without verifying the accuracy, clinical validity or utility of the data. ${platformName} makes no warranty, express or implied, nor assumes any legal liability or responsibility for any purpose for which the data are used.</p> +<p>3. The user certifies that no attempt to identify individual patients will be undertaken.</p> +<p>4. Prior to using ${platformName} data in a publication, the user will contact the owner of the matching dataset to assess the integrity of the match and if validated will offer appropriate agreed recognition of their contribution, which may include co-authorhship if the magnitude of the contribution warrants it to at least on representative from the project/participating centre (possibly the member who submitted the patient data).</p> +<p>5. If ${platformName} enables a research publication, the authors must acknowledge ${platformName} using the following wording: “This study makes use of data shared the ${platformName} repository. Funding for ${platformName} provided by Genome Canada and the Canadian Institute of Health Research (CIHR).</p> +</span></html> </property> <property> <language/> </property> <property> - <subject>Your account at PhenomeCentral has been approved</subject> + <subject>Your account at ${platformName} has been approved</subject> </property> <property> - <text>Hello, -Your account ${userName} has been activated. -You can now log in at ${loginURL}. + <text>Dear ${userRealName}, + +An account has been created for you on ${platformName}. If you forgot your password, please visit https://phenomecentral.org/XWiki/ResetPassword and enter your username ${userName}. Please do not hesitate to contact us if you experience any difficulties with your account. + +You can view your closest matches immediately after entering your patient into ${platformName}! Simply create the patient record, click Save and View Summary and scroll down to Similar Cases Available in the Database. You will be able to find similar cases in ${platformName}, DECIPHER and GeneMatcher based on phenotype and candidate genes. + +For more detailed instructions, please visit: http://monarch-initiative.blogspot.ca/2015/01/how-to-annotate-patients-phenotypic.html. You can contact me at ${adminEmail} if you want tips on how to effectively enter your patients into the database. + +If you are submitting a case for the Clinical Genetics journal, please follow the instructions listed at https://phenomecentral.org/PhenomeCentral/Instructions+for+Submitting+to+Clinical+Genetics + +We look forward to collaborating with you through ${platformName}. + +Sincerely, + +${adminName} +${platformName} Team + + +==================================== + +TERMS AND CONDITIONS OF REGISTRATION -Best wishes, -The ${platformName} team</text> +1. I confirm that I am a doctor, clinical geneticist or scientist working with patients affected +by rare disorders. +2. ${platformName} provides data in good faith as a research tool, but without verifying the +accuracy, clinical validity or utility of the data. ${platformName} makes no warranty, +express or implied, nor assumes any legal liability or responsibility for any purpose for +which the data are used. +3. The user certifies that no attempt to identify individual patients will be undertaken. +4. Prior to using ${platformName} data in a publication, the user will contact the owner of +the matching dataset to assess the integrity of the match and if validated will offer +appropriate agreed recognition of their contribution, which may include co-authorhship if +the magnitude of the contribution warrants it to at least on representative from the +project/participating centre (possibly the member who submitted the patient data). +5. If ${platformName} enables a research publication, the authors must acknowledge +${platformName} using the following wording: “This study makes use of data shared +though the ${platformName} repository. Funding for ${platformName} was provided by +Genome Canada and the Canadian Institute of Health Research (CIHR).</text> </property> </object> </xwikidoc> diff --git a/ui/src/main/resources/XWiki/SignUpAdmins.xml b/ui/src/main/resources/XWiki/SignUpAdmins.xml new file mode 100644 index 00000000..0210847d --- /dev/null +++ b/ui/src/main/resources/XWiki/SignUpAdmins.xml @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see http://www.gnu.org/licenses/ +--> + +<xwikidoc version="1.1"> + <web>XWiki</web> + <name>SignUpAdmins</name> + <language/> + <defaultLanguage/> + <translation>0</translation> + <creator>xwiki:XWiki.Admin</creator> + <creationDate>1447088977000</creationDate> + <parent>XWiki.XWikiGroups</parent> + <author>xwiki:XWiki.Admin</author> + <contentAuthor>xwiki:XWiki.Admin</contentAuthor> + <date>1447441170000</date> + <contentUpdateDate>1447441170000</contentUpdateDate> + <version>1.1</version> + <title/> + <comment/> + <minorEdit>false</minorEdit> + <syntaxId>xwiki/2.0</syntaxId> + <hidden>false</hidden> + <content/> + <object> + <name>XWiki.SignUpAdmins</name> + <number>0</number> + <className>XWiki.XWikiGroups</className> + <guid>dba8599a-7c23-4e91-9a1d-bf4f4f92090c</guid> + <class> + <name>XWiki.XWikiGroups</name> + <customClass/> + <customMapping/> + <defaultViewSheet/> + <defaultEditSheet/> + <defaultWeb/> + <nameField/> + <validationScript/> + <member> + <disabled>0</disabled> + <name>member</name> + <number>1</number> + <prettyName>Member</prettyName> + <size>30</size> + <unmodifiable>0</unmodifiable> + <classType>com.xpn.xwiki.objects.classes.StringClass</classType> + </member> + </class> + <property> + <member/> + </property> + </object> + <object> + <name>XWiki.SignUpAdmins</name> + <number>1</number> + <className>XWiki.XWikiGroups</className> + <guid>76ea1b31-924a-4673-b013-845a7d24686f</guid> + <class> + <name>XWiki.XWikiGroups</name> + <customClass/> + <customMapping/> + <defaultViewSheet/> + <defaultEditSheet/> + <defaultWeb/> + <nameField/> + <validationScript/> + <member> + <disabled>0</disabled> + <name>member</name> + <number>1</number> + <prettyName>Member</prettyName> + <size>30</size> + <unmodifiable>0</unmodifiable> + <classType>com.xpn.xwiki.objects.classes.StringClass</classType> + </member> + </class> + <property> + <member>XWiki.Admin</member> + </property> + </object> +</xwikidoc> diff --git a/war/src/main/webapp/resources/js/xwiki/usersandgroups/nonactiveusers.js b/war/src/main/webapp/resources/js/xwiki/usersandgroups/nonactiveusers.js index ab7d2342..45df164c 100644 --- a/war/src/main/webapp/resources/js/xwiki/usersandgroups/nonactiveusers.js +++ b/war/src/main/webapp/resources/js/xwiki/usersandgroups/nonactiveusers.js @@ -439,7 +439,8 @@ function displayUsersAndGroups(row, i, table, idx, form_token) function approveUserOrGroup(rowNumber, table, docname, uorg, form_token) { return function () { - var url = "$xwiki.getURL('XWiki.ManualAccountValidation', 'get', 'outputSyntax=plain')&xwikiname=" + docname; + var url = + "$xwiki.getURL('XWiki.ManualAccountValidation', 'get', 'outputSyntax=plain')&action=accept&xwikiname=" + docname; if (confirm("Are you use you want to approve this user __name__?".replace("__name__", docname))) { new Ajax.Request(url, { method: "get", @@ -464,20 +465,19 @@ function editUserOrGroup(userinlineurl, usersaveurl, userredirecturl) function deleteUserOrGroup(i, table, docname, uorg, form_token) { return function() { + var url = + "$xwiki.getURL('XWiki.ManualAccountValidation', 'get', 'outputSyntax=plain')&action=reject&xwikiname=" + docname; var message = "$escapetool.javascript($services.localization.render('rightsmanager.confirmdeletegroup'))"; if (uorg == "user") { message = "$escapetool.javascript($services.localization.render('rightsmanager.confirmdeleteuser'))"; } if (confirm(message.replace('__name__', docname))) { - new Ajax.Request('', { + new Ajax.Request(url, { method: 'get', - parameters: { - xpage: 'deleteuorg', - docname: docname, - form_token: form_token - }, onSuccess: function(transport) { - table.deleteRow(i); + if (transport.responseText == "true") { + table.deleteRow(i) + } } }); }