This is the Java code to log a user out:
// This file was generated by Mendix Modeler.
//
// WARNING: Only the following code will be retained when actions are regenerated:
// - the import list
// - the code between BEGIN USER CODE and END USER CODE
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
// Other code you write will be lost the next time you deploy the project.
// Special characters, e.g., é, ö, à, etc. are supported in comments.
package basis.actions;
import com.mendix.systemwideinterfaces.core.UserAction;
import com.mendix.systemwideinterfaces.core.IContext;
import com.mendix.webui.CustomJavaAction;
/**
* Dit is een simpele uitlog java actie....
*/
public class LogOut extends CustomJavaAction<java.lang.Boolean>
{
public LogOut(IContext context)
{
super(context);
}
@java.lang.Override
public java.lang.Boolean executeAction() throws Exception
{
// BEGIN USER CODE
com.mendix.core.Core.logout(getContext().getSession());
com.mendix.webui.FeedbackHelper.addLogoutFeedback(getContext());
return true;
// END USER CODE
}
/**
* Returns a string representation of this action
*/
@java.lang.Override
public java.lang.String toString()
{
return "LogOut";
}
// BEGIN EXTRA CODE
// END EXTRA CODE
}
The user that triggers this Java code is logged out. You could use this in combination with the community commons executeMicroflowAsUser.
Regards,
Ronald
Thank you for your answer. I am pretty new to mendix.
I right clicked, add other/javascript action. Pasted the code and I got a ton of errors.
Now I have both pieces and I just need to put them together.
How do I delete the sessions listed in this list?