ufonduo / share-extras

Automatically exported from code.google.com/p/share-extras
0 stars 0 forks source link

Audit dashlet fails if Alfresco usernames contains dot (.) #71

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create some alfresco users with a dot (.) in their usernames
2. make sure you have an audit configuration auditing values for this user
3. Configure the Audit Dashlet for your audit application.

What is the expected output? What do you see instead?
The audited values, instead it shows "Data Error" in the first column

What version of the add-on are you using? Please provide version of the
downloaded package, or Subversion revision number.
0.43

What version of Alfresco are you using? On what application server?
3.4.c

What web browser are you using? Please supply browser name and version.
Google Chrome

Please provide any additional information below.
The log files indicates that the json response containing the username in the 
server side javascript is not escaped thus causing the error.

Original issue reported on code.google.com by bille...@gmail.com on 28 Mar 2012 at 1:40

GoogleCodeExporter commented 8 years ago
Investigated a bit further and the problem originates from a fix to handle 
ALF-8307:

 var requoting_regex = /:(\w+)\,/g;

The regular expression above is a patch temporarily solving ALF-8307 by quoting 
application and username from the audit values. However the regular expression 
only matches word characters (letters, digits, and underscores) and should be 
enhanced with handling the dot character as well (.). 

Not sure how to do it, my knowledge in regexp syntax could be better I'm afraid 
:(

I will post if I find a solution.

/Erik

Original comment by bille...@gmail.com on 29 Mar 2012 at 12:30

GoogleCodeExporter commented 8 years ago

Original comment by will.abson on 27 Jun 2012 at 2:15

GoogleCodeExporter commented 8 years ago
Hi Erik, 

Do you still need help to address this ? 

I currently don't have the time right now to put a new build out, but you 
should be able to fix this locally by replacing \w+ by [\w.]+  in the regex you 
pointed out.

I will hopefully do that sometime in July.

Cheers.

Original comment by romaingu...@gmail.com on 27 Jun 2012 at 2:29

GoogleCodeExporter commented 8 years ago
Romain,

I will update my local build with your new regexp. I didn't look into it but 
its still needed.

Thanks!
/Erik

Original comment by bille...@gmail.com on 27 Jun 2012 at 2:31

GoogleCodeExporter commented 8 years ago
np, 
Let me know if that works out for you.

Original comment by romaingu...@gmail.com on 27 Jun 2012 at 2:44

GoogleCodeExporter commented 8 years ago
Hi Romain,

I am still getting issues with data error, as I have username with . as well 
some special chars also in my document name like +, _, -.

Any working regex ??

Original comment by rathod.g...@gmail.com on 17 Jul 2012 at 9:22

GoogleCodeExporter commented 8 years ago
I have used regex as below :
 var requoting_regex = /:[\w.]+\,/g;

still I am getting error.. Log is attached.

- Ghanshyam

Original comment by rathod.g...@gmail.com on 17 Jul 2012 at 9:32

GoogleCodeExporter commented 8 years ago
I still don't have the time to put a new build out currently... but here are my 
comments : 
- the regex change i gave you only addresses the '.' as this is what you 
reported. You need to adjust it if you want to add other special characters. 
- However, you will not have the issue if you fix the underlying cause for that 
regex to exist, i.e. apply the fix for alf-8307, which i copy here for 
reference : 

Index: 
alfresco/BRANCHES/DEV/V3.4-BUG-FIX/root/projects/remote-api/config/alfresco/temp
lates/webscripts/org/alfresco/repository/audit/query.get.json.ftl
===================================================================
diff -u -N -r24662 -r27121
--- 
alfresco/BRANCHES/DEV/V3.4-BUG-FIX/root/projects/remote-api/config/alfresco/temp
lates/webscripts/org/alfresco/repository/audit/query.get.json.ftl   (.../query.get
.json.ftl)  (revision 24662)
+++ 
alfresco/BRANCHES/DEV/V3.4-BUG-FIX/root/projects/remote-api/config/alfresco/temp
lates/webscripts/org/alfresco/repository/audit/query.get.json.ftl   (.../query.get
.json.ftl)  (revision 27121)
@@ -6,8 +6,8 @@
       <#list entries as entry>
       {
          "id":${entry.id?c},
-         "application":${entry.application},
-         "user":<#if entry.user??>${entry.user}<#else>null</#if>,
+         "application":"${entry.application}",
+         "user":"<#if entry.user??>${entry.user}<#else>null</#if>",
          "time":"${xmldate(entry.time)}",
          "values":
          <#if entry.values??>

@rathod : this issue was originally about special chars in the username. what 
is your issue regarding document names ? probably a different issue, and your 
log is not attached....

Original comment by romain.g...@alfresco.com on 17 Jul 2012 at 10:16

GoogleCodeExporter commented 8 years ago
Hi Romain,

Thanks for quick reply, actually my problem seems something different as I am 
login as admin and I enabled logging for my custom content type like below.

--------------------------------------------
audit.enabled=true
audit.alfresco-access.enabled=true
audit.alfresco-access.sub-actions.enabled=true
### Audit Filter ###
audit.filter.alfresco-access.transaction.user=~System;~null;.*
audit.filter.alfresco-access.transaction.type=st:site;clm:contract;cm:folder;cm:
content;cm:person
audit.filter.alfresco-access.transaction.path=~/sys:archivedItem;~/ver:;.*
----------------------------------------------------

Now when I open dashboard my audit dashlet directly showing Data error in 
dashlet.
I am using alfresco 4.0.0 Enterprise version.

Let me attach log again.
I am trying with following regex now : 
var requoting_regex = /:[\w.+]\,/g;

Actually I am using your jar inside share/WEB-INF/lib

Let me know what is wrong here.Also can you tell me if I want to add some more 
special characters where should I add those? I am new to regex.

Original comment by rathod.g...@gmail.com on 17 Jul 2012 at 11:20

Attachments:

GoogleCodeExporter commented 8 years ago
@billerby : i have confirmed that : 

- you are not affected by this issue if you have a build that has the fix for  
ALF-8307 (see diff above to confirm)

- without this, replacing the regexp with : 
    var requoting_regex = /:([\w-@.]+)\,/g;

  also fixes the problem. note that in the regex above i have added '-' and '@' as valid characters in the usernames. 

If have the time in the coming week, i will try to put a new build up that 
includes this fix. In any case, your best option wrt performance/cost, is to 
apply the fix for the underlying issue. see above.

Let me know.

Original comment by romaingu...@gmail.com on 27 Jul 2012 at 3:37

GoogleCodeExporter commented 8 years ago
I am also waiting a bit for more info on issue 82. If there really is something 
to fix in that 2nd issue, i'd like to make those 2 changes in one go, saving me 
from having to do tests, merge, new jar upload, doc & wiki updates etc twice.

Original comment by romaingu...@gmail.com on 27 Jul 2012 at 3:42

GoogleCodeExporter commented 8 years ago
A new build (0.44) has been put up to address this, even if your version does 
not have the repo ftl fix. 

I have extended the use case also to users who may have '@' or '-' in their 
username, possibly if they're logging in with their e-mail address. I have 
tested it against users generating audit entries with such characters in their 
login name. 

Original comment by romaingu...@gmail.com on 31 Jul 2012 at 6:16

GoogleCodeExporter commented 8 years ago
See the changelog for other changes.

Original comment by romaingu...@gmail.com on 31 Jul 2012 at 6:18