This page last changed on Feb 25, 2006 by dhardiker@adaptavist.com.

Cannot resolve external resource into attachment. How do I find the logged in user?

This can be retrieved easily from the com.atlassian.confluence.user.AuthenticatedUserThreadLocal class which will give you the current logged in user as a com.atlassian.user.User object.

User user = AuthenticatedUserThreadLocal.getUser();

Should the user not be logged in the user object will be null.

How can you determine if a user is an administrator? For that matter, how generally do you handle permissions? I am writing an XWork action and need to verify the privileges of the user. Some of the existing actions & suggested interfaces seem to provide permissions, but I have had no luck "autowiring" my XWork actions; the properties are always null. [This is odd because autowiring component plugins & servlet plugins seem to work fine.]

Posted by jgray@trifus.com at Mar 16, 2006 12:17

I've answered the first half of your question (in probably too much detail) here: How do I tell if a user has permission to...?

The second half - maybe post your atlassian-plugin.xml file to the Confluence developer forums so we can see if there's something amiss there?

Posted by cmiller at Mar 21, 2006 01:13
Document generated by Confluence on Mar 22, 2007 20:59