Skip to content

Commit

Permalink
Add configurable uid and organization attributes to the AppModel. Turn
Browse files Browse the repository at this point in the history
off the profile settings for the default theme since it is not using
tokens anymore.
  • Loading branch information
laurenwalker committed May 31, 2017
1 parent 24a5ba1 commit c77c817
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions metacatui/src/main/webapp/js/models/AppModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ define(['jquery', 'underscore', 'backbone'],
userProfiles: true,
profileUsername: null,

ldapUidAttribute: "uid",
ldapOrgAttribute: "o",
ldapDNSuffix: "dc=ecoinformatics,dc=org",

useJsonp: true,
Expand Down
6 changes: 4 additions & 2 deletions metacatui/src/main/webapp/js/models/UserModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,10 @@ define(['jquery', 'underscore', 'backbone', 'jws', 'models/Search', "collections

if(!username) return;

if((username.indexOf("uid=") > -1) && (username.indexOf(",") > -1))
fullName = username.substring(username.indexOf("uid=") + 4, username.indexOf(","));
var ldapUidAttribute = appModel.get("ldapUidAttribute") || "uid" || "";

if((username.indexOf(ldapUidAttribute + "=") > -1) && (username.indexOf(",") > -1))
fullName = username.substring(username.indexOf(ldapUidAttribute + "=") + 4, username.indexOf(","));
else if((username.indexOf("CN=") > -1) && (username.indexOf(",") > -1))
fullName = username.substring(username.indexOf("CN=") + 3, username.indexOf(","));

Expand Down
1 change: 1 addition & 0 deletions metacatui/src/main/webapp/js/themes/default/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ var themeMap =
// example overrides are provided here
//'views/AboutView' : 'themes/' + theme + '/views/AboutView.js',
//'templates/navbar.html' : 'themes/' + theme + '/templates/navbar.html'
"templates/userProfileMenu.html" : "themes/" + theme + "/templates/userProfileMenu.html"
}
};
Empty file.
4 changes: 4 additions & 0 deletions metacatui/src/main/webapp/js/themes/knb/models/AppModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ define(['jquery', 'underscore', 'backbone'],

userProfiles: true,
profileUsername: null,

ldapUidAttribute: "uid",
ldapOrgAttribute: "o",
ldapDNSuffix: "dc=ecoinformatics,dc=org",

useJsonp: true,

Expand Down
6 changes: 3 additions & 3 deletions metacatui/src/main/webapp/js/views/RegistryView.js
Original file line number Diff line number Diff line change
Expand Up @@ -604,9 +604,9 @@ define(['jquery', 'underscore', 'backbone', 'bootstrap', 'jqueryform', 'views/Si
return false;
}

formObj.username.value = "uid=" + formObj.elements["uid"].value + ",o="
+ formObj.elements["organization"].value
+ "," + appModel.get("ldapDNSuffix");
formObj.username.value = appModel.get("ldapUidAttribute") + "=" + formObj.elements["uid"].value +
"," + appModel.get("ldapOrgAttribute") + "=" + formObj.elements["organization"].value +
"," + appModel.get("ldapDNSuffix");

// get the form data before replacing everything with the loading icon!
var formData = $("#loginForm").serialize();
Expand Down

0 comments on commit c77c817

Please sign in to comment.