Hi Caleb & Sergiu,

    /**
> +     * Loads an Document from the database. Rights are checked on the
> author (contentAuthor) of the document
> +     * containing the currently executing script before sending back the
> loaded document.
> +     *
> +     * @param fullName the full name of the XWiki document to be loaded
> +     * @return a Document object or null if it is not accessible
> +     * @throws XWikiException
> +     * @since 2.3M1
> +     */
> +    public Document getDocumentAsAuthor(String fullName) throws
> XWikiException
> +    {
> +        DocumentReference reference;
> +
> +        // We ignore the passed full name if it's null to match behavior
> of getDocument
> +        if (fullName != null) {
> +            // Note: We use the CurrentMixed Resolver since we want to use
> the default page name if the page isn't
> +            // specified in the passed string, rather than use the current
> document's page name.
> +            reference =
> this.currentMixedDocumentReferenceResolver.resolve(fullName);
> +        } else {
> +            reference = this.defaultDocumentReferenceResolver.resolve("");
> +        }
> +

 +        return getDocument(reference);
>

This doesn't make sense, silly copy paste probably, shouldn't it be return
getDocumentAsAuthor(reference); ?


> +    }
>

On Tue, Mar 30, 2010 at 04:28, Sergiu Dumitriu <[email protected]> wrote:
>
> I wonder if this is the best way to get the content author. What happens
> with all the different include methods? Specifically, DocumentA includes
> DocumentB (sheet or topic), the call is in DocumentB; what is the
> context document?
>
> > +        String author = getXWikiContext().getDoc().getContentAuthor();
>

Please have a look at XWIKI-5027, it is the right place for discussing that
issue.
Caleb changes does not make anything worse, but this is not perfect for
sure.

Denis

-- 
Denis Gervalle
SOFTEC sa - CEO
eGuilde sarl - CTO
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to