Hi Andrey,
On Tue, Apr 19, 2016 at 4:51 PM, abtv <andreybutov(a)mail.ru> wrote:
A couple more questions.
1. When I used my own implementation of XWikiCachingRightService I had
access to XWikiContext (there is getRequest method and I could send request
to the server with the same cookie) and I sent a request to my main app to
get data. Can I get access to underlying request data in settler? I need a
way to ask my main app about current permission. Can I use REST call inside
settler? And it would be great if I can do it with credentials of current
user.
For access to the XWikiContext, you may @Inject a Provider<XWikiContext> in
your settler directly, as well as any other XWiki component you might need.
However, if you just needs to access the request, it could be better to do
so by @Inject-ing a org.xwiki.container.Container, which give you this
access without requiring you to depend on the oldcore package. It really
depends on your needs and actual dependency, and the above is true about
any component you might need.
2. Regarding SecurityCacheRulesInvalidator. Should I
register my
implementation of SecurityCacheRulesInvalidator in xwiki.properties or
xwiki.cfg files? Or it should be only components.txt file where I
registered
other components?
There is no configuration for that component, but overriding should be done
like what is possible with any other component. So, this is harder than
just a configuration here, you need to override the original
DefaultSecurityCacheRulesInvalidator by providing another “default”
implementation of the SecurityCacheRulesInvalidator. You can either use the
prioritization of components that I mentioned earlier (see
http://extensions.xwiki.org/xwiki/bin/view/Extension/Component+Module#HOver…)
or manage your registration “by hand”
http://extensions.xwiki.org/xwiki/bin/view/Extension/Component+Module#HComp…,
for example during the initialization of your settler, depending on how you
expect to inject yourself in the system. See also my earlier reply about
this as well.
Regards,
--
Denis Gervalle
SOFTEC sa - CEO