Hmm.. thanks - so it looks like the best approach is for me to re-write things so that programming rights are not checked... because I think your suggestions still don't allow me to carry out operations that require programming rights if the user saving the doc doesn't have those rights. I can construct my api.XWiki etc... but when I pass it to my existing code that uses it to call Document.getDocument() and what not, it fails because api.Api.checkProgrammingRights() fails. Perhaps this is by design. Regards, Robin On 06/06/06, jeremi joslin <jeremi23@gmail.com> wrote:
Hi, Yes, in the context, you can get an XWiki Object. With this object, you can get a XWikiDocument non-wrapped.
You will have something like this :
XWiki xwiki = context.getXWiki(); XWikiDocument doc = xwiki.getDocument("XWiki.UserName", context);
if you want the wrapped version of the doc : Document wrappedDoc = new Document(doc, context)
Jérémi
On 6/6/06, Mark H. James <markj@3cat.com> wrote:
The context actually holds a reference to XWiki that you can get with:
context.getWiki();
So you can either call methods on that or construct a api.XWiki from it.
You should be able to modify the creator's user doc from there (I did something similar at one point).
The only thing I would caution about is that if you revise the user doc a lot, you can end up with a really large archive field fairly fast.
On Jun 3, 2006, at 6:20 PM, Robin Fernandes wrote:
Ah thanks. However the Document I want isn't necessarily the one being saved, so I need something more general. A com.xpn.xwiki.api.XWiki with prog rights would be perfect since I already have code to do what I need using that.
To put things in context: I'm attempting to modify the email notification plugin so that the creator is subscribed automatically when the document is saved (assuming the document is new or the creator has changed). I need to obtain, modify and save the creator's user document (XWiki.username) because that is where their subscription info is stored. Of course the creator isn't necessarily the user doing the save...
Regards, Robin
On 03/06/06, Mark H. James <markj@3cat.com> wrote:
The notification methods are passed an XWikiDocument instance, which can be used to construct a Document object, so this should work no matter who the user is.
Hope this helps.
On Jun 3, 2006, at 5:47 PM, Robin Fernandes wrote:
Hi all,
I have a plugin that does stuff requiring programming rights. For example it calls Document.getDocument(). This is fine: the plugin is invoked from a doc saved by someone with prog rights. The plugin API is passed the XWiki API object obtained when that document is parsed. So I can then use that to do: wiki.getDocument(blah).getDocument().
Now I need to do something similar when a document is saved, rather than when invoked by the user. So I'm implementing XWikiDocChangeNotificationInterface.notify(). However I don't know how to get an XWiki API object that will return true for checkProgrammingRights() from my notify implementation.
Assuming this makes sense, does anyone have any ideas? :)
Regards, Robin
-- You receive this message as a subscriber of the xwiki- dev@objectweb.org mailing list. To unsubscribe: mailto:xwiki-dev-unsubscribe@objectweb.org For general help: mailto:sympa@objectweb.org?subject=help ObjectWeb mailing lists service home page: http:// www.objectweb.org/ wws
-- You receive this message as a subscriber of the xwiki- dev@objectweb.org mailing list. To unsubscribe: mailto:xwiki-dev-unsubscribe@objectweb.org For general help: mailto:sympa@objectweb.org?subject=help ObjectWeb mailing lists service home page: http:// www.objectweb.org/wws
-- You receive this message as a subscriber of the xwiki- dev@objectweb.org mailing list. To unsubscribe: mailto:xwiki-dev-unsubscribe@objectweb.org For general help: mailto:sympa@objectweb.org?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/ wws
-- You receive this message as a subscriber of the xwiki-dev@objectweb.org mailing list. To unsubscribe: mailto:xwiki-dev-unsubscribe@objectweb.org For general help: mailto:sympa@objectweb.org?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
-- You receive this message as a subscriber of the xwiki-dev@objectweb.org mailing list. To unsubscribe: mailto:xwiki-dev-unsubscribe@objectweb.org For general help: mailto:sympa@objectweb.org?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws