userCapabilities = account.getCapabilities(user);
for (Role cap : capabilities) {
simpleUserCapabilities.put(cap.getUuid(), userCapabilities.contains(cap));
}
simpleUser.put("capabilities", simpleUserCapabilities);
-
+
so.put(user.getUuid(), simpleUser);
}
model.addAttribute("uuidAndUserMapJson", mapper.writeValueAsString(so));
-
+
so = new SimpleObject();
for (ProviderRole pr : providerRoles) {
so.put(pr.getUuid(), uu.format(pr));
}
model.addAttribute("providerRolesJson", mapper.writeValueAsString(so));
-
+
so = new SimpleObject();
for (OpenmrsObject o : account.getProviderAccounts()) {
Provider p = (Provider) o;
@@ -360,11 +360,11 @@ public void setModelAttributes(PageModel model, Account account, OtherAccountDat
simpleProvider.put("identifier", p.getIdentifier());
simpleProvider.put("providerRole", (p.getProviderRole() != null) ? p.getProviderRole().getUuid() : "");
simpleProvider.put("retired", p.isRetired());
-
+
so.put(p.getUuid(), simpleProvider);
}
model.addAttribute("uuidAndProviderJson", mapper.writeValueAsString(so));
-
+
so = new SimpleObject();
so.put("savedChanges", uu.message("adminui.savedChanges"));
so.put("saved", uu.message("adminui.saved"));
@@ -396,7 +396,7 @@ public void setModelAttributes(PageModel model, Account account, OtherAccountDat
model.addAttribute("messages", mapper.writeValueAsString(so));
}
-
+
private void sendErrorMessage(Errors errors, PageModel model, MessageSourceService mss, HttpServletRequest request) {
model.addAttribute("errors", errors);
StringBuffer errorMessage = new StringBuffer(mss.getMessage("error.failed.validation"));
@@ -409,22 +409,23 @@ private void sendErrorMessage(Errors errors, PageModel model, MessageSourceServi
errorMessage.append("");
request.getSession().setAttribute(UiCommonsConstants.SESSION_ATTRIBUTE_ERROR_MESSAGE, errorMessage.toString());
}
-
+
private void setJsonFormData(PageModel model, Account account, OtherAccountData otherAccountData) throws IOException {
-
+
ObjectMapper mapper = new ObjectMapper();
SimpleObject simplePerson = new SimpleObject();
simplePerson.put("familyName", account.getFamilyName());
simplePerson.put("givenName", account.getGivenName());
simplePerson.put("gender", account.getGender() != null ? account.getGender() : "");
model.addAttribute("personJson", mapper.writeValueAsString(simplePerson));
-
+
SimpleObject simpleUser = new SimpleObject();
SimpleObject simpleProvider = new SimpleObject();
if (otherAccountData != null) {
if (otherAccountData.getAddUserAccount()) {
User u = account.getUserAccounts().get(0);
simpleUser.put("username", u.getUsername());
+ simpleUser.put("email", u.getEmail());
simpleUser.put("privilegeLevel", account.getPrivilegeLevel(u).getUuid());
SimpleObject userProperties = new SimpleObject();
userProperties
@@ -436,16 +437,16 @@ private void setJsonFormData(PageModel model, Account account, OtherAccountData
}
simpleUser.put("capabilities", simpleUserCapabilities);
}
-
+
if (otherAccountData.getAddProviderAccount()) {
Provider prov = (Provider) account.getProviderAccounts().get(0);
simpleProvider.put("identifier", prov.getIdentifier());
simpleProvider.put("providerRole", prov.getProviderRole().getUuid());
}
}
-
+
model.addAttribute("userJson", mapper.writeValueAsString(simpleUser));
model.addAttribute("providerJson", mapper.writeValueAsString(simpleProvider));
}
-
+
}
diff --git a/omod/src/main/webapp/fragments/systemadmin/accounts/userFormFields.gsp b/omod/src/main/webapp/fragments/systemadmin/accounts/userFormFields.gsp
index 91b6aff9..c7b272bc 100644
--- a/omod/src/main/webapp/fragments/systemadmin/accounts/userFormFields.gsp
+++ b/omod/src/main/webapp/fragments/systemadmin/accounts/userFormFields.gsp
@@ -1,6 +1,7 @@
<%
def userUuid = ''
def username = ''
+ def email = ''
def privilegeLevelUuid = ''
def user = null;
def showPasswordFields = false
@@ -11,6 +12,7 @@
user = config.user
userUuid = user.uuid
username = user.username ?: ''
+ email = user.email ?: ''
changePassword = account.isSupposedToChangePassword(user)
if(account.getPrivilegeLevel(user)){
privilegeLevelUuid = account.getPrivilegeLevel(user).uuid
@@ -34,6 +36,9 @@
"ng-maxlength": propertyMaxLengthMap['username']]
usernameAttributes[requiredAttribute] = requiredAttributeValue;
+ def userEmailAttributes = ["ng-model": "uuidUserMap['"+userUuid+"'].email"]
+ userEmailAttributes[requiredAttribute] = requiredAttributeValue;
+
def privilegeLevelAttributes = ["ng-model": "uuidUserMap['"+userUuid+"'].privilegeLevel"]
privilegeLevelAttributes[requiredAttribute] = requiredAttributeValue
@@ -67,6 +72,21 @@
+ |
+ ${ ui.includeFragment("uicommons", "field/text", [
+ label: ui.message("adminui.user.email")+"*",
+ id: "adminui-email"+userUuid,
+ formFieldName: "email"+userUuid,
+ initialValue: email,
+ otherAttributes: userEmailAttributes
+ ]) }
+
+
+ ${ui.message("adminui.field.required")}
+
+
+ |
${ ui.includeFragment("uicommons", "field/dropDown", [
label: ui.message("adminui.account.privilegeLevel")+"*",
diff --git a/omod/src/main/webapp/fragments/systemadmin/accounts/userTabContentPane.gsp b/omod/src/main/webapp/fragments/systemadmin/accounts/userTabContentPane.gsp
index 947f123b..a2e8f86f 100644
--- a/omod/src/main/webapp/fragments/systemadmin/accounts/userTabContentPane.gsp
+++ b/omod/src/main/webapp/fragments/systemadmin/accounts/userTabContentPane.gsp
@@ -17,6 +17,12 @@
{{uuidUserMap['${uuid}'].username}}
|
+
+ | ${ui.message("adminui.user.email")} |
+
+ {{uuidUserMap['${uuid}'].email}}
+ |
+
| ${ui.message("adminui.account.privilegeLevel")} |
@@ -68,6 +74,7 @@
ng-click="save('${uuid}'<% if(!user.userId) { %>, '${account.person.uuid}'<% } %>)"
ng-disabled="userDetailsForm['username${uuid}'].\$invalid
|| userDetailsForm['privilegeLevel${uuid}'].\$invalid
+ || userDetailsForm['email${uuid}'].\$invalid
|| userDetailsForm['password${uuid}'].\$invalid
|| userDetailsForm['confirmPassword${uuid}'].\$invalid || requesting">
${ ui.message("general.save") }
diff --git a/omod/src/main/webapp/resources/scripts/fragments/systemadmin/userDetails.js b/omod/src/main/webapp/resources/scripts/fragments/systemadmin/userDetails.js
index 6c6def89..3ebc3de9 100644
--- a/omod/src/main/webapp/resources/scripts/fragments/systemadmin/userDetails.js
+++ b/omod/src/main/webapp/resources/scripts/fragments/systemadmin/userDetails.js
@@ -146,9 +146,10 @@ angular.module("adminui.userDetails", ["userService", "ngDialog", "adminui.shoul
}
}
});
-
+
var toSave = {
username: modelUser.username,
+ email: modelUser.email,
roles: privilegesLevelAndCapabilities,
userProperties: uProperties
};
diff --git a/pom.xml b/pom.xml
index 55792411..fc955a2a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,7 +21,7 @@
Admin UI Module
Administration Tools for the Reference Application
https://wiki.openmrs.org/x/NJO-B
-
+
Ujjwal Arora
@@ -30,7 +30,7 @@
OpenMRS Developers
-
+
OpenMRS
http://openmrs.org
@@ -47,7 +47,7 @@
api
omod
-
+
1.11.4
UTF-8
@@ -63,11 +63,11 @@
-
+
org.openmrs.api
openmrs-api
- ${openMRSVersion}
+ 2.2.0-alpha
jar
provided
@@ -79,15 +79,15 @@
jar
provided
-
+
org.openmrs.api
openmrs-api
- ${openMRSVersion}
+ 2.2.0-alpha
test-jar
test
-
+
org.openmrs.web
openmrs-web
@@ -95,7 +95,7 @@
test-jar
test
-
+
org.openmrs.test
openmrs-test
@@ -103,11 +103,11 @@
pom
test
-
+
-
-
-
+
+
+
org.openmrs.module
appframework-api
@@ -115,7 +115,7 @@
jar
provided
-
+
org.openmrs.module
appframework-api
@@ -131,7 +131,7 @@
jar
provided
-
+
org.openmrs.module
@@ -190,12 +190,12 @@
3.0
-This Source Code Form is subject to the terms of the Mozilla Public License,
-v. 2.0. If a copy of the MPL was not distributed with this file, You can
-obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
+This Source Code Form is subject to the terms of the Mozilla Public License,
+v. 2.0. If a copy of the MPL was not distributed with this file, You can
+obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
-Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
+Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
graphic logo is a trademark of OpenMRS Inc.
|