NIHVIVO-2343 A user should not be allowed as a proxy for his own profile.
This commit is contained in:
parent
b7ec17856e
commit
a866b5daf4
4 changed files with 10 additions and 4 deletions
|
@ -147,6 +147,7 @@ public class UserAccountsMyAccountPage extends UserAccountsPage {
|
|||
body.put("proxies", buildOriginalProxyList());
|
||||
}
|
||||
body.put("formUrls", buildUrlsMap());
|
||||
body.put("myAccountUri", userAccount.getUri());
|
||||
|
||||
// Could I do this without exposing this mechanism? But how to search
|
||||
// for an associated profile in AJAX?
|
||||
|
|
|
@ -74,6 +74,7 @@ function proxyInfoElement(template, uri, label, classLabel, imageUrl, removeInfo
|
|||
* You provide:
|
||||
* parms -- a map containing the URL of the AJAX controller, the query, and
|
||||
* the model selector.
|
||||
* excludedUris -- these URIs are always filtered out of the results.
|
||||
* getProxyInfos -- a function that will return an array of proxyInfoElements
|
||||
* that are already present in the list and so should be filtered out of
|
||||
* the autocomplete response.
|
||||
|
@ -94,7 +95,7 @@ function proxyInfoElement(template, uri, label, classLabel, imageUrl, removeInfo
|
|||
* -- calling addProxyInfo() and clearing the field when a value is selected.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
function proxyAutocomplete(parms, getProxyInfos, addProxyInfo, reportSearchStatus) {
|
||||
function proxyAutocomplete(parms, excludedUris, getProxyInfos, addProxyInfo, reportSearchStatus) {
|
||||
var cache = [];
|
||||
|
||||
var filterResults = function(parsed) {
|
||||
|
@ -103,7 +104,8 @@ function proxyAutocomplete(parms, getProxyInfos, addProxyInfo, reportSearchStatu
|
|||
return p.uri;
|
||||
});
|
||||
$.each(parsed, function(i, p) {
|
||||
if (-1 == $.inArray(p.uri, existingUris)) {
|
||||
if ((-1 == $.inArray(p.uri, existingUris))
|
||||
&& (-1 == $.inArray(p.uri, excludedUris))) {
|
||||
filtered.push(p);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -43,6 +43,8 @@ function proxyProxiesPanel(p) {
|
|||
|
||||
var self = this;
|
||||
|
||||
var excludedUris = [proxyMechanism.myAccountUri];
|
||||
|
||||
var removeProxyInfo = function(info) {
|
||||
self.removeProxyInfo(info)
|
||||
}
|
||||
|
@ -153,7 +155,7 @@ function proxyProxiesPanel(p) {
|
|||
url: proxyMechanism.sparqlQueryUrl
|
||||
};
|
||||
var reportSearchStatus = new searchStatusField(this.searchStatusField, 3).setText;
|
||||
this.addAutoCompleteField.autocomplete(new proxyAutocomplete(parms, this.getProxyInfos, this.addProxyInfo, reportSearchStatus));
|
||||
this.addAutoCompleteField.autocomplete(new proxyAutocomplete(parms, excludedUris, this.getProxyInfos, this.addProxyInfo, reportSearchStatus));
|
||||
}
|
||||
|
||||
this.setupAutoCompleteFields();
|
||||
|
|
|
@ -56,7 +56,8 @@ ${stylesheets.add('<link rel="stylesheet" href="${urls.base}/edit/forms/css/auto
|
|||
var proxyMechanism = {
|
||||
baseUrl: '${urls.base}',
|
||||
sparqlQueryUrl: '${formUrls.sparqlQueryAjax}',
|
||||
matchingProperty: '${matchingProperty}'
|
||||
matchingProperty: '${matchingProperty}',
|
||||
myAccountUri: '${myAccountUri}'
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue