Capture user login name in Groovy script

User 55ffa2f197

24-07-2013 12:14:18

Is there a way i can capture user login name through Grovvy script using DIF function? We authenticate users using LDAP, like to capture user name if they commit changes in Groovy script


Thanks


Dong

ChemAxon 2bdd02d1e5

29-07-2013 11:37:55

Hi Dong,


You can print currently logged user by this simple line of code:



println DIFUtilities.findCapability(schema, IJCUserLoginService.class).whoAmI();


This is valid only for schema level script, which have defined "schema" object. Otherwise you have to get the current DFSchema object first.


Filip

User 55ffa2f197

29-07-2013 13:42:26

i am writting groovy in form, how do i find my current schema?

ChemAxon 2bdd02d1e5

30-07-2013 06:53:21

It can be obtain from DFResultSet. Please see this working script example for a widget:


onDoubleClick = { event ->
rs = event.widget.form.resultSet
schema = rs.getDataTree().getSchema()
println DIFUtilities.findCapability(schema, IJCUserLoginService.class).whoAmI()
}