12 May 11:17
Re: Authentication audit
From: Narcis Paslaru <narcis.paslaru@...>
Subject: Re: Authentication audit
Newsgroups: gmane.comp.cms.nuxeo.general
Date: 2008-05-12 09:17:21 GMT
Subject: Re: Authentication audit
Newsgroups: gmane.comp.cms.nuxeo.general
Date: 2008-05-12 09:17:21 GMT
Hello Tiry,
Tiry wrote:
There are methods for retrieving events that are bounded to documents, and another method that only selects events, given an array of id's. Well, at least this is what the javadoc says.
There seams to be a problem implementing the IN operator in the query and it fails to list the needed events.
Do you plan to fix this soon, or do you know a workaround for this problem ?
Thanks a lot,
Narcis
PS : Here is the method I'm reffering to :
<at> SuppressWarnings("unchecked")
public List<LogEntry> queryLogs(String[] eventIds, String dateRange)
throws AuditException {
// :FIXME: This is not working remotelty since the LogEntryImpl returned
// is not within the api package.
if (eventIds == null || eventIds.length == 0) {
throw new AuditException("You must give a not null eventId");
}
log.debug("queryLogs() whereClause=" + eventIds);
Class<LogEntry> klass = getLogEntryClass();
List<LogEntry> results = new ArrayList<LogEntry>();
Date limit = null;
try {
limit = DateRangeParser.parseDateRangeQuery(new Date(), dateRange);
} catch (AuditQueryException aqe) {
throw new AuditException("Wrong date range query. Query was "
+ dateRange, aqe);
}
// :FIXME: Can't append to find the damned right syntax to build a
// dynamic list for the IN statement.
for (String eventId : eventIds) {
Query query = em.createQuery("from "
+ klass.getSimpleName()
+ " log where log.eventId=:eventId" // :FIXME:
+ " AND log.eventDate >= :date"
+ " ORDER BY log.eventDate DESC");
query.setParameter("eventId", eventId);
query.setParameter("date", limit);
results.addAll(query.getResultList());
}
List<LogEntry> returned = new ArrayList<LogEntry>();
for (LogEntry entry : results) {
returned.add(getLogEntryFactory().createLogEntryBase(entry));
}
return returned;
}
Tiry wrote:
Narcis Paslaru a écrit :I've developed the page, but it seems that there is a problem in the service implementation.Hi all,Nope, in the defaut webapp, only the logs associated to documents are visible.
I've found an interesting contribution to the audit service in authentication-audit-contrib.xml :
<extension
target="org.nuxeo.ecm.platform.audit.service.NXAuditEventsService"
point="event">
<event name="loginSuccess" />
<event name="loginFailed" />
<event name="logout" />
</extension>
Is there also a page where one can consult these logs ?
But you can use Audit API to fetch these logs and disply them in a xhtml page.
There are methods for retrieving events that are bounded to documents, and another method that only selects events, given an array of id's. Well, at least this is what the javadoc says.
There seams to be a problem implementing the IN operator in the query and it fails to list the needed events.
Do you plan to fix this soon, or do you know a workaround for this problem ?
Thanks a lot,
Narcis
PS : Here is the method I'm reffering to :
<at> SuppressWarnings("unchecked")
public List<LogEntry> queryLogs(String[] eventIds, String dateRange)
throws AuditException {
// :FIXME: This is not working remotelty since the LogEntryImpl returned
// is not within the api package.
if (eventIds == null || eventIds.length == 0) {
throw new AuditException("You must give a not null eventId");
}
log.debug("queryLogs() whereClause=" + eventIds);
Class<LogEntry> klass = getLogEntryClass();
List<LogEntry> results = new ArrayList<LogEntry>();
Date limit = null;
try {
limit = DateRangeParser.parseDateRangeQuery(new Date(), dateRange);
} catch (AuditQueryException aqe) {
throw new AuditException("Wrong date range query. Query was "
+ dateRange, aqe);
}
// :FIXME: Can't append to find the damned right syntax to build a
// dynamic list for the IN statement.
for (String eventId : eventIds) {
Query query = em.createQuery("from "
+ klass.getSimpleName()
+ " log where log.eventId=:eventId" // :FIXME:
+ " AND log.eventDate >= :date"
+ " ORDER BY log.eventDate DESC");
query.setParameter("eventId", eventId);
query.setParameter("date", limit);
results.addAll(query.getResultList());
}
List<LogEntry> returned = new ArrayList<LogEntry>();
for (LogEntry entry : results) {
returned.add(getLogEntryFactory().createLogEntryBase(entry));
}
return returned;
}
Cheers,
Narcis Paslaru
_______________________________________________
ECM mailing list
ECM-FQDHc1wsLCVb90+sfpvX0g@public.gmane.org
http://lists.nuxeo.com/mailman/listinfo/ecm
_______________________________________________ ECM mailing list ECM@... http://lists.nuxeo.com/mailman/listinfo/ecm
RSS Feed