Created
July 21, 2017 10:24
-
-
Save CorneAussems/08e0269269d5ee19053770b0020e1fc0 to your computer and use it in GitHub Desktop.
Groovy: Liferay Password Reset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.liferay.portal.service.ServiceContext; | |
import com.liferay.portal.util.*; | |
import com.liferay.portal.service.*; | |
import com.liferay.portal.service.impl.*; | |
try { | |
companyId = companyId = PortalUtil.getDefaultCompanyId(); | |
sc = new com.liferay.portal.service.ServiceContext() | |
users = UserServiceUtil.getCompanyUsers(companyId, -1,-1 ) | |
println(users.size()) | |
for(i=0;i<users.size();i++){ | |
user = users.get(i) | |
if(user.getEmailAddress().contains("componence")){ | |
println('User found userId='+user.getUserId()+' screenname:'+user.getScreenName() + ' Lastname:'+user.getLastName()) | |
UserLocalServiceUtil.updatePasswordReset(user.getUserId(),true); | |
} | |
} | |
} catch (Exception e) { | |
println(e) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment