문제

Grails에서 감사 로깅 플러그인을 사용하고 기본 사항을 알고 싶었습니다.
감사 도메인 클래스를 만들어야 도메인 클래스의 다양한 이벤트 에서이 테이블에 데이터를 지속해야합니까?


플러그인이 도메인을 만들지 않고 지속되지 않습니다. 그러나 확실히 지속됩니다. 그러나 감사 데이터를 저장하는 표준 방법이 될 것입니까? 또한

감사 로그의 항목이 와 같은 항목을 원한다면

"Timestamp"및 업데이트 된 사용자 George "의"IP "에서"IP "에서 로그인 한 사용자 Sam"

도메인에서 "onLoad" 이벤트에서 처리해야합니다.

또한 와 같은 간단한 이벤트를 어떻게 추적 할 수 있습니까?

"사용자 Rita"타임 스탬프 "에서 로그인 한"

감사합니다

도움이 되었습니까?

해결책

The audit logging plugin is much more automated than it appears you think. The plugin does indeed have its own domain class and does save all the audit information for you, without you having to do anything other than adding 'auditable=true' to your domain class that you want audited!

As to the second part of your question, if sam updated george, the update to the fields on 'george' would be audited (assuming you added auditable=true to the domain class that george is), and the fact that sam did it would be captured by the 'actor' information depending on what security framework you're using (this is documented in the plugin).

Your desire to log timestamp and IP upon login may fall outside the audit logging plugin, unless there is a specific change to a domain class that you can capture when someone logs in.

다른 팁

The 0.5+ version, 13 October 2010, includes the ability to specify an actorClosure in Config.groovy. The documentation at the link below has examples of how to get user information using several different security plugins.

http://grails.org/plugin/audit-logging

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top