Running java code as a different user.

We run into quite some issues with security – this is due to our solution. Our task based security solution needs to update files/folder (noderefs) from user X while the system (the workflow task) is currently assigned to user Y.

This construction helped us somewhat;

String test = AuthenticationUtil.runAs(new RunAsWork<String>() {
                public String doWork() throws Exception {

                          …. do some stuff ….

                 } // end public doWork
            }, AuthenticationUtil.getSystemUserName());

 

But now I also found this blog – this also helps me with current sys user settings.

http://stackoverflow.com/questions/10225254/how-to-check-out-a-document-to-a-different-user-via-java-code-in-alfresco

 

Advertenties

Geef een reactie

Vul je gegevens in of klik op een icoon om in te loggen.

WordPress.com logo

Je reageert onder je WordPress.com account. Log uit / Bijwerken )

Twitter-afbeelding

Je reageert onder je Twitter account. Log uit / Bijwerken )

Facebook foto

Je reageert onder je Facebook account. Log uit / Bijwerken )

Google+ photo

Je reageert onder je Google+ account. Log uit / Bijwerken )

Verbinden met %s