cancel
Showing results for 
Search instead for 
Did you mean: 

get Current logged in user for forms....

sojasoja
Champ in-the-making
Champ in-the-making
Hi ,
please help me in:
1. how can i get Current logged-in user for forms?
2. how can i retrieve list of a group in a dropbox?
7 REPLIES 7

jbarrez
Star Contributor
Star Contributor
1. Authentication.getAuthenticatedUserId()

2. through the identityService.createGroupQuery()

abdou2387
Champ in-the-making
Champ in-the-making
hi
i have logged by kermit user
org.activiti.engine.impl.identity.Authentication.getAuthenticatedUserId() return null
???
please help

jbarrez
Star Contributor
Star Contributor
Then you need to provide more details. I was assuming this is in Activiti Explorer?
If so, then the authenticated user is set as above. Where are you calling this code?

abdou2387
Champ in-the-making
Champ in-the-making
I have called Authentication.getAuthenticatedUserId() in activiti explorer module

bargan
Champ in-the-making
Champ in-the-making
Hi all,
I have the same error,
when i test  "System.out.println("logger is:"+ Authentication.getAuthenticatedUserId()); "  in a class test (activiti-designer), i get null.
Or should this work just in explorer when log in ?

Regards.

hrobayo
Champ in-the-making
Champ in-the-making
Hello,

I have the same issue, but in a custom application, I handle this using Spring aspects, all the interaction with the activiti API is done in a Service Bean, creating a loginAspect before each execution ensures the authentication authenticatedUserId is set,


<code>

@Aspect
public class LoginAspect {

@Before("execution(* com.company.WfService.*(..))")
public void logBefore(JoinPoint joinPoint){
  log.info("Starting Checking authentification");
 
  //Se registra el usuario
  String wfUserName = Authentication.getAuthenticatedUserId();
 
  String auth =  get current logged user….
 
  if ( wfUserName != null && wfUserName.compareTo(auth.getUsername()) != 0 ){
   Authentication.setAuthenticatedUserId(auth.getUsername());
  }else if ( wfUserName == null ){
   Authentication.setAuthenticatedUserId(auth.getUsername());
  }  
 
}

}

</code>

wishwanath
Champ in-the-making
Champ in-the-making
import org.activiti.engine.impl.identity.Authentication;