Skip to content

Instantly share code, notes, and snippets.

View CorneAussems's full-sized avatar
🎯
Focusing

Corné Aussems CorneAussems

🎯
Focusing
View GitHub Profile
@CorneAussems
CorneAussems / Liferay Remove and add UserGroup.grv
Created October 11, 2017 06:27
Liferay Remove and add UserGroup
import com.liferay.portal.service.*;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.util.*;
try{
serviceContext = new com.liferay.portal.service.ServiceContext()
long companyId = PortalUtil.getDefaultCompanyId()
employee = com.liferay.portal.service.UserGroupLocalServiceUtil.getUserGroup(companyId,"EMPLOYEE");
fired = com.liferay.portal.service.UserGroupLocalServiceUtil.getUserGroup(companyId,"FIRED_EMPLOYEE");
alert('Hi there this is not wat you want at all');
window.location='https://www.hackthissite.org/';
0x0802F3B93AbaE22c72dfc9E0a269dee407FE29d8
@CorneAussems
CorneAussems / updatePasswordReset.groovy
Created July 21, 2017 10:24
Groovy: Liferay Password Reset
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())
@CorneAussems
CorneAussems / LiferayReindexSpecificUser.groovy
Created June 22, 2017 16:36 — forked from anonymous/LiferayReindexSpecificUser.groovy
Groovy Liferay re-index specific User
import com.liferay.portal.kernel.search.IndexerRegistryUtil;
import com.liferay.portal.kernel.search.Indexer
import com.liferay.portal.model.User
import com.liferay.portal.util.*;
import com.liferay.portal.service.*
import com.liferay.portal.service.ServiceContext;
try {
long companyId = PortalUtil.getDefaultCompanyId();
User user = UserLocalServiceUtil.getUserByScreenName(companyId, "sasupport" );
import com.liferay.portal.model.User;
import com.liferay.portal.util.*;
import com.liferay.portal.service.*;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.security.permission.*;
try {
long companyId = PortalUtil.getDefaultCompanyId();
User user = UserLocalServiceUtil.getUserByScreenName(companyId, "sasupport" );
out.println("User:"+user);
@CorneAussems
CorneAussems / ldap.creds.groovy
Created June 5, 2017 13:12
Groovy Liferay Get LDAP credentials
import com.liferay.portal.security.ldap.*;
import com.liferay.portal.util.*;
long companyId = PortalUtil.getDefaultCompanyId()
try{
String ids = PrefsPropsUtil.getString(companyId, "ldap.server.ids");
out.println(ids);
// IDS to long
@CorneAussems
CorneAussems / groovy_assign_users_to_sites.java
Created January 15, 2017 11:07
Liferay groovy assign user to all groups/sites
### PROBLEM with array of primitives !!!
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.util.*;
long companyId = PortalUtil.getDefaultCompanyId()
long userid = 29254644;
try{
groups = com.liferay.portal.service.GroupLocalServiceUtil.getLayoutsGroups(companyId,0,true,-1,-1)
@CorneAussems
CorneAussems / Groovy Invoke URL from Liferay
Last active January 11, 2017 16:03
Groovy Invoke URL from Liferay
import org.apache.commons.httpclient.*;
import org.apache.commons.httpclient.methods.*;
import org.apache.commons.httpclient.params.HttpMethodParams;
import java.io.*;
try {
// Create an instance of HttpClient.
HttpClient client = new HttpClient();
@CorneAussems
CorneAussems / Liferay Groovy Removing SAML .groovy
Last active November 18, 2016 13:30
Liferay Groovy Removing SAML frontend settings
############################
##### Removing SPIDP ######
############################
import com.liferay.portal.template.*;
import com.liferay.portal.util.*;
try{
long companyId2 = PortalUtil.getCompanyId(actionRequest)
customLocalService = ServiceLocator.getInstance().findService('saml-portlet', 'com.liferay.saml.service.SamlSpIdpConnectionLocalService')