Note: This sets the current user Session to the Sakai admin
Use the SessionManager to get the current session and then use the Session to set the userId
Session s = sessionManager.getCurrentSession();
if (s != null) {
s.setUserId("admin");
} else {
log.warn("no CurrentSession, cannot set to admin user");
}
Note: This could allow you to run something that requires the admin user permissions while there is no session with appropriate permissions (or while the session is a user with lower permissions)
Site running on a free Atlassian Confluence Open Source Project License granted to Sakai Foundation. Evaluate Confluence today.