cancel
Showing results for 
Search instead for 
Did you mean: 

get current user from the action

ale_carraro
Champ in-the-making
Champ in-the-making
I'm creating a custom action by extending ActionExecuterAbstractBase and need to get the user that fired the action. Can I get it by the Action/NodeRef passed to executeImpl()? Or by IoC? Or it is not possible?

thanks for reading
2 REPLIES 2

kevinr
Star Contributor
Star Contributor
As the action is configured in Spring config, you can use IoC to access services including PersonService and AuthenticationService - then you can do this kind of thing:

NodeRef person = personService.getPerson(authenticationService.getCurrentUserName());
That shows getting the current username and also getting the current Person node that represents the current user.

See org.alfresco.repo.action.executer.MailActionExecuter in the Alfresco SDK for an example.

Hope this helps,

Kevin

ale_carraro
Champ in-the-making
Champ in-the-making
thank you very much! I was not able to find the getCurrentPerson, I thought it was in the person service… but it is not Smiley Wink