From f6b31296a62a75d3425f04c6e602a0584792031a Mon Sep 17 00:00:00 2001
From: Viktor Kovtun <viktor.kovtun@id.ethz.ch>
Date: Fri, 13 Sep 2019 12:16:55 +0200
Subject: [PATCH] SSDM-8751 Made the name, last name and email being editable
 only by file authenticated users.

---
 .../eln-lims/html/js/views/SideMenu/SideMenuWidgetView.js    | 1 +
 .../html/js/views/UserProfile/UserProfileController.js       | 5 +++++
 .../eln-lims/html/js/views/UserProfile/UserProfileView.js    | 3 ++-
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SideMenu/SideMenuWidgetView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SideMenu/SideMenuWidgetView.js
index f667309a7f0..638a011169d 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SideMenu/SideMenuWidgetView.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SideMenu/SideMenuWidgetView.js
@@ -241,6 +241,7 @@ function SideMenuWidgetView(sideMenuWidgetController, sideMenuWidgetModel) {
         }
         
         if(profile.mainMenu.showUserProfile) {
+            // && profile.isFileAuthenticationService && profile.isFileAuthenticationUser
             var userProfileLink = _this.getLinkForNode("User Profile", "USER_PROFILE", "showUserProfilePage", null);
             treeModelUtils.push({ title : userProfileLink, entityType: "USER_PROFILE", key : "USER_PROFILE", folder : false, lazy : false, view : "showUserProfilePage", icon : "glyphicon glyphicon-user" });
         }
diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/UserProfile/UserProfileController.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/UserProfile/UserProfileController.js
index 74c870c9621..23102d6a6d6 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/UserProfile/UserProfileController.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/UserProfile/UserProfileController.js
@@ -69,4 +69,9 @@ function UserProfileController(mainController, mode) {
 		return errors;
 	}
 
+	this.isFileAuthentication = function() {
+		return this._mainController.profile.isFileAuthenticationService &&
+				this._mainController.profile.isFileAuthenticationUser;
+	}
+
 }
\ No newline at end of file
diff --git a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/UserProfile/UserProfileView.js b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/UserProfile/UserProfileView.js
index 22e972b17ff..c62644afa24 100644
--- a/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/UserProfile/UserProfileView.js
+++ b/openbis_standard_technologies/dist/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/UserProfile/UserProfileView.js
@@ -72,7 +72,8 @@ function UserProfileView(userProfileController, userProfileModel) {
             this._$emailInput.val(getUserInformation.email);
             $formColumn.append(this._getFormGroup(this._$emailInput, "Email:"));
             // disable in view mode
-            if (this._userProfileModel.mode === FormMode.VIEW) {
+            if (this._userProfileModel.mode === FormMode.VIEW ||
+                    !this._userProfileController.isFileAuthentication()) {
                 this._$firstNameInput.prop("disabled", true);
                 this._$lastNameInput.prop("disabled", true);
                 this._$emailInput.prop("disabled", true);
-- 
GitLab