diff --git a/ooiui/static/js/partials/UserEditForm.html b/ooiui/static/js/partials/UserEditForm.html
index 64b2b15fb..1335c54f8 100644
--- a/ooiui/static/js/partials/UserEditForm.html
+++ b/ooiui/static/js/partials/UserEditForm.html
@@ -8,13 +8,16 @@
+ <% if(isAdmin === true) { %>
+
User Scopes
<% scopes.each(function(scope) { %>
@@ -129,6 +133,7 @@
User Scopes
<% }); %>
+ <% } %>
diff --git a/ooiui/static/js/views/common/UserEditFormView.js b/ooiui/static/js/views/common/UserEditFormView.js
index 000a76942..4fc86af3c 100644
--- a/ooiui/static/js/views/common/UserEditFormView.js
+++ b/ooiui/static/js/views/common/UserEditFormView.js
@@ -95,30 +95,46 @@ var UserEditFormView = Backbone.View.extend({
},
template: JST['ooiui/static/js/partials/UserEditForm.html'],
render: function() {
- this.$el.html(this.template({scopes: this.scopes}));
+ let self = this;
+ let isAdmin = false;
// Only allow scope modification if
- var userModel = new UserModel();
+ let userModel = new UserModel();
userModel.url = '/api/current_user';
userModel.fetch({
success: function(collection, response, options) {
- var scopes = response.scopes;
+ let scopes = response.scopes;
self.userScopes = scopes;
- if(scopes.includes('user_admin')){
+ if(scopes.includes('user_admin')) {
+ isAdmin = true;
+ }
+
+ // Check if the user is an admin and only render the scopes if so.
+ if (isAdmin === true) {
+ self.$el.html(self.template({scopes: self.scopes, isAdmin: isAdmin}));
+ self.$el.append(self.modalDialog.el);
+ self.stickit();
+ } else {
+ self.$el.html(self.template({scopes: [], isAdmin: isAdmin}));
+ self.$el.append(self.modalDialog.el);
+ self.stickit();
+ }
+
+ if(isAdmin === true){
$("#scope_div").show();
$("#active_div").show();
} else {
$("#scope_div").hide();
$("#active_div").hide();
}
+
},
error:function(collection, response, options) {
console.log('Error getting user data');
}
});
- this.$el.append(this.modalDialog.el);
- this.stickit();
+
}
});
diff --git a/ooiui/static/json/uiPatchNotes.json b/ooiui/static/json/uiPatchNotes.json
index 43b5a80e5..823fdd799 100644
--- a/ooiui/static/json/uiPatchNotes.json
+++ b/ooiui/static/json/uiPatchNotes.json
@@ -1,4 +1,11 @@
[
+ {
+ "VersionNumber": "1.9.2",
+ "VersionDate": "2020-06-29",
+ "VersionDescription": [
+ "Security: Fixes user profile scope rendering. (14783)"
+ ]
+ },
{
"VersionNumber": "1.9.1",
"VersionDate": "2020-06-09",