Skip to content

Commit fa068ec

Browse files
author
Romain GUINOT
committed
0.54:
- replaced the remaining eval calls by JSON.parse, for safety and improved parsing performance - adjusted the application list autocomplete so it shows the full list of applications when the config field is cleared - minor variable name change - no new features
1 parent b7c0331 commit fa068ec

File tree

6 files changed

+18
-9
lines changed

6 files changed

+18
-9
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,13 @@ Some sample screenshots with different configurations are included below :
174174
Changelog
175175
---------
176176

177+
0.54:
178+
179+
- replaced the remaining eval calls by JSON.parse, for safety and improved parsing performance
180+
- adjusted the application list autocomplete so it shows the full list of applications when the config field is cleared
181+
- minor variable name change
182+
- no new features
183+
177184
0.53:
178185

179186
- updated README to mention that the Alfresco repository restricts access to audit data to repository administrators only. Only admins will therefore be able to use the dashlet.

build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
build.version=0.53
1+
build.version=0.54
22
project.name=audit-dashlet
33
jar.name=${project.name}-${build.version}.jar

config/alfresco/site-webscripts/org/sharextras/components/dashlets/audit-application-data.get.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function main()
8181
var escaped_response = json_requoted_response.replace(/(\n|\r\n|\r)/g, " ");
8282
//if (logger.isLoggingEnabled()) logger.log("escaped_response:\n"+escaped_response);
8383

84-
var auditresponse = eval("(" + escaped_response + ")");
84+
var auditresponse = JSON.parse(escaped_response);
8585
model.auditresponse = auditresponse;
8686
model.jsonResp = result.response;
8787
}
@@ -105,7 +105,7 @@ function isJsonQuoteFixRequired(connector)
105105
{
106106
// get current server version to determine if a workaround for ALF-8307 is needed.
107107
var srvInfo = connector.get("/api/server");
108-
var srvInfoJson = eval('(' + srvInfo + ')');
108+
var srvInfoJson = JSON.parse(srvInfo);
109109

110110
var serverVersion, serverEdition, serverVersionNumbers;
111111

config/alfresco/site-webscripts/org/sharextras/components/dashlets/audit-application.get.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ function getUserIsSiteManager(username)
22
{
33
// Call the repository to see if the user is a site manager or not
44
var userIsSiteManager = false;
5-
var obj = context.properties["memberships"];
6-
if (!obj)
5+
var membership = context.properties["memberships"];
6+
if (!membership)
77
{
88
var json = remote.call("/api/sites/" + page.url.templateArgs.site + "/memberships/" + stringUtils.urlEncode(username));
99
if (json.status == 200)
1010
{
11-
obj = eval('(' + json + ')');
11+
membership = JSON.parse(json);
1212
}
1313
}
14-
if (obj)
14+
if (membership)
1515
{
16-
userIsSiteManager = (obj.role == "SiteManager");
16+
userIsSiteManager = (membership.role == "SiteManager");
1717
}
1818
return userIsSiteManager;
1919
}

config/alfresco/site-webscripts/org/sharextras/modules/dashlets/audit-application-applist.get.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function main()
99

1010
if (result.status == status.STATUS_OK)
1111
{
12-
var auditcontrol = eval("(" + result.response + ")");
12+
var auditcontrol = JSON.parse(result.response);
1313
model.auditcontrol = auditcontrol;
1414
}
1515
else

source/web/extras/components/dashlets/audit-application.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,8 @@ if (typeof Extras.dashlet == "undefined" || !Extras.dashlet)
12591259
appAutoComplete.queryMatchContains = true;
12601260
appAutoComplete.formatResult = formatResult;
12611261
appAutoComplete.itemSelectEvent.subscribe(appHandler);
1262+
appAutoComplete.minQueryLength = 0; // 0 so that it shows the full list of applications when the config field is cleared.
1263+
// The application list should be quite small so 0-length query here should be OK.
12621264

12631265
// if no app is currently configured, preload the list to display all entries immediately on config popup
12641266
// the leading space has been intentionnally added by audit-application-applist.get.json.ftl

0 commit comments

Comments
 (0)